From 9c77f55ec941af207c0f9874767589f222736bd2 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Sat, 12 Sep 2020 00:36:59 -0700 Subject: [PATCH] Cleanup --- .../Sources/ViewModels/AddIdentityViewModel.swift | 4 ---- Views/AddIdentityView.swift | 5 ++++- Views/RegistrationView.swift | 13 ++++++------- Views/RootView.swift | 1 + 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ViewModels/Sources/ViewModels/AddIdentityViewModel.swift b/ViewModels/Sources/ViewModels/AddIdentityViewModel.swift index d80723d..7c220ed 100644 --- a/ViewModels/Sources/ViewModels/AddIdentityViewModel.swift +++ b/ViewModels/Sources/ViewModels/AddIdentityViewModel.swift @@ -111,8 +111,4 @@ private extension AddIdentityViewModel { } receiveValue: { _ in } .store(in: &cancellables) } - - func checkIfPublicTimelineAvailable(url: URL) -> AnyPublisher { - Just(false).eraseToAnyPublisher() - } } diff --git a/Views/AddIdentityView.swift b/Views/AddIdentityView.swift index a1492a9..1ba9352 100644 --- a/Views/AddIdentityView.swift +++ b/Views/AddIdentityView.swift @@ -6,13 +6,16 @@ import ViewModels struct AddIdentityView: View { @StateObject var viewModel: AddIdentityViewModel + @Environment(\.accessibilityReduceMotion) var accessibilityReduceMotion @EnvironmentObject var rootViewModel: RootViewModel + @State private var navigateToRegister = false var body: some View { Form { Section { TextField("add-identity.instance-url", text: $viewModel.urlFieldText) + .textContentType(.URL) .autocapitalization(.none) .disableAutocorrection(true) .keyboardType(.URL) @@ -69,7 +72,7 @@ struct AddIdentityView: View { .frame(maxWidth: .infinity, alignment: .center) } } - .animation(.default, if: !viewModel.loading) + .animation(.default, if: !accessibilityReduceMotion) .alertItem($viewModel.alertItem) .onReceive(viewModel.addedIdentityID) { id in withAnimation { diff --git a/Views/RegistrationView.swift b/Views/RegistrationView.swift index adbfe9c..cbf3791 100644 --- a/Views/RegistrationView.swift +++ b/Views/RegistrationView.swift @@ -12,16 +12,19 @@ struct RegistrationView: View { Form { HStack { TextField("registration.username", text: $viewModel.registration.username) + .textContentType(.username) .autocapitalization(.none) .disableAutocorrection(true) - Text("@" + viewModel.instance.uri) + Text("@".appending(viewModel.instance.uri)) .foregroundColor(.secondary) } TextField("registration.email", text: $viewModel.registration.email) + .textContentType(.emailAddress) .autocapitalization(.none) .disableAutocorrection(true) .keyboardType(.emailAddress) SecureField("registration.password", text: $viewModel.registration.password) + .textContentType(.password) SecureField("registration.password-confirmation", text: $viewModel.passwordConfirmation) if viewModel.instance.approvalRequired { VStack(alignment: .leading) { @@ -29,12 +32,8 @@ struct RegistrationView: View { TextEditor(text: $viewModel.registration.reason) } } - Button("registration.server-rules") { - presentURL = viewModel.serverRulesURL - } - Button("registration.terms-of-service") { - presentURL = viewModel.termsOfServiceURL - } + Button("registration.server-rules") { presentURL = viewModel.serverRulesURL } + Button("registration.terms-of-service") { presentURL = viewModel.termsOfServiceURL } Toggle("registration.agree-to-server-rules-and-terms-of-service", isOn: $viewModel.registration.agreement) Group { diff --git a/Views/RootView.swift b/Views/RootView.swift index f293c98..381e3ca 100644 --- a/Views/RootView.swift +++ b/Views/RootView.swift @@ -19,6 +19,7 @@ struct RootView: View { .navigationBarHidden(true) } .environmentObject(viewModel) + .navigationViewStyle(StackNavigationViewStyle()) .transition(.opacity) } }