feat: sync notification badge + clarify cloud storage support
Notification system:
- When sync applies data (file folder, browser account, or sync code),
ss_sync_notification is written to local storage with the source.
- Service worker catches it via storage.onChanged, shows a purple 'SYN'
badge on the extension icon that persists until Options is opened, and
fires a desktop notification ('Settings updated via sync folder — open
Options to review').
- Clicking the desktop notification opens the Options page directly.
- On service worker wake, SYN badge is restored if the notification was
not yet dismissed.
- Opening Options clears ss_sync_notification, resets the badge, and
sends a sync:notification-seen message to the service worker.
- Added 'notifications' permission to both manifests.
Cloud storage clarity:
- Options page now explicitly lists that the folder sync works with any
cloud storage that has a desktop sync client: Dropbox, OneDrive, Google
Drive, iCloud Drive, Box, pCloud, Nextcloud, Synology Drive, etc.
https://claude.ai/code/session_01TKpSR9M8JgHLXCp5CeDsQP
This commit is contained in:
+8
-4
@@ -65,7 +65,7 @@ const SilentSendSync = {
|
||||
}
|
||||
}
|
||||
|
||||
await this._applyData(data);
|
||||
await this._applyData(data, 'code');
|
||||
return { success: true, importTime: new Date(data.lastModified).toLocaleString() };
|
||||
} catch (e) {
|
||||
return { success: false, reason: e.message };
|
||||
@@ -131,7 +131,7 @@ const SilentSendSync = {
|
||||
const json = chunkKeys.map(k => chunkResult[k] || '').join('');
|
||||
const data = JSON.parse(json);
|
||||
|
||||
await this._applyData(data);
|
||||
await this._applyData(data, 'browser-sync');
|
||||
return { imported: true, time: new Date(data.lastModified).toLocaleString() };
|
||||
} catch (e) {
|
||||
console.warn('[Silent Send] pullFromSyncStorage failed:', e);
|
||||
@@ -154,8 +154,12 @@ const SilentSendSync = {
|
||||
};
|
||||
},
|
||||
|
||||
async _applyData(data) {
|
||||
const toSet = { ss_lastModified: data.lastModified };
|
||||
async _applyData(data, source = 'unknown') {
|
||||
const toSet = {
|
||||
ss_lastModified: data.lastModified,
|
||||
// Signal the service worker to show a badge/notification
|
||||
ss_sync_notification: { source, time: Date.now() },
|
||||
};
|
||||
if (data.identity !== undefined) toSet.ss_identity = data.identity;
|
||||
if (data.mappings !== undefined) toSet.ss_mappings = data.mappings;
|
||||
if (data.settings !== undefined) toSet.ss_settings = data.settings;
|
||||
|
||||
Reference in New Issue
Block a user