From 499d33f8e01e09e9ab984162106976b8e158016e Mon Sep 17 00:00:00 2001 From: Andrew Erickson Date: Sat, 1 May 2021 08:20:54 -0600 Subject: [PATCH] only show signed in view if authenticated --- Xcodes/Frontend/MainWindow.swift | 2 +- Xcodes/Frontend/Preferences/GeneralPreferencePane.swift | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Xcodes/Frontend/MainWindow.swift b/Xcodes/Frontend/MainWindow.swift index 1089ecf..4c5aa69 100644 --- a/Xcodes/Frontend/MainWindow.swift +++ b/Xcodes/Frontend/MainWindow.swift @@ -120,7 +120,7 @@ struct MainWindow: View { @ViewBuilder private func signInView() -> some View { - if appState.hasSavedUsername { + if appState.authenticationState == .authenticated { VStack { SignedInView() .padding(32) diff --git a/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift b/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift index 19af99a..2a9843a 100644 --- a/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift +++ b/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift @@ -7,12 +7,7 @@ struct GeneralPreferencePane: View { var body: some View { VStack(alignment: .leading) { GroupBox(label: Text("Apple ID")) { - // If we have saved a username then we will show it here, - // even if we don't have a valid session right now, - // because we should be able to get a valid session if needed with the password in the keychain - // and a 2FA code from the user. - // Note that AppState.authenticationState is not necessarily .authenticated in this case, though. - if appState.hasSavedUsername { + if appState.authenticationState == .authenticated { SignedInView() } else { Button("Sign In", action: { self.appState.presentedSheet = .signIn })