damus

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

commit 387e1bcf2265ab9aecf8482f9fddca98b6f17f85
parent 4da002e1b4b549c55444091efcc308019ba92adf
Author: Terry Yiu <963907+tyiu@users.noreply.github.com>
Date:   Fri, 27 Jan 2023 00:12:31 -0500

Show EULA prior to login

Closes #413

Diffstat:
Mdamus/Views/EULAView.swift | 15+++++++++++----
Mdamus/Views/SetupView.swift | 4++--
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/damus/Views/EULAView.swift b/damus/Views/EULAView.swift @@ -8,8 +8,9 @@ import SwiftUI struct EULAView: View { + var state: SetupState? @Environment(\.dismiss) var dismiss - @State var creating_account = false + @State var accepted = false var body: some View { ZStack { @@ -69,11 +70,17 @@ By using our Application, you signify your acceptance of this EULA. If you do no """)) .padding() - NavigationLink(destination: CreateAccountView(), isActive: $creating_account) { - EmptyView() + if state == .create_account { + NavigationLink(destination: CreateAccountView(), isActive: $accepted) { + EmptyView() + } + } else { + NavigationLink(destination: LoginView(), isActive: $accepted) { + EmptyView() + } } DamusWhiteButton(NSLocalizedString("Accept", comment: "Button to accept the end user license agreement before being allowed into the app.")) { - creating_account = true + accepted = true } DamusWhiteButton(NSLocalizedString("Reject", comment: "Button to reject the end user license agreement, which disallows the user from being let into the app.")) { diff --git a/damus/Views/SetupView.swift b/damus/Views/SetupView.swift @@ -42,10 +42,10 @@ struct SetupView: View { DamusGradient() VStack(alignment: .center) { - NavigationLink(destination: EULAView(), tag: .create_account, selection: $state ) { + NavigationLink(destination: EULAView(state: state), tag: .create_account, selection: $state ) { EmptyView() } - NavigationLink(destination: LoginView(), tag: .login, selection: $state ) { + NavigationLink(destination: EULAView(state: state), tag: .login, selection: $state ) { EmptyView() }