diff --git a/ENGAGEHF.xcodeproj/project.pbxproj b/ENGAGEHF.xcodeproj/project.pbxproj index 2de856b0..550b7c47 100644 --- a/ENGAGEHF.xcodeproj/project.pbxproj +++ b/ENGAGEHF.xcodeproj/project.pbxproj @@ -62,6 +62,7 @@ 4DB025BD2BBDE9F7002D2545 /* HeartHealthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB025BC2BBDE9F7002D2545 /* HeartHealthView.swift */; }; 4DB025BF2BBDEA03002D2545 /* EducationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB025BE2BBDEA03002D2545 /* EducationView.swift */; }; 4DB025C12BBDEA0B002D2545 /* MedicationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB025C02BBDEA0B002D2545 /* MedicationsView.swift */; }; + 4DB025C62BBE21EF002D2545 /* index.js in Resources */ = {isa = PBXBuildFile; fileRef = 4DB025C52BBE21EF002D2545 /* index.js */; }; 56E708352BB06B7100B08F0A /* SpeziLicense in Frameworks */ = {isa = PBXBuildFile; productRef = 56E708342BB06B7100B08F0A /* SpeziLicense */; }; 56E7083B2BB06F6F00B08F0A /* SwiftPackageList in Frameworks */ = {isa = PBXBuildFile; productRef = 56E7083A2BB06F6F00B08F0A /* SwiftPackageList */; }; 653A2551283387FE005D4D48 /* ENGAGEHF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653A2550283387FE005D4D48 /* ENGAGEHF.swift */; }; @@ -132,6 +133,7 @@ 4DB025BC2BBDE9F7002D2545 /* HeartHealthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeartHealthView.swift; sourceTree = ""; }; 4DB025BE2BBDEA03002D2545 /* EducationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EducationView.swift; sourceTree = ""; }; 4DB025C02BBDEA0B002D2545 /* MedicationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MedicationsView.swift; sourceTree = ""; }; + 4DB025C52BBE21EF002D2545 /* index.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = index.js; sourceTree = ""; }; 653A254D283387FE005D4D48 /* ENGAGEHF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ENGAGEHF.app; sourceTree = BUILT_PRODUCTS_DIR; }; 653A2550283387FE005D4D48 /* ENGAGEHF.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ENGAGEHF.swift; sourceTree = ""; }; 653A255428338800005D4D48 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -313,6 +315,21 @@ path = Education; sourceTree = ""; }; + 4DB025C32BBE219B002D2545 /* Functions */ = { + isa = PBXGroup; + children = ( + 4DB025C52BBE21EF002D2545 /* index.js */, + ); + path = Functions; + sourceTree = ""; + }; + 4DB025C72BBE24B9002D2545 /* Firebase */ = { + isa = PBXGroup; + children = ( + ); + path = Firebase; + sourceTree = ""; + }; 653A2544283387FE005D4D48 = { isa = PBXGroup; children = ( @@ -343,6 +360,8 @@ 2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */, 2F4E23822989D51F0013F3D9 /* ENGAGEHFTestingSetup.swift */, 2FC975A72978F11A00BA99FE /* Home.swift */, + 4DB025C72BBE24B9002D2545 /* Firebase */, + 4DB025C32BBE219B002D2545 /* Functions */, 4DB025B52BBDE8EC002D2545 /* Dashboard */, 4DB025B92BBDE9CB002D2545 /* HeartHealth */, 4DB025BB2BBDE9E2002D2545 /* Education */, @@ -555,6 +574,7 @@ 2FC3439129EE6349002D773C /* AppIcon.png in Resources */, 653A255528338800005D4D48 /* Assets.xcassets in Resources */, 2FC3439029EE6346002D773C /* SocialSupportQuestionnaire.json in Resources */, + 4DB025C62BBE21EF002D2545 /* index.js in Resources */, 2FA0BFED2ACC977500E0EF83 /* Localizable.xcstrings in Resources */, 2F6025CB29BBE70F0045459E /* GoogleService-Info.plist in Resources */, ); diff --git a/ENGAGEHF/Dashboard/DashboardView.swift b/ENGAGEHF/Dashboard/DashboardView.swift index 93425d5f..c8bd4d89 100644 --- a/ENGAGEHF/Dashboard/DashboardView.swift +++ b/ENGAGEHF/Dashboard/DashboardView.swift @@ -15,23 +15,30 @@ import SpeziAccount import SpeziMockWebService import SwiftUI -struct HomeTitle: View { - @Binding var presentingAccount: Bool +struct Greeting: View { + @State private var dateString: String? var body: some View { HStack { - titleBar - AccountButton(isPresented: $presentingAccount) + Text("Hello, world!") + .font(.title2) + Spacer() + Text(dateString ?? "No date") + .font(.title2) + } + .padding() + .task { + getDateString() } } - private var titleBar: some View { - Text("ENGAGE-HF Home") - .font(.title) - .foregroundColor(.white) - .padding() - .frame(maxWidth: .infinity) - .background(Color("AccentColor")) + private func getDateString() { + let currentDate = Date() + let dateFormatter = DateFormatter() + + dateFormatter.dateStyle = .short + + dateString = dateFormatter.string(from: currentDate) } } @@ -39,22 +46,27 @@ struct Dashboard: View { @Binding var presentingAccount: Bool var body: some View { - VStack { - // Title - - - // Greeting and Date - - // Notifications - - // To-Do list - - // Latest Vitals + NavigationStack { + VStack { + Greeting() + Spacer() + } + .navigationBarTitleDisplayMode(.inline) + .navigationTitle("ENGAGE-HF: Home") // Todo: Make this white - // Symptom Survey - } .toolbar { - AccountButton(isPresented: $presentingAccount) + ToolbarItem(placement: .topBarTrailing) { + AccountButton(isPresented: $presentingAccount) + .foregroundColor(.white) + } } + .toolbarBackground(.visible, for: .navigationBar) + .toolbarBackground(Color("AccentColor"), for: .navigationBar) + } } } + +#Preview { + @State var presentingAccount = false + return Dashboard(presentingAccount: $presentingAccount) +} diff --git a/ENGAGEHF/Functions/index.js b/ENGAGEHF/Functions/index.js new file mode 100644 index 00000000..5a56f638 --- /dev/null +++ b/ENGAGEHF/Functions/index.js @@ -0,0 +1,19 @@ +// +// This source file is part of the ENGAGE-HF project based on the Stanford Spezi Template Application project +// +// SPDX-FileCopyrightText: 2023 Stanford University +// +// SPDX-License-Identifier: MIT +// + +// Based on https://github.com/StanfordBDHG/PediatricAppleWatchStudy/pull/54 + +const {onCall} = require("firebase-functions/v2/https"); +const {logger, https} = require("firebase-functions/v2"); +const {FieldValue} = require("firebase-admin/firestore"); +const admin = require("firebase-admin"); +const {beforeUserCreated} = require("firebase-functions/v2/identity"); + +admin.initializeApp(); + + diff --git a/ENGAGEHF/Resources/Localizable.xcstrings b/ENGAGEHF/Resources/Localizable.xcstrings index 8727e838..4fa77ed1 100644 --- a/ENGAGEHF/Resources/Localizable.xcstrings +++ b/ENGAGEHF/Resources/Localizable.xcstrings @@ -110,6 +110,9 @@ }, "Education Test" : { + }, + "ENGAGE-HF: Home" : { + }, "HEALTHKIT_PERMISSIONS_BUTTON" : { "localizations" : { @@ -157,6 +160,9 @@ }, "Heart Health Test" : { + }, + "Hello, world!" : { + }, "Home" : { @@ -421,9 +427,6 @@ } } } - }, - "Test" : { - }, "WELCOME_AREA1_DESCRIPTION" : { "localizations" : {