mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-18 21:51:51 -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
997 B
Swift
27 lines
997 B
Swift
import Shared
|
|
import SwiftUI
|
|
|
|
// SwiftUI `@Environment` access to the app-level `SceneManager` / `NotificationManager`. Additive: both
|
|
// default to the `Current.*` instances owned by the `AppDelegate`, so they resolve without explicit
|
|
// injection and can be overridden in tests/previews via `.environment(\.sceneManager, …)`.
|
|
|
|
private struct SceneManagerEnvironmentKey: EnvironmentKey {
|
|
static var defaultValue: SceneManager { Current.sceneManager }
|
|
}
|
|
|
|
private struct NotificationManagerEnvironmentKey: EnvironmentKey {
|
|
static var defaultValue: NotificationManager { Current.notificationManager }
|
|
}
|
|
|
|
extension EnvironmentValues {
|
|
var sceneManager: SceneManager {
|
|
get { self[SceneManagerEnvironmentKey.self] }
|
|
set { self[SceneManagerEnvironmentKey.self] = newValue }
|
|
}
|
|
|
|
var notificationManager: NotificationManager {
|
|
get { self[NotificationManagerEnvironmentKey.self] }
|
|
set { self[NotificationManagerEnvironmentKey.self] = newValue }
|
|
}
|
|
}
|