damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit aa1f75ad581a355786756935d1d56cd5bf118742
parent f9bfa9dfa54f8e36bf8bbdbe1cc732d74fca3179
Author: kernelkind <kernelkind@gmail.com>
Date:   Mon, 22 Jan 2024 11:50:40 -0500

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>

Diffstat:
Mdamus/Views/Purple/DamusPurpleView.swift | 48+++++++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/damus/Views/Purple/DamusPurpleView.swift b/damus/Views/Purple/DamusPurpleView.swift @@ -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) }