-
Notifications
You must be signed in to change notification settings - Fork 407
Feature: Kiosk Mode (7/7) - Camera Popup & Settings UI #4203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Part 1 of Kiosk Mode implementation. This PR adds the foundation for Kiosk Mode: ## KioskSettings.swift - Complete settings model with all configuration options - Codable for persistence - Includes enums for screensaver modes, clock styles, photo sources, etc. - Entity trigger configurations - Dashboard rotation settings ## KioskConstants.swift - Centralized constants for animations, timing, notifications - Notification names for kiosk events ## Utilities - IconMapper: Converts MDI icons to SF Symbols - TouchFeedbackManager: Haptic and audio feedback - AnimationUtilities: Shared animation helpers These types form the foundation that subsequent PRs will build upon.
Part 2 of Kiosk Mode implementation. Depends on PR home-assistant#4197. ## KioskModeManager (~970 lines) Central coordinator for all kiosk functionality: - Enable/disable kiosk mode - Screen state management (on, dimmed, screensaver) - Brightness control with day/night scheduling - Idle timer and activity tracking - Dashboard navigation - Entity trigger subscriptions - HA WebSocket integration ## Security (~760 lines) - SecurityManager: PIN and biometric authentication - SettingsManager: Settings persistence ## Dashboard (~360 lines) - DashboardManager: Dashboard rotation and scheduling ## Camera Detection (~320 lines) - CameraDetectionManager: Motion and presence detection using front camera ## App Launcher (~360 lines) - AppLauncherManager: Launch external apps, return handling ## WebViewController Integration (~565 lines) - WebViewController+Kiosk: Kiosk overlay management - Modified WebViewController: Made properties internal for kiosk access
Part 3 of Kiosk Mode implementation. Depends on PRs home-assistant#4197 and home-assistant#4198. Adds screensaver functionality with multiple display modes: Files added (~52K): - ClockScreensaverView.swift: Clock display with multiple styles (large, minimal, digital, analog) - CustomURLScreensaverView.swift: Display custom HA dashboard as screensaver - EntityStateProvider.swift: Fetches and formats entity states for display - PhotoManager.swift: Manages photo loading from device, iCloud, and HA media - PhotoScreensaverView.swift: Photo slideshow with transitions - ScreensaverViewController.swift: UIKit controller coordinating screensaver presentation Features: - Multiple screensaver modes: clock, photos, dim, blank, custom URL - Clock styles: large, minimal, digital, analog with entity display - Photo sources: device albums, iCloud, Home Assistant media - Pixel shift for burn-in prevention - Day/night brightness scheduling
Part 4 of Kiosk Mode implementation. Depends on PRs home-assistant#4197, home-assistant#4198, home-assistant#4199. Adds navigation lockdown and overlay UI components: Files added (~39K): - EdgeProtectionView.swift: Invisible edge barriers preventing swipe gestures - QuickActionsView.swift: Quick launch panel for third-party apps - SecretExitGestureView.swift: Hidden gesture sequence to exit kiosk mode - StatusOverlayView.swift: Connection status, battery, and time display Features: - Edge protection blocks iOS system gestures (Control Center, notifications) - Configurable secret tap pattern for secure kiosk exit - Quick actions panel with app shortcuts - Status bar overlay with connection indicator
Part 5 of Kiosk Mode implementation. Depends on PRs home-assistant#4197-home-assistant#4200. Files added (~51K): Security: - BatteryManager.swift: Battery monitoring, low battery alerts - CrashRecoveryManager.swift: Automatic crash recovery and restart - GuidedAccessManager.swift: iOS Guided Access integration - TamperDetectionManager.swift: Motion-based tamper detection Audio: - AmbientAudioDetector.swift: Ambient sound level monitoring for wake triggers - AudioManager.swift: Audio playback and TTS support Features: - Battery level monitoring with critical level alerts - Automatic crash recovery to restore kiosk state - Guided Access API integration for enterprise deployments - Motion-based tamper detection (device moved while in kiosk) - Ambient audio detection for sound-triggered wake - Text-to-speech announcements via notification commands
Part 6 of Kiosk Mode implementation. Depends on PRs home-assistant#4197-home-assistant#4201. Files added: - KioskCommandHandlers.swift (~500 lines): Handlers for all kiosk notification commands Supported commands (14 total): - command_screen_on: Wake screen - command_screen_off: Start screensaver - command_brightness: Set screen brightness - command_screensaver: Control screensaver mode - command_navigate: Navigate to URL/path - command_refresh: Reload current page - command_kiosk_mode: Enable/disable kiosk mode - command_volume: Set device volume - command_tts: Text-to-speech announcement - command_play_audio: Play audio file - command_launch_app: Launch third-party app - command_return: Return to HA app - command_show_camera: Show camera popup - command_dismiss_camera: Dismiss camera popup
Part 7 of Kiosk Mode implementation. Final PR. Depends on PRs home-assistant#4197-home-assistant#4202. Camera files added: - CameraMotionDetector.swift: Frame-by-frame motion detection - CameraOverlayView.swift: Camera popup UI with actions - CameraStreamViewController.swift: HLS stream player - PresenceDetector.swift: Vision framework person detection Settings UI files added: - KioskSettingsView.swift: Main kiosk settings page - ScreensaverConfigView.swift: Screensaver mode configuration - DashboardConfigurationView.swift: Dashboard selection - EntityTriggersView.swift: Wake trigger entity configuration - PhotoAlbumPickerView.swift: Album selection for photo screensaver AppLauncher files added: - QuickLaunchPanelView.swift: Quick launch panel UI Features: - Camera popup with doorbell integration - Action buttons (unlock door, dismiss, etc.) - Auto-dismiss after configurable timeout - Motion detection via frame differencing - Person/face detection via Vision framework - Complete kiosk settings UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This is the final PR (7/7) in the Kiosk Mode feature series, adding camera popup functionality and a comprehensive settings UI with ~4,500 lines of code. The PR integrates kiosk mode into the WebViewController, adds utility managers for feedback and animations, implements settings screens for dashboard/screensaver/entity configuration, provides security features (PIN/biometric auth, tamper detection, crash recovery), creates multiple screensaver views (clock, photos, custom URL), and builds overlay components for status display and gesture-based controls.
Key changes:
- WebViewController integration with kiosk mode manager and overlay controllers
- Settings UI with 9+ configuration screens for dashboards, screensaver, triggers, security
- Security managers for authentication, tamper detection, battery monitoring
- Screensaver system with multiple modes (clock, photos, custom URL, entity display)
- Overlay system for status display, secret exit gesture, quick actions, edge protection
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| WebViewController.swift | Changed properties to internal for kiosk integration; added kiosk-aware status bar/home indicator hiding |
| WebViewController+Kiosk.swift | Extension integrating kiosk managers with WebView through callbacks and observers |
| TouchFeedbackManager.swift | Manages haptic/sound feedback with system sound IDs and UIKit integration |
| IconMapper.swift | Maps Material Design Icons to SF Symbols for UI consistency |
| AnimationUtilities.swift | Pre-defined animations, transitions, and view modifiers |
| KioskSettingsView.swift | Main settings screen with 10+ sections and authentication flow |
| ScreensaverConfigView.swift | Screensaver configuration with mode-specific options |
| PhotoAlbumPickerView.swift | Photo library browser with permissions and album selection |
| EntityTriggersView.swift | Configuration UI for HA entity-based wake/sleep triggers |
| DashboardConfigurationView.swift | Dashboard selection and rotation configuration |
| TamperDetectionManager.swift | Motion/orientation monitoring for device security |
| SettingsManager.swift | Settings import/export with versioning |
| SecurityManager.swift | Biometric/PIN authentication and remote lock management |
| GuidedAccessManager.swift | iOS Guided Access integration for enhanced security |
| CrashRecoveryManager.swift | Crash detection and automatic recovery |
| BatteryManager.swift | Battery/thermal monitoring with health reporting |
| ScreensaverViewController.swift | Container managing multiple screensaver modes |
| PhotoScreensaverView.swift | Photo slideshow with transitions and clock overlay |
| PhotoManager.swift | Photo fetching from device/iCloud/HA Media |
| EntityStateProvider.swift | Real-time HA entity state subscription |
| CustomURLScreensaverView.swift | WebView-based screensaver for custom dashboards |
| ClockScreensaverView.swift | Multiple clock styles with entity display |
| StatusOverlayView.swift | Floating status bar with connection/battery/time |
| SecretExitGestureView.swift | Corner tap gesture for accessing settings when locked |
| QuickActionsView.swift | Slide-out panel for HA service calls |
| EdgeProtectionView.swift | Blocks accidental edge touches |
| KioskSettings.swift | Complete settings model (794 lines) with all configuration |
| KioskConstants.swift | Centralized constants for animations, timing, UI |
- Renamed isEnabled to isKioskModeEnabled for clarity - Removed exitPIN (using device-based authentication only) - Changed allowDevicePasscodeExit default to true - Updated all settings.isEnabled references in Security managers Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add setFrontendKioskMode() for HA 2026.1+ kiosk_mode/set WebSocket command - Replace NavigationStack with NavigationView (iOS 16 → iOS 13+) - Replace ContentUnavailableView with custom VStack (iOS 17 → iOS 15+) - Fix onChange() to use single-parameter version (iOS 17 → iOS 14+) - Fix onTapGesture to use basic version without location (iOS 17 → iOS 13+) - Add @available(iOS 17.0, *) to #Preview macros - Fix isEnabled → isKioskModeEnabled in CrashRecoveryManager - Remove PIN-related code (device authentication only) - Simplify SecurityManager using device authentication Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
All review feedback has been addressed:
Ready for re-review. 🙏 |
The localPush subscription was using the default retryDuration of 10 seconds, causing the subscription to be removed (instead of retried) when the WebSocket disconnects more than 10 seconds after creation. Set retryDuration to nil for unlimited retries since this is a long-lived subscription that should persist for the entire app session. Fixes home-assistant#34
Issue home-assistant#35 fixes: 1. Secret exit gesture default changed from topLeft to topRight - Prevents conflict with hamburger menu for HA sidebar 2. Added native Dashboard Kiosk Mode (HA 2026.1+) - Sends kiosk_mode/set command to hide sidebar/header natively - No URL manipulation needed 3. Renamed existing kiosk URL setting for clarity - appendKioskParameter -> appendHACSKioskParameter - UI now shows "HACS Kiosk Mode URL" to distinguish from native Settings UI now has two separate toggles: - Dashboard Kiosk Mode: Uses HA 2026.1 native kiosk_mode/set command - HACS Kiosk Mode URL: Appends ?kiosk for HACS kiosk-mode integration
bgoncal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since a camera will be presented it is better to improve WebRTCPlayerView that already exists to become "CameraPlayerView" and handle all types of streams.
Or if you want to have a dedicated camera player for this view, at least you need to consider webrtc as well
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Summary
Part 7 of 7 - Camera popup and complete settings UI. Final PR in the series.
Files Added (~4,500 lines)
Camera:
CameraMotionDetector.swiftCameraOverlayView.swiftCameraStreamViewController.swiftPresenceDetector.swiftSettings UI:
KioskSettingsView.swiftScreensaverConfigView.swiftDashboardConfigurationView.swiftEntityTriggersView.swiftPhotoAlbumPickerView.swiftApp Launcher:
QuickLaunchPanelView.swiftCamera Popup Features
Settings UI
Test Plan
Complete PR Series
🤖 Generated with Claude Code