Skip to content

Commit

Permalink
fix(auth): resolve login issue with username and reg number
Browse files Browse the repository at this point in the history
  • Loading branch information
Rujin Devkota authored and Rujin Devkota committed Dec 21, 2024
1 parent b428a66 commit 9e9b3fa
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 24 deletions.
36 changes: 36 additions & 0 deletions VITTY/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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>CLIENT_ID</key>
<string>272763363329-i8n51oo9m30h9it7qq9ufmd0lahnmm63.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.272763363329-i8n51oo9m30h9it7qq9ufmd0lahnmm63</string>
<key>ANDROID_CLIENT_ID</key>
<string>272763363329-aa1tp2s4hogqcja3vn8jf19itn9s8r9o.apps.googleusercontent.com</string>
<key>API_KEY</key>
<string>AIzaSyCJYYDMdzQiNiY0pxqbrglEw85BSlGgHBc</string>
<key>GCM_SENDER_ID</key>
<string>272763363329</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.gdscvit.vittyios</string>
<key>PROJECT_ID</key>
<string>vitty-dscvit</string>
<key>STORAGE_BUCKET</key>
<string>vitty-dscvit.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:272763363329:ios:3b020b67f7527e83e2e000</string>
</dict>
</plist>
8 changes: 6 additions & 2 deletions VITTY/VITTY.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
317715DE279F1431009A532E /* IndexedCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 317715DD279F1431009A532E /* IndexedCollection.swift */; };
317EE1992775D3C6008AEB31 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 317EE1982775D3C6008AEB31 /* SettingsView.swift */; };
31A3BF4027D09AF300B6BB97 /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A3BF3F27D09AF300B6BB97 /* Date+Extension.swift */; };
4B76033B2D168E3F002DA484 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4B76033A2D168E3F002DA484 /* GoogleService-Info.plist */; };
520BA6432B47FFF900124850 /* SuggestedFriendsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 520BA6422B47FFF900124850 /* SuggestedFriendsViewModel.swift */; };
520BA6452B48013200124850 /* SuggestedFriendsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 520BA6442B48013200124850 /* SuggestedFriendsView.swift */; };
520BA6482B4802EE00124850 /* AddFriendCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 520BA6472B4802EE00124850 /* AddFriendCard.swift */; };
Expand Down Expand Up @@ -127,6 +128,7 @@
317715DD279F1431009A532E /* IndexedCollection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndexedCollection.swift; sourceTree = "<group>"; };
317EE1982775D3C6008AEB31 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
31A3BF3F27D09AF300B6BB97 /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = "<group>"; };
4B76033A2D168E3F002DA484 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
520BA6422B47FFF900124850 /* SuggestedFriendsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestedFriendsViewModel.swift; sourceTree = "<group>"; };
520BA6442B48013200124850 /* SuggestedFriendsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestedFriendsView.swift; sourceTree = "<group>"; };
520BA6472B4802EE00124850 /* AddFriendCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddFriendCard.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -266,6 +268,7 @@
isa = PBXGroup;
children = (
52EE849D2CB9CD1F00CD864C /* GoogleService-Info.plist */,
4B76033A2D168E3F002DA484 /* GoogleService-Info.plist */,
5251A7FF2B46E3C000D44CFE /* .swift-format */,
314A408E27383BEC0058082F /* VITTYApp.swift */,
314A409027383BEC0058082F /* ContentView.swift */,
Expand Down Expand Up @@ -760,6 +763,7 @@
31128CFA2772F57E0084C9EA /* Poppins-SemiBoldItalic.ttf in Resources */,
31128CFC2772F57E0084C9EA /* Poppins-Regular.ttf in Resources */,
52EE849E2CB9CD1F00CD864C /* GoogleService-Info.plist in Resources */,
4B76033B2D168E3F002DA484 /* GoogleService-Info.plist in Resources */,
314A409627383BEE0058082F /* Preview Assets.xcassets in Resources */,
314A409327383BEE0058082F /* Assets.xcassets in Resources */,
);
Expand Down Expand Up @@ -952,7 +956,7 @@
CURRENT_PROJECT_VERSION = 2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"VITTY/Preview Content\"";
DEVELOPMENT_TEAM = 2TS98F9X52;
DEVELOPMENT_TEAM = C7RX29D33F;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VITTY/Info.plist;
Expand Down Expand Up @@ -992,7 +996,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"VITTY/Preview Content\"";
DEVELOPMENT_TEAM = 2TS98F9X52;
DEVELOPMENT_TEAM = C7RX29D33F;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VITTY/Info.plist;
Expand Down
34 changes: 17 additions & 17 deletions VITTY/VITTY/Auth/ViewModels/AuthViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ class AuthViewModel: NSObject, ASAuthorizationControllerDelegate {
}


// private func signInServer(username: String, regNo: String) async {
// logger.info("Signing into server...")
// do {
// self.loggedInBackendUser = try await AuthAPIService.shared
// .signInUser(
// with: AuthRequestBody(
// uuid: loggedInFirebaseUser?.uid ?? "",
// reg_no: regNo,
// username: username
// )
// )
// }
// catch {
// logger.error("Signing into server error: \(error)")
// }
// logger.info("Signed into server")
// }
func signInServer(username: String, regNo: String) async {
logger.info("Signing into server...")
do {
self.loggedInBackendUser = try await AuthAPIService.shared
.signInUser(
with: AuthRequestBody(
uuid: loggedInFirebaseUser?.uid ?? "",
reg_no: regNo,
username: username
)
)
}
catch {
logger.error("Signing into server error: \(error)")
}
logger.info("Signed into server")
}

private func firebaseUserAuthUpdate(with auth: Auth, user: User?) {
logger.info("Firebase User Auth State Updated")
Expand Down
9 changes: 4 additions & 5 deletions VITTY/VITTY/Username/Views/UsernameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ struct UsernameView: View {
Spacer()
Button(action: {
Task {
// TODO: Important

// isLoading = true
// await authViewModel.signInServer(username: username, regNo: regNo)
// isLoading = false

isLoading = true
await authViewModel.signInServer(username: username, regNo: regNo)
isLoading = false
}
}) {
if isLoading {
Expand Down

0 comments on commit 9e9b3fa

Please sign in to comment.