Skip to content

Commit

Permalink
Upgrade SpeziFirebase to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewTurk247 committed Apr 4, 2024
1 parent cfe3988 commit 953c8dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PAWS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand All @@ -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"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions PAWS/Onboarding/InvitationCodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct InvitationCodeView: View {
print("Auth result: ", try await authResult)
}*/
await verifyOnboardingCode()
// try Auth.auth().signOut()
}
)
.disabled(invitationCode.isEmpty)
Expand Down
8 changes: 6 additions & 2 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 953c8dd

Please sign in to comment.