Skip to content

Conversation

@nstefanelli
Copy link

@nstefanelli nstefanelli commented Jan 9, 2026

Summary

Part 2 of 7 - Core kiosk mode manager and system integration.

⚠️ Depends on: PR #4197 (Foundation) - Please review/merge PR #4197 first

Reviewers: To see only changes in this PR, compare against the kiosk-1-foundation branch:

git fetch https://github.com/nstefanelli/ha-kiosk.git kiosk-1-foundation kiosk-2-manager
git diff FETCH_HEAD~1..FETCH_HEAD

This PR adds the central kiosk mode coordinator and integration with existing Home Assistant iOS components.

Files Added (~3,300 lines)

File Lines Purpose
KioskModeManager.swift ~970 Central coordinator for kiosk mode state and functionality
SecurityManager.swift ~430 PIN/FaceID authentication, tamper detection
SettingsManager.swift ~330 Settings persistence and synchronization
DashboardManager.swift ~360 Dashboard fetching and navigation
CameraDetectionManager.swift ~320 Motion/presence detection via device cameras
AppLauncherManager.swift ~360 Quick launch panel for third-party apps
WebViewController+Kiosk.swift ~565 WebView integration for kiosk functionality

Key Features

  • KioskModeManager: Singleton coordinator managing kiosk mode activation, screen brightness, idle timeout, entity subscriptions, and battery monitoring

  • SecurityManager: PIN/FaceID authentication with tamper detection

  • DashboardManager: Fetches available dashboards from Home Assistant, handles navigation

  • CameraDetectionManager: Motion and person detection using Vision framework for screen wake triggers

Test Plan

  • Kiosk mode can be enabled/disabled from settings
  • Screen stays awake when kiosk mode is active
  • Screensaver activates after idle timeout
  • Touch interaction wakes from screensaver
  • PIN/FaceID required to exit kiosk mode
  • Dashboard picker shows available HA dashboards
  • Motion detection wakes screen when enabled

PR Series

# PR Status Description
1 #4197 🟡 Open Foundation (Settings Model & Utilities)
2 #4198 📍 This PR Core Manager & Integration
3 TBD 🔜 Screensaver Views
4 TBD 🔜 Navigation Lockdown (Edge Protection)
5 TBD 🔜 Security UI (PIN/Exit Views)
6 TBD 🔜 Notification Commands
7 TBD 🔜 Camera Popup & Settings UI

🤖 Generated with Claude Code

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
nstefanelli added a commit to nstefanelli/ha-kiosk that referenced this pull request Jan 9, 2026
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
nstefanelli added a commit to nstefanelli/ha-kiosk that referenced this pull request Jan 9, 2026
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
@bgoncal bgoncal requested a review from Copilot January 9, 2026 18:52
Copy link
Contributor

Copilot AI left a 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 PR implements the core kiosk mode manager and integrates it with the existing Home Assistant iOS application's WebView infrastructure. It provides centralized coordination of kiosk functionality including screen state management, brightness control, dashboard rotation, entity triggers, camera detection, and external app launching.

Changes:

  • Adds KioskModeManager as the central coordinator for all kiosk mode functionality
  • Integrates kiosk mode controls into WebViewController via extension
  • Implements supporting managers for security, settings, dashboards, camera detection, and app launching
  • Introduces comprehensive settings model with persistence and synchronization capabilities

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
WebViewController.swift Modified access levels for kiosk integration; added status bar/home indicator logic for kiosk mode
WebViewController+Kiosk.swift New extension integrating kiosk mode with WebViewController lifecycle and UI
KioskModeManager.swift Core manager coordinating all kiosk functionality and state
KioskSettings.swift Comprehensive settings model for kiosk configuration
SecurityManager.swift Biometric/PIN authentication and remote lock management
SettingsManager.swift Settings import/export and persistence handling
DashboardManager.swift Dashboard rotation and scheduling logic
CameraDetectionManager.swift Camera-based motion/presence detection coordinator
AppLauncherManager.swift External app launching with return timeout tracking
KioskConstants.swift Centralized constants for animations, timing, and UI dimensions
TouchFeedbackManager.swift Haptic and sound feedback for touch interactions
IconMapper.swift MDI to SF Symbol mapping utility
AnimationUtilities.swift Reusable animation definitions and view modifiers
HomeAssistant.xcodeproj/project.pbxproj Xcode project file updates for new source files
Comments suppressed due to low confidence (1)

Sources/App/Kiosk/AppLauncher/AppLauncherManager.swift:1

  • The code in WebViewController+Kiosk.swift line 409 references AudioManager.shared which is not defined in the provided diffs. Verify this class exists in the codebase or is provided by PR #4197 (Foundation).
import Combine

- Replace custom PIN with device authentication (Face ID/Touch ID/Passcode)
- Use LAPolicy.deviceOwnerAuthentication for flexible auth
- Replace PINEntryView with simpler AuthenticationView
- Rename isEnabled to isKioskModeEnabled for clarity
@nstefanelli
Copy link
Author

All review feedback has been addressed:

  • Renamed isEnabled to isKioskModeEnabled for clarity
  • Removed PIN-based authentication in favor of device-level authentication (Face ID/Touch ID/Device Passcode)
  • Fixed iOS 15+ compatibility (replaced NavigationStack, ContentUnavailableView, etc.)
  • Added kiosk_mode/set WebSocket command support for HA 2026.1+
  • All Copilot review threads resolved

Ready for re-review. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant