Skip to content

Commit

Permalink
Improve Firebase Setup & Account Onboarding (#51)
Browse files Browse the repository at this point in the history
# Improve Firebase Setup & Account Onboarding

## ♻️ Current situation & Problem
- Improves the definition of Firebase documents & elements in the App

## ⚙️ Release Notes 
- Fixes issues with permissions in the Firebase Setup


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
PSchmiedmayer and dependabot[bot] authored Jul 27, 2024
1 parent 0d3a76d commit fc73ef8
Show file tree
Hide file tree
Showing 16 changed files with 219 additions and 548 deletions.
20 changes: 7 additions & 13 deletions ENGAGEHF.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
2FE5DC9929EDD9D9004B9AB4 /* XCTestExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 2FE5DC9829EDD9D9004B9AB4 /* XCTestExtensions */; };
2FE5DC9C29EDD9EF004B9AB4 /* XCTHealthKit in Frameworks */ = {isa = PBXBuildFile; productRef = 2FE5DC9B29EDD9EF004B9AB4 /* XCTHealthKit */; };
2FE5DCB129EE6107004B9AB4 /* AccountOnboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */; };
2FF350E42C4F3F0B0095F08F /* Firebase+References.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FF350E32C4F3F0B0095F08F /* Firebase+References.swift */; };
2FF53D8D2A8729D600042B76 /* ENGAGEHFStandard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */; };
4D065BE02C09401700EBB3AE /* StudyApplicationListCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D065BDF2C09401700EBB3AE /* StudyApplicationListCard.swift */; };
4D0F389E2C09779100DA12F7 /* ShowMoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0F389D2C09779000DA12F7 /* ShowMoreButton.swift */; };
Expand Down Expand Up @@ -90,7 +91,6 @@
4D92B9F82C3C901500ABCED7 /* SymptomsGraphSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D92B9F72C3C901500ABCED7 /* SymptomsGraphSection.swift */; };
4D92BA012C3C932300ABCED7 /* VitalsGraphSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D92BA002C3C932300ABCED7 /* VitalsGraphSection.swift */; };
4D92BA072C3CAE5300ABCED7 /* VitalListMeasurement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D92BA062C3CAE5300ABCED7 /* VitalListMeasurement.swift */; };
4D92BA0D2C3DCC4D00ABCED7 /* CollectionID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D92BA0C2C3DCC4D00ABCED7 /* CollectionID.swift */; };
4D92BA172C3E108700ABCED7 /* CodeableConcept+Contains.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D92BA162C3E108700ABCED7 /* CodeableConcept+Contains.swift */; };
4D92BA1A2C3E13F300ABCED7 /* FHIRSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D92BA192C3E13F300ABCED7 /* FHIRSystem.swift */; };
4DA20B4B2C249E7E00715AA2 /* VitalsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DA20B4A2C249E7E00715AA2 /* VitalsManager.swift */; };
Expand Down Expand Up @@ -184,6 +184,7 @@
2FE5DC3F29EDD7EE004B9AB4 /* StorageKeys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageKeys.swift; sourceTree = "<group>"; };
2FE5DC5529EDD811004B9AB4 /* SocialSupportQuestionnaire.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = SocialSupportQuestionnaire.json; sourceTree = "<group>"; };
2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountOnboarding.swift; sourceTree = "<group>"; };
2FF350E32C4F3F0B0095F08F /* Firebase+References.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Firebase+References.swift"; sourceTree = "<group>"; };
2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ENGAGEHFStandard.swift; sourceTree = "<group>"; };
4D065BDF2C09401700EBB3AE /* StudyApplicationListCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyApplicationListCard.swift; sourceTree = "<group>"; };
4D0F389D2C09779000DA12F7 /* ShowMoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowMoreButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -230,7 +231,6 @@
4D92B9F72C3C901500ABCED7 /* SymptomsGraphSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomsGraphSection.swift; sourceTree = "<group>"; };
4D92BA002C3C932300ABCED7 /* VitalsGraphSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VitalsGraphSection.swift; sourceTree = "<group>"; };
4D92BA062C3CAE5300ABCED7 /* VitalListMeasurement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VitalListMeasurement.swift; sourceTree = "<group>"; };
4D92BA0C2C3DCC4D00ABCED7 /* CollectionID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionID.swift; sourceTree = "<group>"; };
4D92BA162C3E108700ABCED7 /* CodeableConcept+Contains.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CodeableConcept+Contains.swift"; sourceTree = "<group>"; };
4D92BA192C3E13F300ABCED7 /* FHIRSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FHIRSystem.swift; sourceTree = "<group>"; };
4DA20B4A2C249E7E00715AA2 /* VitalsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VitalsManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -382,10 +382,10 @@
2FE5DC3C29EDD7DA004B9AB4 /* SharedContext */ = {
isa = PBXGroup;
children = (
4D92BA0C2C3DCC4D00ABCED7 /* CollectionID.swift */,
4D92BA192C3E13F300ABCED7 /* FHIRSystem.swift */,
2FE5DC3E29EDD7ED004B9AB4 /* FeatureFlags.swift */,
2FE5DC3F29EDD7EE004B9AB4 /* StorageKeys.swift */,
2FF350E32C4F3F0B0095F08F /* Firebase+References.swift */,
);
path = SharedContext;
sourceTree = "<group>";
Expand Down Expand Up @@ -827,7 +827,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1340;
LastUpgradeCheck = 1540;
LastUpgradeCheck = 1600;
TargetAttributes = {
653A254C283387FE005D4D48 = {
CreatedOnToolsVersion = 13.4;
Expand Down Expand Up @@ -933,7 +933,6 @@
4D8AD2C52C4A180300CB4F3E /* MeasurementSeries.swift in Sources */,
4D92BA1A2C3E13F300ABCED7 /* FHIRSystem.swift in Sources */,
2FE5DC3A29EDD7CA004B9AB4 /* Welcome.swift in Sources */,
4D92BA0D2C3DCC4D00ABCED7 /* CollectionID.swift in Sources */,
4D92BA172C3E108700ABCED7 /* CodeableConcept+Contains.swift in Sources */,
4DC0F67A2C34AD620025AB13 /* VitalsList.swift in Sources */,
2FE5DC3829EDD7CA004B9AB4 /* InterestingModules.swift in Sources */,
Expand All @@ -952,6 +951,7 @@
4DDFC7392BF2C3C9002B07A1 /* NotificationSection.swift in Sources */,
4D34B3F42C406340006F0D40 /* DateGranularity.swift in Sources */,
4D40729F2C488172007C5621 /* KnownVitalsSeries.swift in Sources */,
2FF350E42C4F3F0B0095F08F /* Firebase+References.swift in Sources */,
4DC0F6712C34818B0025AB13 /* HKSample+GetDoubleValues.swift in Sources */,
4D34B3F62C4065A5006F0D40 /* HeartHealthError.swift in Sources */,
4D8402812C4F067D00817495 /* FieldDetails.swift in Sources */,
Expand Down Expand Up @@ -1177,7 +1177,6 @@
2FEE10322998C89C000822E1 /* Test */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -1194,7 +1193,6 @@
2FEE10332998C89C000822E1 /* Test */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
Expand Down Expand Up @@ -1420,7 +1418,6 @@
653A257528338800005D4D48 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -1437,7 +1434,6 @@
653A257628338800005D4D48 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -1454,7 +1450,6 @@
653A257828338800005D4D48 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
Expand All @@ -1471,7 +1466,6 @@
653A257928338800005D4D48 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
Expand Down Expand Up @@ -1584,7 +1578,7 @@
repositoryURL = "https://github.com/StanfordSpezi/SpeziFirebase.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.1.2;
minimumVersion = 1.1.4;
};
};
2FE5DC8229EDD934004B9AB4 /* XCRemoteSwiftPackageReference "SpeziQuestionnaire" */ = {
Expand Down Expand Up @@ -1640,7 +1634,7 @@
repositoryURL = "https://github.com/StanfordSpezi/SpeziBluetooth.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = "3.0.0-beta.1";
minimumVersion = "3.0.0-beta.2";
};
};
5661551B2AB8384200209B80 /* XCRemoteSwiftPackageReference "swift-package-list" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "748c7837511d0e6a507737353af268484e1745e2",
"version" : "1.2024011601.1"
"revision" : "194a6706acbd25e4ef639bcaddea16e8758a3e27",
"version" : "1.2024011602.0"
}
},
{
Expand Down Expand Up @@ -202,10 +202,10 @@
{
"identity" : "spezibluetooth",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziBluetooth",
"location" : "https://github.com/StanfordSpezi/SpeziBluetooth.git",
"state" : {
"revision" : "387ed5d79be6ae990f714b648ed6a157c30d5b4d",
"version" : "3.0.0-beta.1"
"revision" : "5e78aed51b6a47c81f5e74962c531f82c221441b",
"version" : "3.0.0-beta.2"
}
},
{
Expand All @@ -222,17 +222,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziDevices.git",
"state" : {
"revision" : "ac008a4d6fcbd3ad6e10fcf9dc4954df94251bb7",
"version" : "1.1.0"
"revision" : "6fc18b28b03c9e2e5443c8316f59f32bec4304f7",
"version" : "1.1.1"
}
},
{
"identity" : "spezifirebase",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFirebase.git",
"state" : {
"revision" : "67981d0f0b4f0bb70f120f9b5304e7c0b08e5717",
"version" : "1.1.3"
"revision" : "e381b7d0fac1bf94e3257680c9af741e16b67817",
"version" : "1.1.4"
}
},
{
Expand Down Expand Up @@ -339,8 +339,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "fc79798d5a150d61361a27ce0c51169b889e23de",
"version" : "2.68.0"
"revision" : "e4abde8be0e49dc7d66e6eed651254accdcd9533",
"version" : "2.69.0"
}
},
{
Expand All @@ -357,8 +357,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "d57a5aecf24a25b32ec4a74be2f5d0a995a47c4b",
"version" : "1.27.0"
"revision" : "e17d61f26df0f0e06f58f6977ba05a097a720106",
"version" : "1.27.1"
}
},
{
Expand All @@ -375,8 +375,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "6a9e38e7bd22a3b8ba80bddf395623cf68f57807",
"version" : "1.3.1"
"revision" : "d2ba781702a1d8285419c15ee62fd734a9437ff5",
"version" : "1.3.2"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions ENGAGEHF.xcodeproj/xcshareddata/xcschemes/ENGAGEHF.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -111,7 +111,7 @@
</CommandLineArgument>
<CommandLineArgument
argument = "--useFirebaseEmulator"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
Expand Down
28 changes: 8 additions & 20 deletions ENGAGEHF/ENGAGEHFDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
// SPDX-License-Identifier: MIT
//

import FirebaseFirestore
import Spezi
import SpeziAccount
import SpeziBluetooth
import SpeziBluetoothServices
import SpeziDevices
import SpeziFirebaseAccount
import SpeziFirebaseAccountStorage
import SpeziFirebaseStorage
import SpeziFirestore
import SpeziOmron
Expand All @@ -26,11 +28,8 @@ class ENGAGEHFDelegate: SpeziAppDelegate {
if !FeatureFlags.disableFirebase {
AccountConfiguration(configuration: [
.requires(\.userId),
.requires(\.name),

// additional values stored using the `FirestoreAccountStorage` within our Standard implementation
.collects(\.genderIdentity),
.collects(\.dateOfBirth)
.supports(\.name),
.supports(\.dateOfBirth)
])

if FeatureFlags.useFirebaseEmulator {
Expand All @@ -41,7 +40,10 @@ class ENGAGEHFDelegate: SpeziAppDelegate {
} else {
FirebaseAccountConfiguration(authenticationMethods: [.emailAndPassword, .signInWithApple])
}
firestore
FirestoreAccountStorage(storeIn: Firestore.userCollection)

Firestore(settings: FeatureFlags.useFirebaseEmulator ? .emulator : FirestoreSettings())

if FeatureFlags.useFirebaseEmulator {
FirebaseStorageConfiguration(emulatorSettings: (host: "localhost", port: 9199))
} else {
Expand All @@ -65,18 +67,4 @@ class ENGAGEHFDelegate: SpeziAppDelegate {
ConfigureTipKit()
}
}


private var firestore: Firestore {
let settings = FirestoreSettings()
if FeatureFlags.useFirebaseEmulator {
settings.host = "localhost:8080"
settings.cacheSettings = MemoryCacheSettings()
settings.isSSLEnabled = false
}

return Firestore(
settings: settings
)
}
}
Loading

0 comments on commit fc73ef8

Please sign in to comment.