diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..9ad730c Binary files /dev/null and b/.DS_Store differ diff --git a/Rethread/.DS_Store b/Rethread/.DS_Store index 37d4cf5..1d225a1 100644 Binary files a/Rethread/.DS_Store and b/Rethread/.DS_Store differ diff --git a/Rethread/Rethread.xcodeproj/project.pbxproj b/Rethread/Rethread.xcodeproj/project.pbxproj index 0028275..d82a2ab 100644 --- a/Rethread/Rethread.xcodeproj/project.pbxproj +++ b/Rethread/Rethread.xcodeproj/project.pbxproj @@ -144,20 +144,20 @@ path = Models; sourceTree = ""; }; - 7C9AA2D12B0EC3BC00EF6F36 /* Extensions */ = { + 7C9AA2D42B0ECADF00EF6F36 /* Styles */ = { isa = PBXGroup; children = ( + 9868A7DD2B1FAE780063D9BA /* ButtonStyles.swift */, + 98A1838B2B38D32A001E324A /* ColorPalette.swift */, ); - path = Extensions; + path = Styles; sourceTree = ""; }; - 7C9AA2D42B0ECADF00EF6F36 /* Styles */ = { + 980DACBB2B71E7110008B88A /* Extensions */ = { isa = PBXGroup; children = ( - 9868A7DD2B1FAE780063D9BA /* ButtonStyles.swift */, - 98A1838B2B38D32A001E324A /* ColorPalette.swift */, ); - path = Styles; + path = Extensions; sourceTree = ""; }; 983286A82B05698E00851B19 = { @@ -186,8 +186,8 @@ isa = PBXGroup; children = ( 983D40FA2B68D13E00905D4E /* Info.plist */, - 7C9AA2D12B0EC3BC00EF6F36 /* Extensions */, 7C9AA2D42B0ECADF00EF6F36 /* Styles */, + 980DACBB2B71E7110008B88A /* Extensions */, 9897C7712B3E6BF600EDE9D9 /* Components */, 98F525CC2B46A8E900CCAD78 /* VideoPlayer */, 7C9AA2CC2B0EC02600EF6F36 /* Models */, @@ -639,7 +639,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = techstart.Rethread; + PRODUCT_BUNDLE_IDENTIFIER = techstart.Rethread2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -673,7 +673,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = techstart.Rethread; + PRODUCT_BUNDLE_IDENTIFIER = techstart.Rethread2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; diff --git a/Rethread/Rethread/Views/MainView.swift b/Rethread/Rethread/Views/MainView.swift index 55e8568..b216d93 100644 --- a/Rethread/Rethread/Views/MainView.swift +++ b/Rethread/Rethread/Views/MainView.swift @@ -96,9 +96,12 @@ struct MainView: View { struct CustomTextField: View { var placeholder: String @Binding var text: String + var disableAutocorrection: Bool = false var body: some View { TextField(placeholder, text: $text) + .disableAutocorrection(disableAutocorrection) + .autocapitalization(disableAutocorrection ? .none : .sentences) .foregroundColor(Color.primaryTextColor) .padding() .overlay(RoundedRectangle(cornerRadius: 8).stroke(Color.gray, lineWidth: 1)) diff --git a/Rethread/Rethread/Views/SignUpView.swift b/Rethread/Rethread/Views/SignUpView.swift index 2edccbd..7b0dc6f 100644 --- a/Rethread/Rethread/Views/SignUpView.swift +++ b/Rethread/Rethread/Views/SignUpView.swift @@ -85,7 +85,7 @@ struct SignUpView: View { .padding(.leading, 25) .padding(.top, 20) - CustomTextField(placeholder: "First Name", text: $formData.firstName) + CustomTextField(placeholder: "First Name", text: $formData.firstName, disableAutocorrection: true) .padding(.leading, 25) .padding(.top, 9) } @@ -96,7 +96,7 @@ struct SignUpView: View { .padding(.trailing, 25) .padding(.top, 20) - CustomTextField(placeholder: "Last Name", text: $formData.lastName) + CustomTextField(placeholder: "Last Name", text: $formData.lastName, disableAutocorrection: true) .padding(.trailing, 25) .padding(.top, 9) } @@ -107,7 +107,7 @@ struct SignUpView: View { .padding(.horizontal, 25) .padding(.top, 20) - CustomTextField(placeholder: "Email", text: $formData.email) + CustomTextField(placeholder: "Email", text: $formData.email, disableAutocorrection: true) .padding(.horizontal, 25) .padding(.top, 9) HStack { @@ -162,7 +162,7 @@ struct SignUpView: View { .padding(.horizontal, 25) .padding(.top, 20) - CustomTextField(placeholder: "Phone Number", text: $formData.phoneNumber) + CustomTextField(placeholder: "Phone Number", text: $formData.phoneNumber, disableAutocorrection: true) .padding(.horizontal, 25) .padding(.top, 9) @@ -197,7 +197,7 @@ struct SignUpView: View { .padding(.horizontal, 25) .padding(.top, 20) - CustomTextField(placeholder: "Postal Code", text: $formData.postalCode) + CustomTextField(placeholder: "Postal Code", text: $formData.postalCode, disableAutocorrection: true) .padding(.horizontal, 25) .padding(.top, 9) diff --git a/Rethread/Rethread/Views/VerificationView.swift b/Rethread/Rethread/Views/VerificationView.swift index a54eea3..ad329c6 100644 --- a/Rethread/Rethread/Views/VerificationView.swift +++ b/Rethread/Rethread/Views/VerificationView.swift @@ -6,6 +6,7 @@ struct VerificationView: View { var formData: SignUpFormData? @Environment(\.dismiss) private var dismiss @EnvironmentObject var viewModel: AuthViewModel + @State private var isLoading = false // OTP Info @State var otpFields: [String] = Array(repeating: "", count: 6) @@ -53,42 +54,43 @@ struct VerificationView: View { // Bottom content, including the sign-in button VStack (spacing: 16) { - Button("Verify") { - // Handle sign in - if isSignIn { - // Sign in - print("Sign in") - } else { - // Confirm OTP. If successful, create user. - let otpCode = otpFields.joined() - print("Confirm OTP: \(otpCode)") - Task { - do { - // MARK: Log USER IN - // Create user - try await viewModel.createUser(formData: formData!) - dismiss() - } catch { - print("DEBUG: Error verifying user: \(error.localizedDescription)") + if isLoading { + ProgressView() + } else { + Button("Verify") { + // Handle sign in + isLoading = true + if isSignIn { + // MARK: SIGN IN OTP + } else { + // MARK: SIGN UP OTP + let otpCode = otpFields.joined() + Task { + do { + try await viewModel.createUser(formData: formData!) + dismiss() + } catch { + print("DEBUG: Error verifying user: \(error.localizedDescription)") + } } } } - } - .buttonStyle(PrimaryButtonStyle(width: 300, isDisabled: checkStates())) - .disabled(checkStates()) - - - Button(action: { - if let phoneNumber = formData?.phoneNumber { - Task { - + .buttonStyle(PrimaryButtonStyle(width: 300, isDisabled: checkStates() || isLoading)) + .disabled(checkStates() || isLoading) + + + Button(action: { + if let phoneNumber = formData?.phoneNumber { + Task { + // MARK: REQUEST NEW CODE + } } + }) { + Text("Request new code") + .foregroundColor(Color.primaryColor) + .fontWeight(.semibold) + .underline() // Underlined text } - }) { - Text("Request new code") - .foregroundColor(Color.primaryColor) - .fontWeight(.semibold) - .underline() // Underlined text } } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom) // Aligns buttons to the bottom