This commit is contained in:
@@ -53,9 +53,18 @@ const webPlatform = {
|
||||
// Detect Android/Capacitor and enable native APK updates
|
||||
if (window.Capacitor?.isNativePlatform?.()) {
|
||||
const YAML_URL = 'https://gitea.moyettes.com/Moyettes/DiscordClone/releases/download/latest/latest-android.yml';
|
||||
const AppUpdater = window.Capacitor.Plugins.AppUpdater;
|
||||
// MainActivity.java's `registerPlugin(AppUpdaterPlugin.class)` puts this
|
||||
// on `window.Capacitor.Plugins.AppUpdater` at runtime. Guard against
|
||||
// the plugin being absent in case a future build forgets to register
|
||||
// it — the whole updater surface then no-ops instead of NPE-ing on
|
||||
// first invocation.
|
||||
const AppUpdater = window.Capacitor?.Plugins?.AppUpdater;
|
||||
let apkUrl;
|
||||
|
||||
if (!AppUpdater) {
|
||||
console.warn('[UpdateCheck] AppUpdater plugin not found — updates disabled');
|
||||
}
|
||||
|
||||
webPlatform.updates = {
|
||||
async checkUpdate() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user