diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/app.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/app.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/app.js b/packages/meshbay-hub/src/meshbay_hub/static/app.js index e2d5742..41a608f 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/app.js @@ -904,6 +904,30 @@ function App() { pullOnce(user.userId).catch(() => {}); }, [user, groups.length]); + // Photo backup (docs/MESHBAY_DESIGN.md §9.12), on the Android application + // only: loaded and started once signed in, stopped on sign-out. A run reads + // the live user and bundle key when it starts, never ones captured here. + const syncAccount = user ? user.username : null; + useEffect(() => { + if (!syncAccount || !platform.photoSync.available) return undefined; + let stop = null; + let gone = false; + import('./photo-sync.js').then((m) => { + if (gone) return; + m.startPhotoSync({ + hub: HUB, + getUser: () => userRef.current, + getBundleKey: async () => { + const key = session.bundleKey || await _loadBundleKey(); + if (key) session.bundleKey = key; + return key; + }, + }); + stop = m.stopPhotoSync; + }).catch((e) => console.warn('[MeshBay] photo backup did not load:', e.message)); + return () => { gone = true; if (stop) stop(); }; + }, [syncAccount]); + // Saving the queue is a shell-level action because the queue is: the player // bar outlives every page, and the account it belongs to is here. const [saveQueue, setSaveQueue] = useState(null); |