mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Cleanup
This commit is contained in:
parent
ceff3fd4c9
commit
9c77f55ec9
4 changed files with 11 additions and 12 deletions
|
@ -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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -19,6 +19,7 @@ struct RootView: View {
|
||||||
.navigationBarHidden(true)
|
.navigationBarHidden(true)
|
||||||
}
|
}
|
||||||
.environmentObject(viewModel)
|
.environmentObject(viewModel)
|
||||||
|
.navigationViewStyle(StackNavigationViewStyle())
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue