Skip to content

Commit

Permalink
Subscriptions: 24. Properly dismiss view on selecting feature (#2640)
Browse files Browse the repository at this point in the history
  • Loading branch information
afterxleep authored Mar 26, 2024
1 parent 5b81a5d commit 5158917
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ final class SubscriptionEmailViewModel: ObservableObject {
self.selectedFeature = .dbp
}
self.state.shouldDismissStack = true

// Reset shouldDismissStack after dismissal to ensure it can be triggered again
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.state.shouldDismissStack = false
}
}

}
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/Subscription/Views/SubscriptionEmailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ struct SubscriptionEmailView: View {
shouldDisplayNavigationError = value
}

.onChange(of: viewModel.state.shouldDismissStack) { _ in
onDismissStack?()
}

// Observe changes to shouldDismissView
.onChange(of: viewModel.state.shouldDismissView) { shouldDismiss in
if shouldDismiss {
Expand Down

0 comments on commit 5158917

Please sign in to comment.