mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-24 20:17:30 -05:00
<!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> This PR is a massive refactor of how the app handles UI presentation and navigation, goin from the UIKit based apps style to SwiftUI. ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. --> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
1.1 KiB
Swift
27 lines
1.1 KiB
Swift
import Shared
|
|
import SwiftUI
|
|
import UIKit
|
|
|
|
/// A swappable SwiftUI host for the web frontend. `ContainerView` renders one of these for the active
|
|
/// server and receives its backing `WebViewController` via `onWebViewController`; swap the concrete type and
|
|
/// the app coordinator (`ContainerView`) keeps working.
|
|
protocol WebFrontendView: View {
|
|
init(server: Server, onWebViewController: @escaping (WebViewController) -> Void)
|
|
}
|
|
|
|
/// The running web frontend the app coordinator drives. Abstracts `WebViewController` so the coordinator
|
|
/// (`AppContainerCoordinator`) never references it directly. `WebViewController` conforms below.
|
|
protocol WebFrontend: AnyObject {
|
|
var server: Server { get }
|
|
var presentationWindow: UIWindow? { get }
|
|
func show(alert: ServerAlert)
|
|
func open(inline url: URL, avoidUnnecessaryReload: Bool)
|
|
func openPanel(_ url: URL)
|
|
func dismissOverlayController(animated: Bool, completion: (() -> Void)?)
|
|
func presentOverlayController(controller: UIViewController, animated: Bool)
|
|
}
|
|
|
|
extension WebViewController: WebFrontend {
|
|
var presentationWindow: UIWindow? { viewIfLoaded?.window }
|
|
}
|