Skip to content

Commit

Permalink
Make sure we do not automatically dismiss an user initiated account s…
Browse files Browse the repository at this point in the history
…heet presentation
  • Loading branch information
Supereg committed Nov 18, 2024
1 parent 0a0ea7b commit c6c5cd9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions TemplateApplication/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import SwiftUI


struct AccountSheet: View {
private let dismissAfterSignIn: Bool

@Environment(\.dismiss) var dismiss

@Environment(Account.self) private var account
Expand All @@ -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
}

Check warning on line 40 in TemplateApplication/Account/AccountSheet.swift

View check run for this annotation

Codecov / codecov/patch

TemplateApplication/Account/AccountSheet.swift#L38-L40

Added lines #L38 - L40 were not covered by tests
} header: {
AccountSetupHeader()
}
Expand All @@ -50,13 +54,17 @@ struct AccountSheet: View {
}
}

var closeButton: some ToolbarContent {
@ToolbarContentBuilder private var closeButton: some ToolbarContent {

Check warning on line 57 in TemplateApplication/Account/AccountSheet.swift

View check run for this annotation

Codecov / codecov/patch

TemplateApplication/Account/AccountSheet.swift#L57

Added line #L57 was not covered by tests
ToolbarItem(placement: .cancellationAction) {
Button("Close") {
dismiss()
}
}
}

init(dismissAfterSignIn: Bool = true) {
self.dismissAfterSignIn = dismissAfterSignIn
}
}


Expand Down
2 changes: 1 addition & 1 deletion TemplateApplication/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c6c5cd9

Please sign in to comment.