Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates survey #20

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions StrokeCog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,11 @@
INFOPLIST_FILE = "StrokeCog/Supporting Files/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = LifeSpace;
INFOPLIST_KEY_NSCameraUsageDescription = "This message should never appear. Please adjust this when you start using camera information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The StrokeCog uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The StrokeCog uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The LifeSpace app collects health data for a research study.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The LifeSpace app collects health data for a research study.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "This message should never appear. Please adjust this when you start using microphone information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSMotionUsageDescription = "This message should never appear. Please adjust this when you start using motion information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "This message should never appear. Please adjust this when you start using speecg information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
Expand Down Expand Up @@ -980,11 +980,11 @@
INFOPLIST_FILE = "StrokeCog/Supporting Files/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = LifeSpace;
INFOPLIST_KEY_NSCameraUsageDescription = "This message should never appear. Please adjust this when you start using camera information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The StrokeCog uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The StrokeCog uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The LifeSpace app collects health data for a research study.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The LifeSpace app collects health data for a research study.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "This message should never appear. Please adjust this when you start using microphone information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSMotionUsageDescription = "This message should never appear. Please adjust this when you start using motion information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "This message should never appear. Please adjust this when you start using speecg information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
Expand Down Expand Up @@ -1027,11 +1027,11 @@
INFOPLIST_FILE = "StrokeCog/Supporting Files/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = LifeSpace;
INFOPLIST_KEY_NSCameraUsageDescription = "This message should never appear. Please adjust this when you start using camera information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The StrokeCog uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The StrokeCog uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "StrokeCog tracks your location for a study.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The LifeSpace app collects health data for a research study.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The LifeSpace app collects health data for a research study.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The LifeSpace app tracks your location for a study.";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "This message should never appear. Please adjust this when you start using microphone information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSMotionUsageDescription = "This message should never appear. Please adjust this when you start using motion information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "This message should never appear. Please adjust this when you start using speecg information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
Expand Down
9 changes: 9 additions & 0 deletions StrokeCog/Map/OptionsPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import SwiftUI
struct OptionsPanel: View {
@AppStorage(StorageKeys.trackingPreference) private var trackingOn = true
@Environment(LocationModule.self) private var locationModule
@Environment(\.scenePhase) var scenePhase
@Environment(StrokeCogStandard.self) private var standard

@State private var showingSurveyAlert = false
@State private var showingSurvey = false
Expand All @@ -28,6 +30,13 @@ struct OptionsPanel: View {
.sheet(isPresented: $showingSurvey) {
DailySurveyTaskView(showingSurvey: $showingSurvey)
}
.onChange(of: scenePhase) { _, newPhase in
if newPhase == .active {
Task {
await standard.getLatestSurveyDate()
}
}
}
}

GroupBox {
Expand Down
2 changes: 1 addition & 1 deletion StrokeCog/Map/RefreshIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct RefreshIcon: View {
.onDisappear {
rotationAngle = 0
}
.accessibilityLabel("Refreshing map")
.accessibilityLabel("REFRESHING_MAP")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion StrokeCog/Map/StrokeCogMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct StrokeCogMapView: View {
refreshMap()
}) {
Image(systemName: "arrow.clockwise")
.accessibilityLabel("Refresh map")
.accessibilityLabel("REFRESHING_MAP")
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions StrokeCog/Onboarding/AccountOnboarding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SwiftUI


struct AccountOnboarding: View {
@Environment(StrokeCogStandard.self) private var standard
@Environment(Account.self) private var account
@Environment(OnboardingNavigationPath.self) private var onboardingNavigationPath

Expand All @@ -23,6 +24,12 @@ struct AccountOnboarding: View {
Task {
// Placing the nextStep() call inside this task will ensure that the sheet dismiss animation is
// played till the end before we navigate to the next step.

// Now that the user is logged in, we will update the user document
if let studyID = UserDefaults.standard.string(forKey: StorageKeys.studyID) {
await standard.setStudyID(studyID)
}

onboardingNavigationPath.nextStep()
}
},
Expand Down
1 change: 1 addition & 0 deletions StrokeCog/Onboarding/Consent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct Consent: View {
self.savingConsentForms = true

guard case let .completed(taskResult) = result else {
self.savingConsentForms = false
self.isConsentSheetPresented = false
return // user cancelled or task failed
}
Expand Down
2 changes: 1 addition & 1 deletion StrokeCog/Onboarding/StudyIDView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct StudyIDView: View {
.validate(input: studyID, rules: [validationRule])
.receiveValidation(in: $validation)
.alert(
"Error",
"ERROR",
isPresented: $showInvalidIDAlert
) {
Text("INVALID_STUDYID_MESSAGE")
Expand Down
77 changes: 69 additions & 8 deletions StrokeCog/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,25 @@
}
}
},
"Error" : {

"CONTINUE" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "CONTINUE"
}
}
}
},
"ERROR" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "ERROR"
}
}
}
},
"HEALTHKIT_PERMISSIONS_BUTTON" : {
"localizations" : {
Expand Down Expand Up @@ -349,6 +366,16 @@
}
}
},
"OK" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "OK"
}
}
}
},
"OPTIONS_PANEL_SURVEY_BUTTON" : {
"localizations" : {
"en" : {
Expand All @@ -369,11 +396,28 @@
}
}
},
"Refresh map" : {
"PREVIOUS_DAY_SURVEY_LABEL" : {

},
"Refreshing map" : {

"PREVIOUS_DAY_SURVEY_NOTICE" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Please note that you are answering yesterday's survey."
}
}
}
},
"REFRESHING_MAP" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Refreshing map..."
}
}
}
},
"RETRY_BUTTON_LABEL" : {
"localizations" : {
Expand All @@ -385,6 +429,16 @@
}
}
},
"SAVING_SURVEY" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Saving survey..."
}
}
}
},
"SCHEDULE_LIST_TITLE" : {
"localizations" : {
"en" : {
Expand Down Expand Up @@ -456,9 +510,6 @@
}
}
}
},
"Survey not available." : {

},
"SURVEY_NOT_AVAILABLE_MESSAGE" : {
"localizations" : {
Expand All @@ -470,6 +521,16 @@
}
}
},
"SURVEY_TAKEN_NOTICE" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "You have already taken the latest survey."
}
}
}
},
"TASK_CONTEXT_ACTION_QUESTIONNAIRE" : {
"localizations" : {
"en" : {
Expand Down
2 changes: 2 additions & 0 deletions StrokeCog/SharedContext/StorageKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ enum StorageKeys {
static let homeTabSelection = "home.tabselection"

static let trackingPreference = "tracking.preference"

static let lastSurveyDate = "lastSurveyDate"
}
Loading
Loading