diff --git a/damus/Views/CreateAccountView.swift b/damus/Views/CreateAccountView.swift index 147cb441..032c2d6d 100644 --- a/damus/Views/CreateAccountView.swift +++ b/damus/Views/CreateAccountView.swift @@ -26,6 +26,9 @@ struct CreateAccountView: View { var body: some View { ZStack(alignment: .top) { DamusGradient() + NavigationLink(destination: SaveKeysView(account: account), isActive: $is_done) { + EmptyView() + } VStack { Text("Create Account") @@ -73,8 +76,6 @@ struct CreateAccountView: View { } } - NavigationLink(destination: SaveKeysView(account: account), isActive: $is_done) { - EmptyView() } DamusWhiteButton(NSLocalizedString("Create", comment: "Button to create account.")) { diff --git a/damus/Views/EULAView.swift b/damus/Views/EULAView.swift index 2360c138..90fa978c 100644 --- a/damus/Views/EULAView.swift +++ b/damus/Views/EULAView.swift @@ -8,7 +8,6 @@ import SwiftUI struct EULAView: View { - var state: SetupState? @Environment(\.dismiss) var dismiss @State var accepted = false @@ -69,14 +68,12 @@ By using our Application, you signify your acceptance of this EULA. If you do no """)) .padding() + @State private var login = false + NavigationLink(destination: LoginView(accepted: $accepted), isActive: $login) { + 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.")) { diff --git a/damus/Views/LoginView.swift b/damus/Views/LoginView.swift index 4f2c7217..04ac0c10 100644 --- a/damus/Views/LoginView.swift +++ b/damus/Views/LoginView.swift @@ -33,10 +33,13 @@ enum ParsedKey { } struct LoginView: View { + @State private var create_account = false @State var key: String = "" @State var is_pubkey: Bool = false @State var error: String? = nil @State private var credential_handler = CredentialHandler() + + @Binding var accepted: Bool func get_error(parsed_key: ParsedKey?) -> String? { if self.error != nil { @@ -53,6 +56,12 @@ struct LoginView: View { var body: some View { ZStack(alignment: .top) { DamusGradient() + if accepted { + NavigationLink(destination: CreateAccountView(), isActive: $create_account) { + EmptyView() + } + } + VStack { Text("Login", comment: "Title of view to log into an account.") .foregroundColor(.white) diff --git a/damus/Views/SetupView.swift b/damus/Views/SetupView.swift index 8fdab68b..063c5d60 100644 --- a/damus/Views/SetupView.swift +++ b/damus/Views/SetupView.swift @@ -15,15 +15,9 @@ func hex_col(r: UInt8, g: UInt8, b: UInt8) -> Color { opacity: 1.0) } -enum SetupState { - case home - case create_account - case login -} - struct SetupView: View { - @State var state: SetupState? = .home + @State private var eula = false var body: some View { NavigationView { @@ -31,10 +25,7 @@ struct SetupView: View { DamusGradient() VStack(alignment: .center) { - NavigationLink(destination: EULAView(state: state), tag: .create_account, selection: $state ) { - EmptyView() - } - NavigationLink(destination: EULAView(state: state), tag: .login, selection: $state ) { + NavigationLink(destination: EULAView(), isActive: $eula) { EmptyView() } @@ -79,7 +70,6 @@ func DamusWhiteButton(_ title: String, action: @escaping () -> ()) -> some View .background(Color.white.opacity(0.15)) ) } - } struct SetupView_Previews: PreviewProvider {