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:
parent
9286ead348
commit
9351ceeb6a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue