feat(update): gate in-app updater to Android only

The updater downloads an .apk and hands it to the system package
installer, which only exists on Android. Add an isAndroid() flag in
mobile.js and run the update check behind it, so the update row never
appears on iOS or the web build.
This commit is contained in:
Sebastian G committed 2026-09-04 13:01:42 +02:00
1 parent 15b95eb434
commit 2c5678e877
4 files changed
+22 -4

No files matched your search

+16
View File
@@ -15,6 +15,22 @@ import { effectiveRoutineId } from './history.js'
export const MOBILE = import.meta.env.VITE_MOBILE === '1'
// Some features only make sense on Android. The in-app updater downloads an .apk and hands it
// to the system package installer — there is no equivalent on iOS (App Store only) or on the
// web build. On anything but a native Android shell this must stay off.
//
// @capacitor/core is imported dynamically (like every other Capacitor dependency here) so it
// never lands in the web bundle. Capacitor.getPlatform() returns 'android' | 'ios' | 'web'.
export async function isAndroid() {
if (!MOBILE) return false
try {
const { Capacitor } = await import('@capacitor/core')
return Capacitor.getPlatform() === 'android'
} catch (e) {
return false
}
}
const FILE = 'opengym-state.json'
export async function nativeLoad() {