purple: polish UI/UX flow

Contributes to closing https://github.com/damus-io/damus/issues/1847.

- Fixes (1), the black bar at the top of the view is removed.
- Fixes (2), Scrolling down does not reveal an unappealing navigation bar
- Fixes (3), After the user presses 'continue', the user is taken back to
DamusPurpleView. If the user is shown a confirmation dialog, it waits
for user interaction, and after it dismisses DamusPurpleView to go back
to the home screen. If the user isn't shown the confirmation dialog, the
user is brought to the home screen straight away.
- May or may not fix (4)
- Fixes (5), the theme persists in light and dark mode

Lightning-url: LNURL1DP68GURN8GHJ7EM9W3SKCCNE9E3K7MF0D3H82UNVWQHKWUN9V4HXGCTHDC6RZVGR8SW3G
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
kernelkind
2024-01-22 11:50:40 -05:00
committed by William Casarin
parent f9bfa9dfa5
commit aa1f75ad58

View File

@@ -51,6 +51,7 @@ struct DamusPurpleView: View {
@State var show_welcome_sheet: Bool = false
@State var show_manage_subscriptions = false
@State var show_settings_change_confirmation_dialog = false
@State private var shouldDismissView = false
@Environment(\.dismiss) var dismiss
@@ -61,27 +62,25 @@ struct DamusPurpleView: View {
}
var body: some View {
ZStack {
Rectangle()
.background(.black)
ScrollView {
MainContent
.padding(.top, 75)
.background(content: {
ZStack {
Image("purple-blue-gradient-1")
.offset(CGSize(width: 300.0, height: -0.0))
Image("purple-blue-gradient-1")
.offset(CGSize(width: 300.0, height: -0.0))
}
})
NavigationView {
ZStack {
Color.black
.edgesIgnoringSafeArea(.all)
Image("purple-blue-gradient-1")
.resizable()
.edgesIgnoringSafeArea(.all)
ScrollView {
MainContent
.padding(.top, 75)
}
}
.navigationBarHidden(true)
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: BackNav())
}
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: BackNav())
.onReceive(handle_notify(.switched_timeline)) { _ in
dismiss()
}
@@ -97,6 +96,7 @@ struct DamusPurpleView: View {
.ignoresSafeArea(.all)
.sheet(isPresented: $show_welcome_sheet, onDismiss: {
update_user_settings_to_purple()
shouldDismissView = true
}, content: {
DamusPurpleWelcomeView()
})
@@ -110,6 +110,16 @@ struct DamusPurpleView: View {
}.keyboardShortcut(.defaultAction)
Button(NSLocalizedString("No", comment: "User confirm No"), role: .cancel) {}
}
.onChange(of: shouldDismissView) { shouldDismissView in
if shouldDismissView && !show_settings_change_confirmation_dialog {
dismiss()
}
}
.onChange(of: show_settings_change_confirmation_dialog) { show_settings_change_confirmation_dialog in
if shouldDismissView && !show_settings_change_confirmation_dialog {
dismiss()
}
}
.manageSubscriptionsSheet(isPresented: $show_manage_subscriptions)
}