Browse Source

Show EULA prior to login

Closes #413
master
Terry Yiu 2 years ago
committed by William Casarin
parent
commit
387e1bcf22
  1. 15
      damus/Views/EULAView.swift
  2. 4
      damus/Views/SetupView.swift

15
damus/Views/EULAView.swift

@ -8,8 +8,9 @@
import SwiftUI import SwiftUI
struct EULAView: View { struct EULAView: View {
var state: SetupState?
@Environment(\.dismiss) var dismiss @Environment(\.dismiss) var dismiss
@State var creating_account = false @State var accepted = false
var body: some View { var body: some View {
ZStack { ZStack {
@ -69,11 +70,17 @@ By using our Application, you signify your acceptance of this EULA. If you do no
""")) """))
.padding() .padding()
NavigationLink(destination: CreateAccountView(), isActive: $creating_account) { if state == .create_account {
EmptyView() 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.")) { 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.")) { DamusWhiteButton(NSLocalizedString("Reject", comment: "Button to reject the end user license agreement, which disallows the user from being let into the app.")) {

4
damus/Views/SetupView.swift

@ -42,10 +42,10 @@ struct SetupView: View {
DamusGradient() DamusGradient()
VStack(alignment: .center) { VStack(alignment: .center) {
NavigationLink(destination: EULAView(), tag: .create_account, selection: $state ) { NavigationLink(destination: EULAView(state: state), tag: .create_account, selection: $state ) {
EmptyView() EmptyView()
} }
NavigationLink(destination: LoginView(), tag: .login, selection: $state ) { NavigationLink(destination: EULAView(state: state), tag: .login, selection: $state ) {
EmptyView() EmptyView()
} }

Loading…
Cancel
Save