mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-25 07:32:12 -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 --> ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> <img width="996" height="1508" alt="CleanShot 2026-04-24 at 14 38 13@2x" src="https://github.com/user-attachments/assets/583c45c7-a4a6-4dda-92e9-bcee8fc04953" /> ## 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. -->
99 lines
2.6 KiB
Swift
99 lines
2.6 KiB
Swift
import Shared
|
|
|
|
enum WebViewEmptyStateStyle: Equatable {
|
|
case disconnected
|
|
case unauthenticated
|
|
case recoveredServerNeedingReauthentication
|
|
|
|
enum HeaderAccessory {
|
|
case none
|
|
case settings
|
|
case close
|
|
}
|
|
|
|
var title: String {
|
|
switch self {
|
|
case .disconnected:
|
|
L10n.WebView.EmptyState.title
|
|
case .unauthenticated:
|
|
L10n.Unauthenticated.Message.title
|
|
case .recoveredServerNeedingReauthentication:
|
|
L10n.Onboarding.ServerImport.Reauthenticate.title
|
|
}
|
|
}
|
|
|
|
var body: String {
|
|
switch self {
|
|
case .disconnected:
|
|
L10n.WebView.EmptyState.body
|
|
case .unauthenticated:
|
|
L10n.Unauthenticated.Message.body
|
|
case .recoveredServerNeedingReauthentication:
|
|
""
|
|
}
|
|
}
|
|
|
|
var primaryButtonTitle: String {
|
|
switch self {
|
|
case .disconnected:
|
|
L10n.WebView.EmptyState.retryButton
|
|
case .unauthenticated:
|
|
L10n.WebView.EmptyState.reauthenticateButton
|
|
case .recoveredServerNeedingReauthentication:
|
|
L10n.Onboarding.ServerImport.Reauthenticate.continueButton
|
|
}
|
|
}
|
|
|
|
var secondaryButtonTitle: String {
|
|
switch self {
|
|
case .disconnected, .unauthenticated, .recoveredServerNeedingReauthentication:
|
|
L10n.WebView.EmptyState.openSettingsButton
|
|
}
|
|
}
|
|
|
|
var leadingHeaderAccessory: HeaderAccessory {
|
|
switch self {
|
|
case .disconnected:
|
|
.none
|
|
case .unauthenticated:
|
|
.settings
|
|
case .recoveredServerNeedingReauthentication:
|
|
.none
|
|
}
|
|
}
|
|
|
|
var trailingHeaderAccessory: HeaderAccessory {
|
|
switch self {
|
|
case .disconnected, .unauthenticated:
|
|
.close
|
|
case .recoveredServerNeedingReauthentication:
|
|
.settings
|
|
}
|
|
}
|
|
|
|
var showsSecondarySettingsButton: Bool {
|
|
switch self {
|
|
case .disconnected:
|
|
true
|
|
case .unauthenticated, .recoveredServerNeedingReauthentication:
|
|
false
|
|
}
|
|
}
|
|
|
|
var showsServerPicker: Bool {
|
|
switch self {
|
|
case .disconnected, .unauthenticated, .recoveredServerNeedingReauthentication:
|
|
true
|
|
}
|
|
}
|
|
|
|
var urlPickerTitle: String {
|
|
switch self {
|
|
case .disconnected, .unauthenticated:
|
|
L10n.WebView.EmptyState.reauthenticateButton
|
|
case .recoveredServerNeedingReauthentication:
|
|
L10n.Onboarding.ServerImport.Reauthenticate.urlPickerTitle
|
|
}
|
|
}
|
|
}
|