This commit is contained in:
Justin Mazzocchi 2020-09-12 00:36:59 -07:00
parent ceff3fd4c9
commit 9c77f55ec9
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
4 changed files with 11 additions and 12 deletions

View file

@ -111,8 +111,4 @@ private extension AddIdentityViewModel {
} receiveValue: { _ in } } receiveValue: { _ in }
.store(in: &cancellables) .store(in: &cancellables)
} }
func checkIfPublicTimelineAvailable(url: URL) -> AnyPublisher<Bool, Never> {
Just(false).eraseToAnyPublisher()
}
} }

View file

@ -6,13 +6,16 @@ import ViewModels
struct AddIdentityView: View { struct AddIdentityView: View {
@StateObject var viewModel: AddIdentityViewModel @StateObject var viewModel: AddIdentityViewModel
@Environment(\.accessibilityReduceMotion) var accessibilityReduceMotion
@EnvironmentObject var rootViewModel: RootViewModel @EnvironmentObject var rootViewModel: RootViewModel
@State private var navigateToRegister = false @State private var navigateToRegister = false
var body: some View { var body: some View {
Form { Form {
Section { Section {
TextField("add-identity.instance-url", text: $viewModel.urlFieldText) TextField("add-identity.instance-url", text: $viewModel.urlFieldText)
.textContentType(.URL)
.autocapitalization(.none) .autocapitalization(.none)
.disableAutocorrection(true) .disableAutocorrection(true)
.keyboardType(.URL) .keyboardType(.URL)
@ -69,7 +72,7 @@ struct AddIdentityView: View {
.frame(maxWidth: .infinity, alignment: .center) .frame(maxWidth: .infinity, alignment: .center)
} }
} }
.animation(.default, if: !viewModel.loading) .animation(.default, if: !accessibilityReduceMotion)
.alertItem($viewModel.alertItem) .alertItem($viewModel.alertItem)
.onReceive(viewModel.addedIdentityID) { id in .onReceive(viewModel.addedIdentityID) { id in
withAnimation { withAnimation {

View file

@ -12,16 +12,19 @@ struct RegistrationView: View {
Form { Form {
HStack { HStack {
TextField("registration.username", text: $viewModel.registration.username) TextField("registration.username", text: $viewModel.registration.username)
.textContentType(.username)
.autocapitalization(.none) .autocapitalization(.none)
.disableAutocorrection(true) .disableAutocorrection(true)
Text("@" + viewModel.instance.uri) Text("@".appending(viewModel.instance.uri))
.foregroundColor(.secondary) .foregroundColor(.secondary)
} }
TextField("registration.email", text: $viewModel.registration.email) TextField("registration.email", text: $viewModel.registration.email)
.textContentType(.emailAddress)
.autocapitalization(.none) .autocapitalization(.none)
.disableAutocorrection(true) .disableAutocorrection(true)
.keyboardType(.emailAddress) .keyboardType(.emailAddress)
SecureField("registration.password", text: $viewModel.registration.password) SecureField("registration.password", text: $viewModel.registration.password)
.textContentType(.password)
SecureField("registration.password-confirmation", text: $viewModel.passwordConfirmation) SecureField("registration.password-confirmation", text: $viewModel.passwordConfirmation)
if viewModel.instance.approvalRequired { if viewModel.instance.approvalRequired {
VStack(alignment: .leading) { VStack(alignment: .leading) {
@ -29,12 +32,8 @@ struct RegistrationView: View {
TextEditor(text: $viewModel.registration.reason) TextEditor(text: $viewModel.registration.reason)
} }
} }
Button("registration.server-rules") { Button("registration.server-rules") { presentURL = viewModel.serverRulesURL }
presentURL = viewModel.serverRulesURL Button("registration.terms-of-service") { presentURL = viewModel.termsOfServiceURL }
}
Button("registration.terms-of-service") {
presentURL = viewModel.termsOfServiceURL
}
Toggle("registration.agree-to-server-rules-and-terms-of-service", Toggle("registration.agree-to-server-rules-and-terms-of-service",
isOn: $viewModel.registration.agreement) isOn: $viewModel.registration.agreement)
Group { Group {

View file

@ -19,6 +19,7 @@ struct RootView: View {
.navigationBarHidden(true) .navigationBarHidden(true)
} }
.environmentObject(viewModel) .environmentObject(viewModel)
.navigationViewStyle(StackNavigationViewStyle())
.transition(.opacity) .transition(.opacity)
} }
} }