From 4cc16467387c9eecc3f1844a89b869d38010e76f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 21:44:36 +0000 Subject: [PATCH] Implement consistent Return to Rotation UX across all sites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update provides a unified, predictable inactivity prompt behavior regardless of how the user navigated to a page. Changes: - Added userInteractedWithCurrentSite flag to track user touch on each site - Modified markActivity() to set flag when user interacts (tap, swipe, scroll) - Modified attachView() to clear flag when site changes - Updated inactivity check to use interaction flag instead of navigation mode New Behavior (Consistent UX): ✅ Scenario A: Auto-rotation to recipe → user taps → prompt after timeout - Site auto-rotates to recipe page - User taps screen to scroll/interact - userInteractedWithCurrentSite = true - After 2 min idle → prompt appears - User can extend time or return to rotation ✅ Scenario B: User swiping through photos every 30 seconds - Each swipe resets inactivity timer via markActivity() - No prompt appears (user is actively interacting) - Prompt only appears after they stop swiping for timeout period ✅ Scenario C: Sites auto-rotating with no user interaction - userInteractedWithCurrentSite = false on each site - No prompt appears - Rotation continues normally Technical Details: - Single-finger swipes (in-page content): Reset timer via markActivity() - Two-finger swipes (tab navigation): Also sets manualNavigationMode - Both types of interaction trigger the flag - Flag cleared on every site change (auto or manual) - If manual swipe, markActivity() re-sets it immediately Use Cases: - Recipe viewing: User can interact with page, get timeout prompt, extend time - Photo browsing: Continuous swiping prevents timeout - Digital signage: No interaction = no prompt = smooth rotation - MagicMirror modules: Single-finger swipes keep resetting timer This provides the consistent UX requested where ANY user interaction on ANY site enables the inactivity prompt logic. --- install_kiosk_v0.9.8.sh | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/install_kiosk_v0.9.8.sh b/install_kiosk_v0.9.8.sh index 6352bbb..72523f9 100644 --- a/install_kiosk_v0.9.8.sh +++ b/install_kiosk_v0.9.8.sh @@ -15,7 +15,12 @@ # * Button changed from "🏠 Return to home now" to "🔄 Return to rotation" # * If not on home page: returns to home page, then starts rotation # * If on home page: just starts the rotation -# * Allows time extensions even on home screen (e.g., viewing recipes) +# - Consistent inactivity prompt UX across ALL sites +# * Prompt appears on ANY site where user has interacted (tap, swipe, scroll) +# * Auto-rotation to recipe → user taps → prompt appears after timeout ✅ +# * User swiping through photos → keeps resetting timer, no prompt ✅ +# * Auto-rotation with no interaction → no prompt, keeps rotating ✅ +# * Works on home page, timed sites, and manual sites consistently # - Fixed site edit menu not returning to configuration menu # * Edit site URL flow now completes properly # - Time extension features work correctly @@ -3505,6 +3510,7 @@ let keyboardLastUsed=0; let inactivityExtensionUntil=0; let manualNavigationMode=false; let programmaticNavigation=false; +let userInteractedWithCurrentSite=false; // v0.9.8: Track if user touched current site let mediaIsPlaying=false; let userRecentlyActive=false; @@ -3568,15 +3574,22 @@ function loadConfig(){ function markActivity(){ const now=Date.now(); const timeSinceLastActivity=now-lastUserInteraction; - + if(timeSinceLastActivity>5000){ console.log('[ACTIVITY] User interaction detected'); } - + lastUserInteraction=now; userRecentlyActive=true; lastLockoutCheck=now; // Reset lockout timer on activity + // v0.9.8: Mark that user has interacted with this site + // This triggers inactivity prompt logic for ANY site (not just manual/home) + if(!userInteractedWithCurrentSite){ + console.log('[ACTIVITY] 🖐️ User touched this site - inactivity timer active'); + userInteractedWithCurrentSite=true; + } + if(promptWindow&&!promptWindow.isDestroyed()){ console.log('[ACTIVITY] Closing inactivity prompt'); promptWindow.close(); @@ -3800,15 +3813,17 @@ function startMasterTimer(){ } } -// 7. INACTIVITY CHECK (works on ALL pages including home!) +// 7. INACTIVITY CHECK (works on ALL pages where user has interacted!) if(homeTabIndex>=0&&!showingHidden){ const homeViewIdx=getHomeViewIndex(); const currentTabIdx=viewIndexToTabIndex(currentIndex); const isOnHomePage=(homeViewIdx>=0&¤tIndex===homeViewIdx); - // v0.9.8: Show inactivity prompt on ALL pages (including home) - // This allows users to extend time even when viewing recipes, etc. - if(manualNavigationMode||isOnHomePage){ + // v0.9.8: Show inactivity prompt on ANY site where user has interacted + // - Auto-rotates to recipe → user taps → prompt appears after timeout + // - User keeps swiping through photos → keeps resetting, no prompt + // - No user interaction → no prompt, just keeps rotating + if(userInteractedWithCurrentSite){ const idleTime=now-lastUserInteraction; // CRITICAL FIX: Use absolute time check for extensions @@ -3930,6 +3945,11 @@ function attachView(i){ views[i].webContents.focus(); siteStartTime=Date.now(); + + // v0.9.8: Clear interaction flag when site changes + // Will be set back to true if user manually swiped here (markActivity called after) + // Will stay false if auto-rotated (no user interaction yet) + userInteractedWithCurrentSite=false; } function nextTab(){