only show signed in view if authenticated

This commit is contained in:
Andrew Erickson 2021-05-01 08:20:54 -06:00
parent 357121bad5
commit 499d33f8e0
2 changed files with 2 additions and 7 deletions

View file

@ -120,7 +120,7 @@ struct MainWindow: View {
@ViewBuilder
private func signInView() -> some View {
if appState.hasSavedUsername {
if appState.authenticationState == .authenticated {
VStack {
SignedInView()
.padding(32)

View file

@ -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 })