Skip to content

Commit

Permalink
Merge branch 'main' into UI/notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer authored May 31, 2024
2 parents 007e019 + 8e57ce5 commit db368d8
Show file tree
Hide file tree
Showing 7 changed files with 1,488 additions and 1,026 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/beta-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@ jobs:
uses: StanfordBDHG/.github/.github/workflows/firebase-deploy.yml@v2
permissions:
contents: read
with:
arguments: '--debug'
secrets:
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
4 changes: 2 additions & 2 deletions ENGAGEHF.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1402,8 +1402,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziLicense";
requirement = {
branch = "dependency-list";
kind = branch;
kind = upToNextMinorVersion;
minimumVersion = 0.1.0;
};
};
97F466E62A76BBEE005DC9B4 /* XCRemoteSwiftPackageReference "SpeziOnboarding" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "9d17b500cd98d9a7009751ad62f802e152e97021",
"version" : "10.26.0"
"revision" : "8bcaf973b1d84e119b7c7c119abad72ed460979f",
"version" : "10.27.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "16244d177c4e989f87b25e9db1012b382cfedc55",
"version" : "10.25.0"
"revision" : "70df02431e216bed98dd461e0c4665889245ba70",
"version" : "10.27.0"
}
},
{
Expand Down Expand Up @@ -159,8 +159,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKit",
"state" : {
"revision" : "cf7ad893f0778b2d9b8af2d7e769ed84bbd45cbc",
"version" : "3.0.1"
"revision" : "08ab0290140e5a5e0e81d46cade1f09c7282facf",
"version" : "3.0.3"
}
},
{
Expand Down Expand Up @@ -258,8 +258,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziLicense",
"state" : {
"branch" : "dependency-list",
"revision" : "14e5581aa4dfcaeb2a3301318bc4f05bac9f182b"
"revision" : "d839e7138ca2e231f5bdd90c3e4ab06dba9bc30b",
"version" : "0.1.0"
}
},
{
Expand All @@ -276,8 +276,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziQuestionnaire.git",
"state" : {
"revision" : "d8700fb02f0608cc7852d695b2c776185feeb34f",
"version" : "1.2.0"
"revision" : "76732ebcb0b521fa94d41c38a5fe35e6e1a87173",
"version" : "1.2.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion ENGAGEHF/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct AccountSheet: View {
if account.signedIn && !isInSetup {
AccountOverview(isEditing: $overviewIsEditing) {
NavigationLink {
ContributionsList(projectLicense: "MIT")
ContributionsList(appName: "ENGAGE-HF", projectLicense: .mit)
} label: {
Text("LICENSE_INFO_TITLE")
}
Expand Down
7 changes: 3 additions & 4 deletions ENGAGEHF/Onboarding/InvitationCodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,21 @@ struct InvitationCodeView: View {
private func verifyOnboardingCode() async {
do {
if FeatureFlags.disableFirebase {
guard invitationCode == "VASCTRAC" else {
guard invitationCode == "ENGAGEHFTEST1" else {
throw InvitationCodeError.invitationCodeInvalid
}

try? await Task.sleep(for: .seconds(0.25))
} else {
try Auth.auth().signOut()

async let authResult = Auth.auth().signInAnonymously()
try await Auth.auth().signInAnonymously()
let checkInvitationCode = Functions.functions().httpsCallable("checkInvitationCode")

do {
_ = try await checkInvitationCode.call(
[
"invitationCode": invitationCode,
"userId": authResult.user.uid
"invitationCode": invitationCode
]
)
} catch {
Expand Down
9 changes: 5 additions & 4 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ const {beforeUserCreated} = require("firebase-functions/v2/identity");
admin.initializeApp();

exports.checkInvitationCode = onCall(async (request) => {
const {invitationCode, userId} = request.data;

if (!userId) {
if (!request.auth.uid) {
throw new https.HttpsError(
"unauthenticated",
"User is not properly authenticated.",
);
}

const userId = request.auth.uid;
const {invitationCode} = request.data;

const firestore = admin.firestore();
logger.debug(`User (${userId}) -> ENGAGE-HF, InvitationCode ${invitationCode}`);

Expand All @@ -35,7 +36,7 @@ exports.checkInvitationCode = onCall(async (request) => {
const invitationCodeRef = firestore.doc(`invitationCodes/${invitationCode}`);
const invitationCodeDoc = await invitationCodeRef.get();

if (!invitationCodeDoc.exists || (invitationCodeDoc.data().used)) {
if (!invitationCodeDoc.exists || invitationCodeDoc.data().used) {
throw new https.HttpsError("not-found", "Invitation code not found or already used.");
}

Expand Down
Loading

0 comments on commit db368d8

Please sign in to comment.