Files
iOS/Sources/App/Frontend/WebView/WebFrontendOverlayState.swift
Bruno Pantaleão Gonçalves 6e84ff4cb6 Migrate app from UIKit based app to SwiftUI (#4748)
<!-- 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>
2026-06-16 10:33:17 +02:00

35 lines
1.6 KiB
Swift

import Combine
import Shared
import UIKit
/// Observable state the `WebViewController` publishes to its SwiftUI host (`HomeAssistantView`) so blocking
/// screens can be layered over the web view in SwiftUI (a `ZStack`) instead of presented as UIKit
/// modals/subviews letting app-level sheets (e.g. Settings) float over them without tearing them down.
@MainActor
final class WebFrontendOverlayState: ObservableObject {
/// True when the active server has no usable URL; drives the no-active-URL overlay.
@Published var showsNoActiveURL = false
/// Non-nil while the disconnected/unauthenticated empty state should be shown.
@Published var emptyState: EmptyStateContent?
/// Theme color for the top status-bar inset, drawn by `HomeAssistantView` over the (always edge-to-edge)
/// web view. Nil when there should be no themed bar i.e. edge-to-edge / full-screen is enabled, or on
/// Catalyst (where the native status-bar view handles it).
@Published var statusBarColor: UIColor?
/// Data + actions to render `WebViewEmptyStateView` as a SwiftUI overlay. Built by `WebViewController`,
/// which owns the connection state and the actions (retry / settings / error details / re-auth).
struct EmptyStateContent {
let style: WebViewEmptyStateStyle
let server: Server
let showsErrorDetailsButton: Bool
let availableReauthURLTypes: [ConnectionInfo.URLType]
let retryAction: () -> Void
let settingsAction: () -> Void
let errorDetailsAction: () -> Void
let reauthAction: (ConnectionInfo.URLType) -> Void
let dismissAction: () -> Void
}
}