diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js b/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js index 5ddf188..3887e4f 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js @@ -1,4 +1,4 @@ -// Files backup: the folders the person chose through the system's picker, +// Files and WhatsApp backups: folders chosen through the system's picker, // sent into `<folder>/<account>-drive/<chosen folder>/…` of the destination // every backup shares (sync-destination.js), once a day, on an unmetered // network, like photos (docs/MESHBAY_DESIGN.md §9.13). @@ -23,7 +23,26 @@ const drive = createBackup({ say: (code) => t('phonesync.notice', { what: t('drivesync.heading'), reason: failureText(code) }), }); -export const startDriveSync = (context) => drive.start(context); -export const stopDriveSync = () => drive.stop(); +// WhatsApp's own folder: the same runner over its bridge, into +// `<folder>/<account>-whatsapp/` (DriveKind.kt says what is sent). +const whatsapp = createBackup({ + name: 'WhatsApp', + sync: platform.whatsappSync, + configured: (status) => Boolean(status.on) && (status.folders || []).length > 0, + progress: 'whatsappsync.notif_progress', + failures: LASTING, + say: (code) => t('phonesync.notice', { what: t('whatsappsync.heading'), reason: failureText(code) }), +}); + +export function startDriveSync(context) { + drive.start(context); + whatsapp.start(context); +} +export function stopDriveSync() { + drive.stop(); + whatsapp.stop(); +} export const runDriveSync = (opts) => drive.run(opts); export const subscribe = (fn) => drive.subscribe(fn); +export const runWhatsAppSync = (opts) => whatsapp.run(opts); +export const subscribeWhatsApp = (fn) => whatsapp.subscribe(fn); |