Skip to content

Commit

Permalink
FIX: Create USER
Browse files Browse the repository at this point in the history
Signed-off-by: ParsaKargari <[email protected]>
  • Loading branch information
ParsaKargari committed Feb 5, 2024
1 parent c40db25 commit cc0f06c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
10 changes: 8 additions & 2 deletions Rethread/Rethread.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
983286CF2B05698F00851B19 /* RethreadUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RethreadUITests.swift; sourceTree = "<group>"; };
983286D12B05698F00851B19 /* RethreadUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RethreadUITestsLaunchTests.swift; sourceTree = "<group>"; };
983D40F82B68B81800905D4E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
983D40FA2B68D13E00905D4E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
98434A5C2B63342700F81127 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
9868A7DD2B1FAE780063D9BA /* ButtonStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonStyles.swift; sourceTree = "<group>"; };
988A0F982B3C112300ACDC90 /* DatePickerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -184,6 +185,7 @@
983286B32B05698E00851B19 /* Rethread */ = {
isa = PBXGroup;
children = (
983D40FA2B68D13E00905D4E /* Info.plist */,
7C9AA2D12B0EC3BC00EF6F36 /* Extensions */,
7C9AA2D42B0ECADF00EF6F36 /* Styles */,
9897C7712B3E6BF600EDE9D9 /* Components */,
Expand Down Expand Up @@ -621,9 +623,11 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Rethread/Preview Content\"";
DEVELOPMENT_TEAM = B83J2A83H6;
DEVELOPMENT_TEAM = 4GW9NWA7H9;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Rethread/Info.plist;
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Rethread needs your location";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -653,9 +657,11 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Rethread/Preview Content\"";
DEVELOPMENT_TEAM = B83J2A83H6;
DEVELOPMENT_TEAM = 4GW9NWA7H9;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Rethread/Info.plist;
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Rethread needs your location";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down
17 changes: 17 additions & 0 deletions Rethread/Rethread/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.69711373157-smt51cs82nik0nceo6slguta9vmaip00</string>
</array>
</dict>
</array>
</dict>
</plist>
2 changes: 2 additions & 0 deletions Rethread/Rethread/UserAuthentication/AuthViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FirebaseFirestoreSwift
class AuthViewModel: ObservableObject {
@Published var userSession: FirebaseAuth.User?
@Published var currentUser: User?
@Published var CLIENT_CODE: String = ""

init(){
self.userSession = Auth.auth().currentUser
Expand Down Expand Up @@ -79,3 +80,4 @@ class AuthViewModel: ObservableObject {
self.currentUser = try? snapshot.data(as: User.self)
}
}

11 changes: 9 additions & 2 deletions Rethread/Rethread/Views/SignUpView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,16 @@ struct SignUpView: View {
Button("Join Us") {
// Handle sign up
print(formData)
// Check form validity

self.isShowingVerification = true
// Send verification code
Task {
do {
self.isShowingVerification = true
} catch {
print("DEBUG: Error starting auth: \(error.localizedDescription)")
}
}

}
.buttonStyle(PrimaryButtonStyle(width: 300, isDisabled: !areTermsAccepted))
.disabled(!areTermsAccepted)
Expand Down
13 changes: 6 additions & 7 deletions Rethread/Rethread/Views/VerificationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,17 @@ struct VerificationView: View {
} else {
// Confirm OTP. If successful, create user.
let otpCode = otpFields.joined()
print("Confirm OTP: \(otpCode)")
Task {
do {
if let formData = formData {
try await viewModel.createUser(formData: formData)
}
// MARK: Log USER IN
// Create user
try await viewModel.createUser(formData: formData!)
dismiss()
} catch {
print("DEBUG: Error verifying code: \(error.localizedDescription)")
print("DEBUG: Error verifying user: \(error.localizedDescription)")
}
}


dismiss()
}
}
.buttonStyle(PrimaryButtonStyle(width: 300, isDisabled: checkStates()))
Expand Down

0 comments on commit cc0f06c

Please sign in to comment.