fix: move modal countdown stops on touch; vacuum btn no longer triggers native settings

This commit is contained in:
dadaloop82
2026-05-14 12:22:45 +00:00
parent 1b7b271b43
commit 8bb6c01b7d
2 changed files with 25 additions and 0 deletions
+15
View File
@@ -4820,6 +4820,9 @@ function showItemDetail(inventoryId, productId) {
function closeModal() { function closeModal() {
document.getElementById('modal-overlay').style.display = 'none'; document.getElementById('modal-overlay').style.display = 'none';
clearMoveModalTimer();
// Restore native kiosk settings button visibility
try { if (typeof _kioskBridge !== 'undefined') _kioskBridge.setNativeSettingsVisible(true); } catch (_) {}
_cancelScaleAutoConfirm(false); _cancelScaleAutoConfirm(false);
_scaleRecipeAutoFillPaused = false; _scaleRecipeAutoFillPaused = false;
_scaleUserDismissed = false; _scaleUserDismissed = false;
@@ -8048,14 +8051,22 @@ function closeLowStockPrompt() {
let _moveModalTimer = null; let _moveModalTimer = null;
let _moveModalRAF = null; let _moveModalRAF = null;
let _moveModalTouchHandler = null;
function clearMoveModalTimer() { function clearMoveModalTimer() {
if (_moveModalTimer) { clearTimeout(_moveModalTimer); _moveModalTimer = null; } if (_moveModalTimer) { clearTimeout(_moveModalTimer); _moveModalTimer = null; }
if (_moveModalRAF) { cancelAnimationFrame(_moveModalRAF); _moveModalRAF = null; } if (_moveModalRAF) { cancelAnimationFrame(_moveModalRAF); _moveModalRAF = null; }
if (_moveModalTouchHandler) {
document.getElementById('modal-content')?.removeEventListener('pointerdown', _moveModalTouchHandler, true);
_moveModalTouchHandler = null;
}
} }
function startMoveModalCountdown(btnId, onExpire) { function startMoveModalCountdown(btnId, onExpire) {
clearMoveModalTimer(); clearMoveModalTimer();
// Any touch inside the modal cancels the auto-close countdown
_moveModalTouchHandler = () => clearMoveModalTimer();
document.getElementById('modal-content')?.addEventListener('pointerdown', _moveModalTouchHandler, { capture: true, once: true });
const duration = 15000; const duration = 15000;
const start = performance.now(); const start = performance.now();
const btn = document.getElementById(btnId); const btn = document.getElementById(btnId);
@@ -8102,6 +8113,8 @@ function showMoveAfterUseModal(product, fromLoc, remaining, openedId, openedVacu
</div> </div>
`; `;
document.getElementById('modal-overlay').style.display = 'flex'; document.getElementById('modal-overlay').style.display = 'flex';
// Hide the native kiosk settings button while the modal is open (prevents touch bleed-through)
try { if (typeof _kioskBridge !== 'undefined') _kioskBridge.setNativeSettingsVisible(false); } catch (_) {}
startMoveModalCountdown('btn-move-stay', () => { _saveVacuumAndStay(openedId || 0); }); startMoveModalCountdown('btn-move-stay', () => { _saveVacuumAndStay(openedId || 0); });
} }
@@ -11729,6 +11742,8 @@ function showRecipeMoveModal(productId, fromLoc, remaining, openedId, wasVacuum)
</div> </div>
`; `;
document.getElementById('modal-overlay').style.display = 'flex'; document.getElementById('modal-overlay').style.display = 'flex';
// Hide the native kiosk settings button while the modal is open (prevents touch bleed-through)
try { if (typeof _kioskBridge !== 'undefined') _kioskBridge.setNativeSettingsVisible(false); } catch (_) {}
startMoveModalCountdown('btn-move-stay', () => { closeModal(); }); startMoveModalCountdown('btn-move-stay', () => { closeModal(); });
} }
@@ -492,6 +492,16 @@ class KioskActivity : AppCompatActivity() {
if (apkUrl.isBlank()) return if (apkUrl.isBlank()) return
runOnUiThread { triggerApkDownload(apkUrl) } runOnUiThread { triggerApkDownload(apkUrl) }
} }
/**
* Called by the webapp when a modal is shown / hidden so the native settings
* button does not intercept touches that belong to the HTML modal content.
*/
@JavascriptInterface
fun setNativeSettingsVisible(visible: Boolean) {
runOnUiThread {
btnSettings.visibility = if (visible) View.VISIBLE else View.GONE
}
}
}, "_kioskBridge") }, "_kioskBridge")
val url = prefs.getString(KEY_URL, "http://evershelf.local") ?: "http://evershelf.local" val url = prefs.getString(KEY_URL, "http://evershelf.local") ?: "http://evershelf.local"