set username as available when validation api returns void

This commit is contained in:
Satindar Dhillon 2022-07-13 09:16:16 -07:00
parent d69a43d00f
commit e6e954c7ad
2 changed files with 7 additions and 3 deletions

View file

@ -56,6 +56,7 @@ import Views
Task {
do {
try await dataService.validateUsernamePublisher(username: username)
potentialUsernameStatus = .available
} catch {
let usernameError = (error as? UsernameAvailabilityError) ?? .unknown
switch usernameError {
@ -152,6 +153,9 @@ struct CreateProfileView: View {
.font(.appFootnote)
.foregroundColor(.appGrayText)
TextField("", text: $viewModel.potentialUsername)
#if os(iOS)
.textInputAutocapitalization(.never)
#endif
}
if viewModel.potentialUsernameStatus == .available {

View file

@ -132,7 +132,7 @@ struct WelcomeView: View {
}
var authProviderButtonStack: some View {
let useHorizontalLayout = containerSize.width > 400
let useHorizontalLayout = containerSize.width > 500
let buttonGroup = Group {
AppleSignInButton {
@ -166,7 +166,7 @@ struct WelcomeView: View {
}
public var body: some View {
ZStack(alignment: .leading) {
ZStack(alignment: viewModel.registrationState == nil ? .leading : .center) {
Color.appBackground
.edgesIgnoringSafeArea(.all)
.modifier(SizeModifier())
@ -189,7 +189,7 @@ struct WelcomeView: View {
logoView
.padding(.bottom, 20)
headlineView
if containerSize.width > 400 {
if containerSize.width > 500 {
authProviderButtonStack
} else {
HStack {