diff --git a/Behavior.xcodeproj/project.pbxproj b/Behavior.xcodeproj/project.pbxproj index 8689b47..6f1b279 100644 --- a/Behavior.xcodeproj/project.pbxproj +++ b/Behavior.xcodeproj/project.pbxproj @@ -16,7 +16,6 @@ 2F4FC8D729EE69D300BFFE26 /* MockUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4FC8D629EE69D300BFFE26 /* MockUpload.swift */; }; 2F5E32BD297E05EA003432F8 /* BehaviorDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F5E32BC297E05EA003432F8 /* BehaviorDelegate.swift */; }; 2F6025CB29BBE70F0045459E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2F6025CA29BBE70F0045459E /* GoogleService-Info.plist */; }; - 2F65B44E2A3B8B0600A36932 /* NotificationPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F65B44D2A3B8B0600A36932 /* NotificationPermissions.swift */; }; 2FA0BFED2ACC977500E0EF83 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 2FA0BFEC2ACC977500E0EF83 /* Localizable.xcstrings */; }; 2FB099AF2A875DF100B20952 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099AE2A875DF100B20952 /* FirebaseAuth */; }; 2FB099B12A875DF100B20952 /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099B02A875DF100B20952 /* FirebaseFirestore */; }; @@ -102,7 +101,6 @@ 2F4FC8D629EE69D300BFFE26 /* MockUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUpload.swift; sourceTree = ""; }; 2F5E32BC297E05EA003432F8 /* BehaviorDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorDelegate.swift; sourceTree = ""; }; 2F6025CA29BBE70F0045459E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; - 2F65B44D2A3B8B0600A36932 /* NotificationPermissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationPermissions.swift; sourceTree = ""; }; 2FA0BFEC2ACC977500E0EF83 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; 2FAEC07F297F583900C11C42 /* Behavior.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Behavior.entitlements; sourceTree = ""; }; 2FC94CD4298B0A1D009C8209 /* Behavior.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Behavior.xctestplan; sourceTree = ""; }; @@ -231,7 +229,6 @@ 2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */, 2FE5DC2F29EDD7CA004B9AB4 /* Consent.swift */, 2FE5DC3029EDD7CA004B9AB4 /* HealthKitPermissions.swift */, - 2F65B44D2A3B8B0600A36932 /* NotificationPermissions.swift */, ); path = Onboarding; sourceTree = ""; @@ -605,7 +602,6 @@ A9FE7AD02AA39BAB0077B045 /* AccountSheet.swift in Sources */, 653A2551283387FE005D4D48 /* Behavior.swift in Sources */, 2FE5DC3629EDD7CA004B9AB4 /* HealthKitPermissions.swift in Sources */, - 2F65B44E2A3B8B0600A36932 /* NotificationPermissions.swift in Sources */, 5661552E2AB854C000209B80 /* PackageHelper.swift in Sources */, 27FA29902A388E9B009CAC45 /* ModalView.swift in Sources */, 2FE5DC2629EDD38A004B9AB4 /* Contacts.swift in Sources */, diff --git a/Behavior.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Behavior.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..c6a59ae --- /dev/null +++ b/Behavior.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,320 @@ +{ + "pins" : [ + { + "identity" : "abseil-cpp-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/abseil-cpp-binary.git", + "state" : { + "revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c", + "version" : "1.2022062300.0" + } + }, + { + "identity" : "app-check", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/app-check.git", + "state" : { + "revision" : "5746b2d35c91c50581590ed97abe4c06b5037274", + "version" : "10.18.0" + } + }, + { + "identity" : "fhirmodels", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/FHIRModels", + "state" : { + "revision" : "861afd5816a98d38f86220eab2f812d76cad84a0", + "version" : "0.5.0" + } + }, + { + "identity" : "firebase-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/firebase-ios-sdk.git", + "state" : { + "revision" : "c60c958e707c50a9cf8bcb7cfd7d51c566d726c5", + "version" : "10.19.1" + } + }, + { + "identity" : "googleappmeasurement", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleAppMeasurement.git", + "state" : { + "revision" : "6b332152355c372ace9966d8ee76ed191f97025e", + "version" : "10.17.0" + } + }, + { + "identity" : "googledatatransport", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleDataTransport.git", + "state" : { + "revision" : "a732a4b47f59e4f725a2ea10f0c77e93a7131117", + "version" : "9.3.0" + } + }, + { + "identity" : "googleutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleUtilities.git", + "state" : { + "revision" : "bc27fad73504f3d4af235de451f02ee22586ebd3", + "version" : "7.12.1" + } + }, + { + "identity" : "grpc-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/grpc-binary.git", + "state" : { + "revision" : "a673bc2937fbe886dd1f99c401b01b6d977a9c98", + "version" : "1.49.1" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "115f75e43851774934d695449a4836123c3246e1", + "version" : "3.2.0" + } + }, + { + "identity" : "healthkitonfhir", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR.git", + "state" : { + "revision" : "825e96007d83ed83f81ee49eb3ebab29d7b7ba2f", + "version" : "0.2.5" + } + }, + { + "identity" : "interop-ios-for-google-sdks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/interop-ios-for-google-sdks.git", + "state" : { + "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648", + "version" : "100.0.0" + } + }, + { + "identity" : "leveldb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/leveldb.git", + "state" : { + "revision" : "9d108e9112aa1d65ce508facf804674546116d9c", + "version" : "1.22.3" + } + }, + { + "identity" : "nanopb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/nanopb.git", + "state" : { + "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692", + "version" : "2.30909.0" + } + }, + { + "identity" : "promises", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/promises.git", + "state" : { + "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", + "version" : "2.3.1" + } + }, + { + "identity" : "researchkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordBDHG/ResearchKit", + "state" : { + "revision" : "cf79a15c7d8c436f98937fe93e72e880dd2f73e4", + "version" : "2.2.20" + } + }, + { + "identity" : "researchkitonfhir", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR", + "state" : { + "revision" : "7dc09f7acd7fb19673594e0fdd4d72d0869ee006", + "version" : "1.0.0" + } + }, + { + "identity" : "spezi", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/Spezi", + "state" : { + "revision" : "c4bf0e99de40acfdd2baf0fa02769f06a4c3f0eb", + "version" : "1.1.0" + } + }, + { + "identity" : "speziaccount", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziAccount.git", + "state" : { + "revision" : "714f01ae1e67bf9c1c0e7c07624380f9bea772b7", + "version" : "1.1.0" + } + }, + { + "identity" : "spezicontact", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziContact.git", + "state" : { + "revision" : "494b776f8c98d771e4a609a1fb706097dba4c030", + "version" : "1.0.0" + } + }, + { + "identity" : "spezifirebase", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziFirebase.git", + "state" : { + "revision" : "ca1edf678ec59e76c9869ee3448e6e165d9c2789", + "version" : "1.0.0" + } + }, + { + "identity" : "spezifoundation", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziFoundation.git", + "state" : { + "revision" : "683c66f922a4cfe0882c4a86a43854f613b48541", + "version" : "1.0.0" + } + }, + { + "identity" : "spezihealthkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziHealthKit.git", + "state" : { + "revision" : "d882734a4ed31fce1bffd7b9977e2669080f21de", + "version" : "0.5.0" + } + }, + { + "identity" : "spezimockwebservice", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziMockWebService.git", + "state" : { + "revision" : "b18067d3499e630bbd995ef05a296ef8fdd42528", + "version" : "1.0.0" + } + }, + { + "identity" : "spezionboarding", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziOnboarding", + "state" : { + "revision" : "ae7b18a18453557cd95c7adeb8f75846f48c343c", + "version" : "1.0.0" + } + }, + { + "identity" : "speziquestionnaire", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziQuestionnaire.git", + "state" : { + "revision" : "930a4099db1aca9db0b6ed4e77687141c4780052", + "version" : "1.0.0" + } + }, + { + "identity" : "spezischeduler", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziScheduler.git", + "state" : { + "revision" : "adf793cb47dc199f8ae88f5c719f4d3ba06a4c4e", + "version" : "0.8.0" + } + }, + { + "identity" : "spezistorage", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziStorage.git", + "state" : { + "revision" : "eaed2220375c35400aa69d1f96a8d32b7e66b1c7", + "version" : "1.0.0" + } + }, + { + "identity" : "speziviews", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordSpezi/SpeziViews.git", + "state" : { + "revision" : "0137e69d156bf4001a8d6bf5661c9a37b2bbd0aa", + "version" : "1.0.0" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "d029d9d39c87bed85b1c50adee7c41795261a192", + "version" : "1.0.6" + } + }, + { + "identity" : "swift-package-list", + "kind" : "remoteSourceControl", + "location" : "https://github.com/FelixHerrmann/swift-package-list", + "state" : { + "revision" : "412180a72b9a1f8262213c16459e3533b0385ea5", + "version" : "3.1.0" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8", + "version" : "1.25.2" + } + }, + { + "identity" : "xctestextensions", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordBDHG/XCTestExtensions.git", + "state" : { + "revision" : "388a6d6a5be48eff5d98a2c45e0b50f30ed21dc3", + "version" : "0.4.7" + } + }, + { + "identity" : "xcthealthkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordBDHG/XCTHealthKit.git", + "state" : { + "revision" : "6e9344a2d632b801d94fe3bbd1d891817e032103", + "version" : "0.3.5" + } + }, + { + "identity" : "xctruntimeassertions", + "kind" : "remoteSourceControl", + "location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions", + "state" : { + "revision" : "bb2a287c2544aa846e53670d1ece35e5949567be", + "version" : "1.0.0" + } + } + ], + "version" : 2 +} diff --git a/Behavior/BehaviorDelegate.swift b/Behavior/BehaviorDelegate.swift index 3009e2f..3e6b657 100644 --- a/Behavior/BehaviorDelegate.swift +++ b/Behavior/BehaviorDelegate.swift @@ -25,8 +25,6 @@ class BehaviorDelegate: SpeziAppDelegate { AccountConfiguration(configuration: [ .requires(\.userId), .requires(\.name), - - // additional values stored using the `FirestoreAccountStorage` within our Standard implementation .collects(\.genderIdentity), .collects(\.dateOfBirth) ]) @@ -52,7 +50,6 @@ class BehaviorDelegate: SpeziAppDelegate { if HKHealthStore.isHealthDataAvailable() { healthKit } - BehaviorScheduler() OnboardingDataSource() } @@ -79,6 +76,10 @@ class BehaviorDelegate: SpeziAppDelegate { HKQuantityType(.stepCount), deliverySetting: .anchorQuery(.afterAuthorizationAndApplicationWillLaunch) ) + CollectSample( + HKQuantityType(.activeEnergyBurned), + deliverySetting: .anchorQuery(.afterAuthorizationAndApplicationWillLaunch) + ) } } } diff --git a/Behavior/Onboarding/NotificationPermissions.swift b/Behavior/Onboarding/NotificationPermissions.swift deleted file mode 100644 index 18e5ba1..0000000 --- a/Behavior/Onboarding/NotificationPermissions.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// This source file is part of the Behavior based on the Stanford Spezi Template Application project -// -// SPDX-FileCopyrightText: 2023 Stanford University -// -// SPDX-License-Identifier: MIT -// - -import SpeziOnboarding -import SpeziScheduler -import SwiftUI - - -struct NotificationPermissions: View { - @Environment(BehaviorScheduler.self) private var scheduler - @Environment(OnboardingNavigationPath.self) private var onboardingNavigationPath - - @State private var notificationProcessing = false - - - var body: some View { - OnboardingView( - contentView: { - VStack { - OnboardingTitleView( - title: "NOTIFICATION_PERMISSIONS_TITLE", - subtitle: "NOTIFICATION_PERMISSIONS_SUBTITLE" - ) - Spacer() - Image(systemName: "bell.square.fill") - .font(.system(size: 150)) - .foregroundColor(.accentColor) - .accessibilityHidden(true) - Text("NOTIFICATION_PERMISSIONS_DESCRIPTION") - .multilineTextAlignment(.center) - .padding(.vertical, 16) - Spacer() - } - }, actionView: { - OnboardingActionsView( - "NOTIFICATION_PERMISSIONS_BUTTON", - action: { - do { - notificationProcessing = true - // Notification Authorization is not available in the preview simulator. - if ProcessInfo.processInfo.isPreviewSimulator { - try await _Concurrency.Task.sleep(for: .seconds(5)) - } else { - try await scheduler.requestLocalNotificationAuthorization() - } - } catch { - print("Could not request notification permissions.") - } - notificationProcessing = false - - onboardingNavigationPath.nextStep() - } - ) - } - ) - .navigationBarBackButtonHidden(notificationProcessing) - // Small fix as otherwise "Login" or "Sign up" is still shown in the nav bar - .navigationTitle(Text(verbatim: "")) - } -} - - -#if DEBUG -#Preview { - OnboardingStack { - NotificationPermissions() - } - .previewWith { - BehaviorScheduler() - } -} -#endif diff --git a/Behavior/Onboarding/OnboardingFlow.swift b/Behavior/Onboarding/OnboardingFlow.swift index e7c885b..7d88405 100644 --- a/Behavior/Onboarding/OnboardingFlow.swift +++ b/Behavior/Onboarding/OnboardingFlow.swift @@ -28,7 +28,7 @@ struct OnboardingFlow: View { if ProcessInfo.processInfo.isPreviewSimulator { return false } - + return healthKitDataSource.authorized } @@ -49,14 +49,7 @@ struct OnboardingFlow: View { if HKHealthStore.isHealthDataAvailable() && !healthKitAuthorization { HealthKitPermissions() } - - if !localNotificationAuthorization { - NotificationPermissions() - } } - .task { - localNotificationAuthorization = await scheduler.localNotificationAuthorization - } .interactiveDismissDisabled(!completedOnboardingFlow) } } diff --git a/Behavior/Resources/Localizable.xcstrings b/Behavior/Resources/Localizable.xcstrings index 7904315..4c624f8 100644 --- a/Behavior/Resources/Localizable.xcstrings +++ b/Behavior/Resources/Localizable.xcstrings @@ -134,32 +134,32 @@ } } }, - "EMOTION_QUESTIONNAIRE_DESCRIPTION" : { + "EMMA_BRUNSKILL_BIO" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Reflect on how you felt throughout the day! " + "value" : "Emma Brunskill is an associate tenured professor in the Computer Science Department at Stanford University. Prof. Brunskill's goal is to create AI systems that learn from few samples to robustly make good decisions, motivated by our applications to healthcare and education. Their lab is part of the Stanford AI Lab, the Stanford Statistical ML group, and AI Safety @Stanford. Prof. Brunskill was previously an assistant professor at Carnegie Mellon University, whose work has been honored by early faculty career awards (National Science Foundation, Office of Naval Research, Microsoft Research (1 of 7 worldwide) ). Their work, together with their amazing lab members, has received several best research paper nominations (CHI, EDMx3) and awards (UAI, RLDM, ITS). They are privileged to serve on the International Machine Learning Society (which coordinates ICML) Board, the Khan Academy Research Advisory Board, the Stanford Faculty Women's Forum Steering Committee, and previously served on the Women in Machine Learning (WIML) board." } } } }, - "EMOTION_QUESTIONNAIRE_TITLE" : { + "EMOTION_QUESTIONNAIRE_DESCRIPTION" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Emotion Questionnaire" + "value" : "Reflect on how you felt throughout the day!" } } } }, - "EMMA_BRUNSKILL_BIO" : { + "EMOTION_QUESTIONNAIRE_TITLE" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Emma Brunskill is an associate tenured professor in the Computer Science Department at Stanford University. Prof. Brunskill's goal is to create AI systems that learn from few samples to robustly make good decisions, motivated by our applications to healthcare and education. Their lab is part of the Stanford AI Lab, the Stanford Statistical ML group, and AI Safety @Stanford. Prof. Brunskill was previously an assistant professor at Carnegie Mellon University, whose work has been honored by early faculty career awards (National Science Foundation, Office of Naval Research, Microsoft Research (1 of 7 worldwide) ). Their work, together with their amazing lab members, has received several best research paper nominations (CHI, EDMx3) and awards (UAI, RLDM, ITS). They are privileged to serve on the International Machine Learning Society (which coordinates ICML) Board, the Khan Academy Research Advisory Board, the Stanford Faculty Women's Forum Steering Committee, and previously served on the Women in Machine Learning (WIML) board." + "value" : "Emotion Questionnaire" } } } @@ -357,47 +357,6 @@ } } }, - "NOTIFICATION_PERMISSIONS_BUTTON" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Allow Notifications" - } - } - } - }, - "NOTIFICATION_PERMISSIONS_DESCRIPTION" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "The Spezi Scheduler module enables to send out local notifications when a new event of a task is scheduled." - } - } - } - }, - "NOTIFICATION_PERMISSIONS_SUBTITLE" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Spezi Scheduler Notifications." - } - } - } - }, - "NOTIFICATION_PERMISSIONS_TITLE" : { - "comment" : "MARK: Notifications", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Notifications" - } - } - } - }, "PROJECT_LICENSE_DESCRIPTION" : { "localizations" : { "en" : { @@ -469,28 +428,6 @@ } } }, - "TASK_SOCIAL_SUPPORT_QUESTIONNAIRE_DESCRIPTION" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Please fill out the Social Support Questionnaire every day." - } - } - } - }, - "TASK_SOCIAL_SUPPORT_QUESTIONNAIRE_TITLE" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Social Support Questionnaire" - } - } - } - }, "WELCOME_AREA1_DESCRIPTION" : { "localizations" : { "en" : { @@ -566,7 +503,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "This application demonstrates several Spezi features & modules." + "value" : "This application collects data about your step count and active energy burned." } } } @@ -577,11 +514,11 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Spezi\nBehavior" + "value" : "Welcome to the Behavior Application!" } } } } }, "version" : "1.0" -} +} \ No newline at end of file