aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js b/packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js
index 0602e54..998a3b2 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/phone-sync-settings.js
@@ -1,6 +1,6 @@
-// The contacts and messages sections of the Android Sync page, on the Android
-// application only (docs/MESHBAY_DESIGN.md §9.13). Loaded on demand: no other
-// client has it. Where the copies go is the page's destination section; these
+// The contacts, calendar and messages sections of the Android Sync page, on
+// the Android application only (docs/MESHBAY_DESIGN.md §9.13). Loaded on
+// demand: no other client has it. Where the copies go is the page's destination section; these
// only turn each backup on or off.
import { html, useState, useEffect, useCallback } from './vendor/htm-preact.js';
@@ -13,9 +13,16 @@ const TEXT = {
intro: 'contactsync.intro',
permission: 'contactsync.permission_needed',
},
+ calendar: {
+ intro: 'calendarsync.intro',
+ permission: 'calendarsync.permission_needed',
+ },
messages: {
intro: 'messagesync.intro',
permission: 'messagesync.permission_needed',
+ // Android keeps text messages behind "restricted settings" for an
+ // application installed outside a store: said, with the way to lift it.
+ restricted: 'messagesync.restricted_hint',
},
};
@@ -55,7 +62,7 @@ export function DocSyncSection({ kind, destination }) {
if (st.permission !== 'granted') st = await sync.permit();
if (st.permission !== 'granted') { setStatus(st); return; }
setStatus(await sync.configure({}));
- runDocSync(kind);
+ runDocSync(kind, { force: true });
} catch (e) {
setError(e.message);
} finally {
@@ -80,7 +87,12 @@ export function DocSyncSection({ kind, destination }) {
<p class="settings-hint">${t(TEXT[kind].intro)}</p>
${!destination && html`<p class="settings-hint">${t('androidsync.dest_needed')}</p>`}
${destination && status.permission !== 'granted' && html`
- <p class="settings-hint">${t(TEXT[kind].permission)}</p>`}
+ <p class="settings-hint">${t(TEXT[kind].permission)}</p>
+ ${TEXT[kind].restricted && html`
+ <p class="settings-hint">${t(TEXT[kind].restricted)}</p>
+ <button class="btn-secondary" style="margin-bottom:8px"
+ onClick=${() => sync.openSettings().catch((e) => setError(e.message))}>
+ ${t('phonesync.open_settings')}</button>`}`}
${destination && html`
<button class="admin-btn" disabled=${busy} onClick=${turnOn}>${t('phonesync.turn_on')}</button>`}
`}