mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-17 08:05:44 -05:00
Avoid displaying connection security level config when not needed (#4405)
<!-- 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 --> Hide connection security level config when user has no internal URL set or has one that is already HTTPS ## 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. -->
This commit is contained in:
committed by
GitHub
parent
457bbb299e
commit
7086128e78
@@ -325,16 +325,18 @@ struct ConnectionSettingsView: View {
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
Button {
|
||||
showSecurityLevelPicker = true
|
||||
} label: {
|
||||
NavigationRow(
|
||||
title: L10n.Settings.ConnectionSection.ConnectionAccessSecurityLevel.title,
|
||||
value: viewModel.securityLevel.description
|
||||
)
|
||||
.contentShape(Rectangle())
|
||||
if viewModel.shouldShowSecurityLevelPicker {
|
||||
Button {
|
||||
showSecurityLevelPicker = true
|
||||
} label: {
|
||||
NavigationRow(
|
||||
title: L10n.Settings.ConnectionSection.ConnectionAccessSecurityLevel.title,
|
||||
value: viewModel.securityLevel.description
|
||||
)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
Button {
|
||||
viewModel.updateAppDatabase()
|
||||
|
||||
@@ -50,6 +50,14 @@ final class ConnectionSettingsViewModel: ObservableObject {
|
||||
server.info.version <= .updateLocationGPSOptional
|
||||
}
|
||||
|
||||
var shouldShowSecurityLevelPicker: Bool {
|
||||
guard let internalURL = server.info.connection.address(for: .internal) else {
|
||||
return false
|
||||
}
|
||||
|
||||
return internalURL.scheme?.lowercased() == "http"
|
||||
}
|
||||
|
||||
// MARK: - Initialization
|
||||
|
||||
init(server: Server) {
|
||||
|
||||
Reference in New Issue
Block a user