diff --git a/TemplateApplication/Account/AccountSheet.swift b/TemplateApplication/Account/AccountSheet.swift index dff45305..bdb0f8c5 100644 --- a/TemplateApplication/Account/AccountSheet.swift +++ b/TemplateApplication/Account/AccountSheet.swift @@ -12,6 +12,8 @@ import SwiftUI struct AccountSheet: View { + private let dismissAfterSignIn: Bool + @Environment(\.dismiss) var dismiss @Environment(Account.self) private var account @@ -33,7 +35,9 @@ struct AccountSheet: View { } } else { AccountSetup { _ in - dismiss() // we just signed in, dismiss the account setup sheet + if dismissAfterSignIn { + dismiss() // we just signed in, dismiss the account setup sheet + } } header: { AccountSetupHeader() } @@ -50,13 +54,17 @@ struct AccountSheet: View { } } - var closeButton: some ToolbarContent { + @ToolbarContentBuilder private var closeButton: some ToolbarContent { ToolbarItem(placement: .cancellationAction) { Button("Close") { dismiss() } } } + + init(dismissAfterSignIn: Bool = true) { + self.dismissAfterSignIn = dismissAfterSignIn + } } diff --git a/TemplateApplication/HomeView.swift b/TemplateApplication/HomeView.swift index 4e9df443..adc5f7d3 100644 --- a/TemplateApplication/HomeView.swift +++ b/TemplateApplication/HomeView.swift @@ -37,7 +37,7 @@ struct HomeView: View { .tabViewStyle(.sidebarAdaptable) .tabViewCustomization($tabViewCustomization) .sheet(isPresented: $presentingAccount) { - AccountSheet() + AccountSheet(dismissAfterSignIn: false) // presentation was user initiated, do not automatically dismiss } .accountRequired(!FeatureFlags.disableFirebase && !FeatureFlags.skipOnboarding) { AccountSheet()