TV not presenting interactive login on "Connect" (#817)

The side panel was not shown when interactive login was triggered by the
active profile on "Connect".
This commit is contained in:
Davide 2024-11-05 16:13:03 +01:00 committed by GitHub
parent 9286ead348
commit 9351ceeb6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 7 deletions

View File

@ -50,7 +50,7 @@ struct ProfileView: View, TunnelInstallationProviding {
var tunnel: ExtendedTunnel
@State
private var isSwitching = false
private var showsSidePanel = false
@FocusState
private var focusedField: Field?
@ -73,7 +73,7 @@ struct ProfileView: View, TunnelInstallationProviding {
.frame(maxWidth: .infinity)
.disabled(interactiveManager.isPresented)
if isSwitching {
if showsSidePanel {
ZStack {
listView
.padding(.horizontal)
@ -91,12 +91,12 @@ struct ProfileView: View, TunnelInstallationProviding {
}
.ignoresSafeArea(edges: .horizontal)
.background(theme.primaryColor.gradient)
.themeAnimation(on: isSwitching, category: .profiles)
.themeAnimation(on: showsSidePanel, category: .profiles)
.withErrorHandler(errorHandler)
.defaultFocus($focusedField, .switchProfile)
.onChange(of: tunnel.status) { _, new in
if new == .activating {
isSwitching = false
showsSidePanel = false
focusedField = .connect
}
}
@ -105,13 +105,18 @@ struct ProfileView: View, TunnelInstallationProviding {
focusedField = .switchProfile
}
}
.onChange(of: interactiveManager.isPresented) { _, new in
if new {
showsSidePanel = true
}
}
.onChange(of: focusedField) { _, new in
switch new {
case .connect:
isSwitching = false
showsSidePanel = false
case .switchProfile:
isSwitching = true
showsSidePanel = true
default:
break
@ -132,7 +137,7 @@ private extension ProfileView {
ActiveProfileView(
profile: currentProfile,
tunnel: tunnel,
isSwitching: $isSwitching,
isSwitching: $showsSidePanel,
focusedField: $focusedField,
interactiveManager: interactiveManager,
errorHandler: errorHandler