fix: openNativeSettings uses try/catch instead of fragile typeof check
This commit is contained in:
+7
-7
@@ -2362,13 +2362,13 @@ function _kioskReconfigureScale() {
|
|||||||
// ── Kiosk: open native SettingsActivity (server URL, BLE, screensaver) ──
|
// ── Kiosk: open native SettingsActivity (server URL, BLE, screensaver) ──
|
||||||
function _openKioskNativeSettings() {
|
function _openKioskNativeSettings() {
|
||||||
if (typeof _kioskBridge === 'undefined') return;
|
if (typeof _kioskBridge === 'undefined') return;
|
||||||
if (typeof _kioskBridge.openNativeSettings === 'function') {
|
// Use try/catch directly: Android @JavascriptInterface methods are not always
|
||||||
try { _kioskBridge.openNativeSettings(); } catch(e) {}
|
// detected as 'function' by typeof, so we just call and catch if unavailable.
|
||||||
} else {
|
try {
|
||||||
// Older APK without openNativeSettings — make the native gear button
|
_kioskBridge.openNativeSettings();
|
||||||
// temporarily visible with a hint to tap it.
|
} catch(e) {
|
||||||
try { _kioskBridge.setNativeSettingsVisible(true); } catch(_) {}
|
// Older APK without openNativeSettings bridge — inform user to update
|
||||||
showToast(t('settings.kiosk.native_tap_hint') || 'Tocca la rotella ⚙️ in alto a destra', 'info', 4000);
|
showToast(t('settings.kiosk.native_update_hint') || 'Aggiorna l\'app kiosk per usare questa funzione', 'warning', 4000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -681,7 +681,8 @@
|
|||||||
"native_title": "Kiosk-Konfiguration",
|
"native_title": "Kiosk-Konfiguration",
|
||||||
"native_hint": "Server-URL, BLE-Waage, Bildschirmschoner und Einrichtungsassistent.",
|
"native_hint": "Server-URL, BLE-Waage, Bildschirmschoner und Einrichtungsassistent.",
|
||||||
"native_btn": "Kiosk-Konfiguration öffnen",
|
"native_btn": "Kiosk-Konfiguration öffnen",
|
||||||
"native_tap_hint": "Zahnrad oben rechts antippen"
|
"native_tap_hint": "Zahnrad oben rechts antippen",
|
||||||
|
"native_update_hint": "Kiosk-App aktualisieren, um diese Funktion zu nutzen"
|
||||||
},
|
},
|
||||||
"saved": "✅ Konfiguration gespeichert!",
|
"saved": "✅ Konfiguration gespeichert!",
|
||||||
"saved_local": "✅ Konfiguration lokal gespeichert",
|
"saved_local": "✅ Konfiguration lokal gespeichert",
|
||||||
|
|||||||
@@ -681,7 +681,8 @@
|
|||||||
"native_title": "Kiosk Configuration",
|
"native_title": "Kiosk Configuration",
|
||||||
"native_hint": "Server URL, BLE scale, screensaver and setup wizard.",
|
"native_hint": "Server URL, BLE scale, screensaver and setup wizard.",
|
||||||
"native_btn": "Open kiosk configuration",
|
"native_btn": "Open kiosk configuration",
|
||||||
"native_tap_hint": "Tap the gear button at the top right"
|
"native_tap_hint": "Tap the gear button at the top right",
|
||||||
|
"native_update_hint": "Update the kiosk app to use this feature"
|
||||||
},
|
},
|
||||||
"saved": "✅ Configuration saved!",
|
"saved": "✅ Configuration saved!",
|
||||||
"saved_local": "✅ Configuration saved locally",
|
"saved_local": "✅ Configuration saved locally",
|
||||||
|
|||||||
@@ -681,7 +681,8 @@
|
|||||||
"native_title": "Configurazione Kiosk",
|
"native_title": "Configurazione Kiosk",
|
||||||
"native_hint": "URL server, bilancia BLE, salvaschermo e setup wizard.",
|
"native_hint": "URL server, bilancia BLE, salvaschermo e setup wizard.",
|
||||||
"native_btn": "Apri configurazione kiosk",
|
"native_btn": "Apri configurazione kiosk",
|
||||||
"native_tap_hint": "Tocca la rotella in alto a destra"
|
"native_tap_hint": "Tocca la rotella in alto a destra",
|
||||||
|
"native_update_hint": "Aggiorna l'app kiosk per usare questa funzione"
|
||||||
},
|
},
|
||||||
"saved": "✅ Configurazione salvata!",
|
"saved": "✅ Configurazione salvata!",
|
||||||
"saved_local": "✅ Configurazione salvata localmente",
|
"saved_local": "✅ Configurazione salvata localmente",
|
||||||
|
|||||||
Reference in New Issue
Block a user