Skip to content

Commit

Permalink
feat: grouping notifications #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Candinya committed Aug 23, 2022
1 parent d359ece commit a274892
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/content-script/hooks/twitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ class TwitterHook {
}, 10);
} else {
this.main.xlog('info', `Failed to find note info.`);
ElMessage.error('CrossSync encountered a problem: Failed to find note info.');
ElMessage.error({
message: 'CrossSync encountered a problem: Failed to find note info.',
grouping: true,
});
}
}
});
Expand Down Expand Up @@ -138,6 +141,7 @@ class TwitterHook {
message:
'<p>CrossSync is syncing your post...</p><p style="margin-top: 7px;font-size: 12px;">(2/2) Waiting for signature and transaction on Crossbell</p>',
duration: 0,
grouping: true,
});

const unidata = await this.main.getUnidata();
Expand All @@ -152,21 +156,30 @@ class TwitterHook {
},
note,
);
ElMessage.success('CrossSync has successfully synced your post to blockchain! 🎉');
ElMessage.success({
message: 'CrossSync has successfully synced your post to blockchain! 🎉',
grouping: true,
});

if (data.code !== 0) {
ElMessage.error(`CrossSync encountered a problem: ${data.message}`);
}
} catch (e) {
this.main.xlog('error', 'Failed to post note.', e);
ElMessage.error('CrossSync encountered a problem: Unidata failed to post note.');
ElMessage.error({
message: 'CrossSync encountered a problem: Unidata failed to post note.',
grouping: true,
});

(<any>window).cssc.syncing = null;
(<any>window).cssc.updateSyncing?.[url || '']?.('synced');
}
} else {
this.main.xlog('info', `Failed to get Unidata Instance.`);
ElMessage.error('CrossSync encountered a problem: Unidata instance is not ready.');
ElMessage.error({
message: 'CrossSync encountered a problem: Unidata instance is not ready.',
grouping: true,
});
}

notice?.close();
Expand All @@ -188,6 +201,7 @@ class TwitterHook {
message:
'<p>CrossSync is syncing your post...</p><p style="margin-top: 7px;font-size: 12px;">(1/2) Uploading post attachments to IPFS</p>',
duration: 0,
grouping: true,
});

const attachments = (
Expand Down

0 comments on commit a274892

Please sign in to comment.