From 953c8dda7e051e04d4bce71a972a627bb0c2d345 Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Thu, 4 Apr 2024 15:50:00 -0700 Subject: [PATCH] Upgrade SpeziFirebase to latest version --- PAWS.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- PAWS/Onboarding/InvitationCodeView.swift | 1 + functions/index.js | 8 ++++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/PAWS.xcodeproj/project.pbxproj b/PAWS.xcodeproj/project.pbxproj index e4de3e34..780f27e9 100644 --- a/PAWS.xcodeproj/project.pbxproj +++ b/PAWS.xcodeproj/project.pbxproj @@ -1212,7 +1212,7 @@ repositoryURL = "https://github.com/StanfordSpezi/SpeziFirebase.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 1.0.0; + minimumVersion = 1.1.0; }; }; 2FE5DC8829EDD972004B9AB4 /* XCRemoteSwiftPackageReference "SpeziStorage" */ = { diff --git a/PAWS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/PAWS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f3b47fcc..7afd8759 100644 --- a/PAWS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/PAWS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -168,8 +168,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/StanfordSpezi/SpeziAccount.git", "state" : { - "revision" : "a7d289ef3be54de62b25dc92e8f7ff1a0f093906", - "version" : "1.2.1" + "revision" : "cb9441e5fe9ca31a17be2507d03817a080e63e9d", + "version" : "1.2.2" } }, { @@ -186,8 +186,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/StanfordSpezi/SpeziFirebase.git", "state" : { - "revision" : "e05e665b7da39aa399ecd7fba393aab49b8f3034", - "version" : "1.0.1" + "revision" : "16c1c751c14b08ae593eacf9bc2752c2e070fe2f", + "version" : "1.1.0" } }, { diff --git a/PAWS/Onboarding/InvitationCodeView.swift b/PAWS/Onboarding/InvitationCodeView.swift index 89c7570a..0e4ece42 100644 --- a/PAWS/Onboarding/InvitationCodeView.swift +++ b/PAWS/Onboarding/InvitationCodeView.swift @@ -45,6 +45,7 @@ struct InvitationCodeView: View { print("Auth result: ", try await authResult) }*/ await verifyOnboardingCode() + // try Auth.auth().signOut() } ) .disabled(invitationCode.isEmpty) diff --git a/functions/index.js b/functions/index.js index fcfe8b97..2216db94 100644 --- a/functions/index.js +++ b/functions/index.js @@ -32,7 +32,7 @@ exports.checkInvitationCode = onCall(async (request) => { const invitationCodeRef = firestore.doc(`invitationCodes/${invitationCode}`); const invitationCodeDoc = await invitationCodeRef.get(); - if (!invitationCodeDoc.exists || (invitationCodeDoc.data()?.used && invitationCodeDoc.data()?.usedBy !== userId)) { + if (!invitationCodeDoc.exists || (invitationCodeDoc.data().used)) { throw new https.HttpsError("not-found", "Invitation code not found or already used."); } @@ -78,9 +78,13 @@ exports.beforecreated = beforeUserCreated(async (event) => { .limit(1) .get(); + logger.info(`Invitation code query snapshot: ${invitationQuerySnapshot.size}`); + logger.info(`Event: ${event}`); + logger.info(`Event data: ${event.data}`); + if (invitationQuerySnapshot.empty) { // logger.error(`No valid invitation code found for user: ${userId} | ${getAuth().getUser(userId).email}`); - throw new https.HttpsError("not-found", "No valid invitation code found for this user."); + throw new https.HttpsError("not-found", `No valid invitation code found for user ${userId}.`); } const userDoc = await firestore.doc(`users/${userId}`).get();