diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 586e64592b..5c1b2bb911 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -164,6 +164,9 @@ "LabelCancelsync": { "message": "Cancel sync" }, + "LabelSyncall": { + "message": "Sync all profiles" + }, "LabelAutosync": { "message": "Auto-sync" }, @@ -185,6 +188,9 @@ "StatusSyncing": { "message": "Syncing" }, + "StatusScheduled": { + "message": "Scheduled" + }, "LabelReset": { "message": "Reset" }, diff --git a/src/lib/Controller.ts b/src/lib/Controller.ts index d208708b49..737067652d 100644 --- a/src/lib/Controller.ts +++ b/src/lib/Controller.ts @@ -87,6 +87,14 @@ export default class Controller implements IController { console.log('Sending message to service worker: ', message) } + async scheduleAll(): Promise { + console.log('Waiting for service worker readiness') + const worker = await this.getWorker() + const message = {type: 'scheduleAll', params: []} + worker.postMessage(message) + console.log('Sending message to service worker: ', message) + } + async setEnabled(enabled: boolean): Promise { const worker = await this.getWorker() const message = {type: 'setEnabled', params: [enabled]} diff --git a/src/lib/browser/BrowserController.js b/src/lib/browser/BrowserController.js index d63af60bc9..da3e7d31fe 100644 --- a/src/lib/browser/BrowserController.js +++ b/src/lib/browser/BrowserController.js @@ -281,10 +281,18 @@ export default class BrowserController { } this.waiting[accountId] = true + await account.setData({ ...account.getData(), scheduled: true }) return this.jobs.add(() => this.syncAccount(accountId)) } + async scheduleAll() { + const accounts = await Account.getAllAccounts() + for (const account of accounts) { + this.scheduleSync(account.id) + } + } + async cancelSync(accountId, keepEnabled) { let account = await Account.get(accountId) // Avoid starting it again automatically @@ -302,6 +310,7 @@ export default class BrowserController { return } let account = await Account.get(accountId) + await account.setData({ ...account.getData(), scheduled: false }) if (account.getData().syncing) { console.log('Account is already syncing. Not triggering another sync.') return diff --git a/src/lib/interfaces/Controller.ts b/src/lib/interfaces/Controller.ts index 9856b2cf7e..545fa6b22a 100644 --- a/src/lib/interfaces/Controller.ts +++ b/src/lib/interfaces/Controller.ts @@ -2,6 +2,7 @@ export default interface IController { setEnabled(enabled:boolean): void; unlock(key):Promise; scheduleSync(accountId, wait):Promise; + scheduleAll():Promise; cancelSync(accountId, keepEnabled):Promise; syncAccount(accountId, strategy):Promise; onStatusChange(listener):()=>void; diff --git a/src/lib/native/NativeController.js b/src/lib/native/NativeController.js index c3e72b841c..1dbd92bc60 100644 --- a/src/lib/native/NativeController.js +++ b/src/lib/native/NativeController.js @@ -91,6 +91,13 @@ export default class NativeController { return Promise.resolve(this.unlocked) } + async scheduleAll() { + const accounts = await Account.getAllAccounts() + for (const account of accounts) { + this.scheduleSync(account.id) + } + } + async scheduleSync(accountId, wait) { if (wait) { if (this.schedule[accountId]) { diff --git a/src/ui/components/AccountCard.vue b/src/ui/components/AccountCard.vue index 7c52642583..0f10ad9076 100644 --- a/src/ui/components/AccountCard.vue +++ b/src/ui/components/AccountCard.vue @@ -111,6 +111,7 @@ @@ -48,11 +49,18 @@ {{ t('LabelNewAccount') }} + class="me-1" + :title="t('LabelImportExport')" + :to="{ name: routes.IMPORTEXPORT }" + target="_blank"> mdi-export + + mdi-sync-circle + @@ -61,6 +69,7 @@