diff --git a/PAWS.xcodeproj/project.pbxproj b/PAWS.xcodeproj/project.pbxproj index dd15389d..0d79fc9c 100644 --- a/PAWS.xcodeproj/project.pbxproj +++ b/PAWS.xcodeproj/project.pbxproj @@ -31,6 +31,8 @@ 2F9056D5299E1B9C003D3802 /* FirestoreDataStorage in Frameworks */ = {isa = PBXBuildFile; productRef = 2F9056D4299E1B9C003D3802 /* FirestoreDataStorage */; }; 2F9056D7299E1B9C003D3802 /* FirestoreStoragePrefixUserIdAdapter in Frameworks */ = {isa = PBXBuildFile; productRef = 2F9056D6299E1B9C003D3802 /* FirestoreStoragePrefixUserIdAdapter */; }; 2F9056DB299E1C97003D3802 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2F9056D9299E1C97003D3802 /* GoogleService-Info.plist */; }; + 2FABBC5929A8975900DF3BBC /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 2FABBC5829A8975900DF3BBC /* FirebaseFirestore */; }; + 2FABBC5B29A8975900DF3BBC /* FirebaseFirestoreSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 2FABBC5A29A8975900DF3BBC /* FirebaseFirestoreSwift */; }; 2FC9759F2978E39600BA99FE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2FC9759E2978E39600BA99FE /* Localizable.strings */; }; 2FC975A82978F11A00BA99FE /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FC975A72978F11A00BA99FE /* Home.swift */; }; 3637947E2992F3B000B3C006 /* PAWSLandingScreen in Frameworks */ = {isa = PBXBuildFile; productRef = 3637947D2992F3B000B3C006 /* PAWSLandingScreen */; }; @@ -89,6 +91,8 @@ 2F49B7822980419C00BCB272 /* Questionnaires in Frameworks */, 2F49B77E2980407C00BCB272 /* Scheduler in Frameworks */, 2F9056D3299E1B9C003D3802 /* FHIRToFirestoreAdapter in Frameworks */, + 2FABBC5B29A8975900DF3BBC /* FirebaseFirestoreSwift in Frameworks */, + 2FABBC5929A8975900DF3BBC /* FirebaseFirestore in Frameworks */, 3637947E2992F3B000B3C006 /* PAWSLandingScreen in Frameworks */, 2F9056D5299E1B9C003D3802 /* FirestoreDataStorage in Frameworks */, 2F59B93F298C628800C5107F /* PAWSMockDataStorageProvider in Frameworks */, @@ -231,6 +235,8 @@ 2F9056D2299E1B9C003D3802 /* FHIRToFirestoreAdapter */, 2F9056D4299E1B9C003D3802 /* FirestoreDataStorage */, 2F9056D6299E1B9C003D3802 /* FirestoreStoragePrefixUserIdAdapter */, + 2FABBC5829A8975900DF3BBC /* FirebaseFirestore */, + 2FABBC5A29A8975900DF3BBC /* FirebaseFirestoreSwift */, ); productName = TemplateApplication; productReference = 653A254D283387FE005D4D48 /* PAWS.app */; @@ -312,6 +318,7 @@ 2F49B7742980407B00BCB272 /* XCRemoteSwiftPackageReference "CardinalKit" */, 2F4E237F2989C5930013F3D9 /* XCRemoteSwiftPackageReference "XCTHealthKit" */, 2F36AD25299D989F00B1077C /* XCRemoteSwiftPackageReference "XCTestExtensions" */, + 2FABBC5729A8975900DF3BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, ); productRefGroup = 653A254E283387FE005D4D48 /* Products */; projectDirPath = ""; @@ -771,6 +778,14 @@ minimumVersion = 0.3.1; }; }; + 2FABBC5729A8975900DF3BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 10.5.0; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -855,6 +870,16 @@ package = 2F49B7742980407B00BCB272 /* XCRemoteSwiftPackageReference "CardinalKit" */; productName = FirestoreStoragePrefixUserIdAdapter; }; + 2FABBC5829A8975900DF3BBC /* FirebaseFirestore */ = { + isa = XCSwiftPackageProductDependency; + package = 2FABBC5729A8975900DF3BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseFirestore; + }; + 2FABBC5A29A8975900DF3BBC /* FirebaseFirestoreSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 2FABBC5729A8975900DF3BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseFirestoreSwift; + }; 3637947D2992F3B000B3C006 /* PAWSLandingScreen */ = { isa = XCSwiftPackageProductDependency; productName = PAWSLandingScreen; diff --git a/PAWS.xcodeproj/xcshareddata/xcschemes/PAWS.xcscheme b/PAWS.xcodeproj/xcshareddata/xcschemes/PAWS.xcscheme index c6a10ccc..7ee5ecda 100644 --- a/PAWS.xcodeproj/xcshareddata/xcschemes/PAWS.xcscheme +++ b/PAWS.xcodeproj/xcshareddata/xcschemes/PAWS.xcscheme @@ -76,12 +76,6 @@ ReferencedContainer = "container:PAWS.xcodeproj"> - - - - { - Firestore( + var firestoreSettings = FirestoreSettings() + if FeatureFlags.useFirebaseEmulator { + let settings = FirestoreSettings() + settings.host = "localhost:8080" + settings.isPersistenceEnabled = false + settings.isSSLEnabled = false + } + + return Firestore( adapter: { FHIRToFirestoreAdapter() FirestoreStoragePrefixUserIdAdapter() }, - settings: .emulator + settings: firestoreSettings ) } diff --git a/PAWS/PAWSAppTestingSetup.swift b/PAWS/PAWSAppTestingSetup.swift index 0bd8b5c4..43df0098 100644 --- a/PAWS/PAWSAppTestingSetup.swift +++ b/PAWS/PAWSAppTestingSetup.swift @@ -17,10 +17,10 @@ private struct PAWSTestingSetup: ViewModifier { func body(content: Content) -> some View { content .task { - if CommandLine.arguments.contains("--skipOnboarding") { + if FeatureFlags.skipOnboarding { completedOnboardingFlow = true } - if CommandLine.arguments.contains("--showOnboarding") { + if FeatureFlags.showOnboarding { completedOnboardingFlow = false } } diff --git a/PAWS/Supporting Files/GoogleService-Info.plist b/PAWS/Supporting Files/GoogleService-Info.plist index 9f4ab096..62410148 100644 --- a/PAWS/Supporting Files/GoogleService-Info.plist +++ b/PAWS/Supporting Files/GoogleService-Info.plist @@ -3,32 +3,32 @@ CLIENT_ID - CLIENT_ID + 750636343858-kev1gbnfovu771ri9hqlh33kuh6reqcg.apps.googleusercontent.com REVERSED_CLIENT_ID - REVERSED_CLIENT_ID + com.googleusercontent.apps.750636343858-kev1gbnfovu771ri9hqlh33kuh6reqcg API_KEY - API_KEY + AIzaSyAkafWtgHHisoqURUyyYDW9Oj3gBSUaefQ GCM_SENDER_ID - GCM_SENDER_ID + 750636343858 PLIST_VERSION 1 BUNDLE_ID edu.stanford.cs342.2023.paws PROJECT_ID - cs3422023paws + cs342-2023-paws STORAGE_BUCKET - STORAGE_BUCKET + cs342-2023-paws.appspot.com IS_ADS_ENABLED - + IS_ANALYTICS_ENABLED - + IS_APPINVITE_ENABLED - + IS_GCM_ENABLED - + IS_SIGNIN_ENABLED - + GOOGLE_APP_ID - 1:123456789012:ios:1234567890123456789012 + 1:750636343858:ios:2d29a3cdbe7e71868e122b - + \ No newline at end of file diff --git a/PAWSModules/Sources/PAWSOnboardingFlow/Consent.swift b/PAWSModules/Sources/PAWSOnboardingFlow/Consent.swift index f4155324..38aa36ac 100644 --- a/PAWSModules/Sources/PAWSOnboardingFlow/Consent.swift +++ b/PAWSModules/Sources/PAWSOnboardingFlow/Consent.swift @@ -7,6 +7,7 @@ // import Onboarding +import PAWSSharedContext import SwiftUI @@ -42,7 +43,7 @@ struct Consent: View { consentDocument }, action: { - if !CommandLine.arguments.contains("--disableFirebase") { + if !FeatureFlags.disableFirebase { onboardingSteps.append(.accountSetup) } else { onboardingSteps.append(.healthKitPermissions) diff --git a/PAWSModules/Sources/PAWSSharedContext/FeatureFlags.swift b/PAWSModules/Sources/PAWSSharedContext/FeatureFlags.swift new file mode 100644 index 00000000..68fe73c9 --- /dev/null +++ b/PAWSModules/Sources/PAWSSharedContext/FeatureFlags.swift @@ -0,0 +1,24 @@ +// +// This source file is part of the CS342 2023 PAWS Team Application project +// +// SPDX-FileCopyrightText: 2023 Stanford University +// +// SPDX-License-Identifier: MIT +// + +/// A collection of feature flags for the PAWS app. +public enum FeatureFlags { + /// Skips the onboarding flow to enable easier development of features in the application and to allow UI tests to skip the onboarding flow. + public static let skipOnboarding = CommandLine.arguments.contains("--skipOnboarding") + /// Always show the onboarding when the application is launched. Makes it easy to modify and test the onboarding flow without the need to manually remove the application or reset the simulator. + public static let showOnboarding = CommandLine.arguments.contains("--showOnboarding") + /// Disables the Firebase interactions, including the login/sign-up step and the Firebase Firestore upload. + public static let disableFirebase = CommandLine.arguments.contains("--disableFirebase") + #if targetEnvironment(simulator) + /// Defines if the application should connect to the local firebase emulator. Always set to true when using the iOS simulator. + public static let useFirebaseEmulator = true + #else + /// Defines if the application should connect to the local firebase emulator. Always set to true when using the iOS simulator. + public static let useFirebaseEmulator = CommandLine.arguments.contains("--useFirebaseEmulator") + #endif +} diff --git a/README.md b/README.md index f44e7e35..4de5285f 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ The application includes the following feature flags that can be configured in t - ``--skipOnboarding``: Skips the onboarding flow to enable easier development of features in the application and to allow UI tests to skip the onboarding flow. - ``--showOnboarding``: Always show the onboarding when the application is launched. Makes it easy to modify and test the onboarding flow without the need to manually remove the application or reset the simulator. - ``--disableFirebase``: Disables the Firebase interactions, including the login/sign-up step and the Firebase Firestore upload. +- ``--useFirebaseEmulator``: Defines if the application should connect to the local firebase emulator. Always set to true when using the iOS simulator. ## Continous Delivery Workflows diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 8b7eeb7a..34b841b4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -46,6 +46,16 @@ platform :ios do xcodeproj: "PAWS.xcodeproj" }) build - upload_to_testflight + commit = last_git_commit + upload_to_testflight( + distribute_external: true, + groups: [ + "CS342 2023" + ], + submit_beta_review: true, + notify_external_testers: true, + expire_previous_builds: true, + changelog: commit[:message] + ) end end