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

Enhancement/customize home #2

Merged
merged 52 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b56db18
Customize Home View
nriedman Apr 3, 2024
e700e46
Simple Home View
nriedman Apr 3, 2024
c5f90b4
REUSE Compliance
nriedman Apr 4, 2024
d215b2f
Testing
nriedman Apr 4, 2024
3828048
Testing
nriedman Apr 4, 2024
a27e59d
UITests
nriedman Apr 4, 2024
27c37c3
Comments
nriedman Apr 4, 2024
6f0fd66
Decomposed Dashboard Greeting into separate file
nriedman Apr 4, 2024
7d6eed7
Update ENGAGEHF/Dashboard/DashboardView.swift
nriedman Apr 4, 2024
9412ed1
Remove cloud function files
nriedman Apr 4, 2024
897c7cb
Clean file headers, and white space
nriedman Apr 4, 2024
17937fd
Update GreetingView.swift
nriedman Apr 4, 2024
ce9d6d9
Update DashboardView.swift
nriedman Apr 4, 2024
87053e1
Merge branch 'enhancement/customize-home' of https://github.com/Stanf…
nriedman Apr 4, 2024
07d3e11
Update Localizable.xcstrings
nriedman Apr 4, 2024
11d0b1f
Remove dead source code and dependencies
nriedman Apr 4, 2024
3639028
Update DashboardView.swift
nriedman Apr 4, 2024
db6cc26
Remove scheduler and mock web service dependency
nriedman Apr 4, 2024
dfecc84
Update ENGAGEHFDelegate.swift
nriedman Apr 4, 2024
cf351d8
Align file names with view names
nriedman Apr 4, 2024
e13e849
Remove MockWebService dependent code
nriedman Apr 4, 2024
364a777
Revert "Remove MockWebService dependent code"
nriedman Apr 4, 2024
c23c574
Revert "Remove scheduler and mock web service dependency"
nriedman Apr 4, 2024
952c2e9
Revert "Remove dead source code and dependencies"
nriedman Apr 4, 2024
c7348a6
Revert "Update ENGAGEHFDelegate.swift"
nriedman Apr 4, 2024
0d50ae0
Recover stable version
nriedman Apr 4, 2024
5f7cefc
Remove filler views and source code
nriedman Apr 4, 2024
966385e
Remove excess accessibility labels
nriedman Apr 4, 2024
af773da
Update Greeting.swift
nriedman Apr 4, 2024
f9b3ec7
Only preview if DEBUG
nriedman Apr 4, 2024
e941f30
Remove stale localizable strings
nriedman Apr 4, 2024
80a3ce7
More stale strings
nriedman Apr 4, 2024
f6a4fbc
Update UI tests
nriedman Apr 4, 2024
d0e0261
Finish UITesting updates
nriedman Apr 4, 2024
f0c3c60
Remove MockWebService dependency & source code
nriedman Apr 4, 2024
e88cd11
Remove SpeziScheduler Dependency
nriedman Apr 4, 2024
ad4decb
Changes brought in from InvitationCode branch?
nriedman Apr 5, 2024
e73623a
Linting
nriedman Apr 5, 2024
12cccf2
Create Package.resolved
nriedman Apr 5, 2024
b607b9a
Linting
nriedman Apr 5, 2024
6b26b32
Revert "Changes brought in from InvitationCode branch?"
nriedman Apr 5, 2024
ac69274
firebase export
nriedman Apr 5, 2024
2bad313
Revert "firebase export"
nriedman Apr 5, 2024
13dcfd3
Create Package.resolved
nriedman Apr 5, 2024
905541a
Update Package.resolved
nriedman Apr 6, 2024
14f0799
Apply suggestions from code review
nriedman Apr 6, 2024
7e5f124
Address review comments
nriedman Apr 6, 2024
179ff76
Merge branch 'enhancement/customize-home' of https://github.com/Stanf…
nriedman Apr 6, 2024
832e8bd
Remove unnecessary preview
nriedman Apr 6, 2024
3923e99
Remove stale localizable strings
nriedman Apr 6, 2024
8a1c723
Remove unnecessary #if DEBUG
nriedman Apr 6, 2024
935a3bf
Update HomeViewUITests.swift
nriedman Apr 7, 2024
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
117 changes: 24 additions & 93 deletions ENGAGEHF.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"originHash" : "d2097b02aed2e09776146d22c31b71e71570248079de679a782c846c09d0ae6f",
"originHash" : "84060c25a97a757bf3045128a2563021282283c70a9cb6009941a41298deef92",
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "7ce7be095bc3ed3c98b009532fe2d7698c132614",
"version" : "1.2024011601.0"
"revision" : "748c7837511d0e6a507737353af268484e1745e2",
"version" : "1.2024011601.1"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "3e464dad87dad2d29bb29a97836789bf0f8f67d2",
"version" : "10.18.1"
"revision" : "c218c2054299b15ae577e818bbba16084d3eabe6",
"version" : "10.18.2"
}
},
{
Expand All @@ -40,7 +40,7 @@
{
"identity" : "fhirmodels",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/FHIRModels.git",
"location" : "https://github.com/apple/FHIRModels",
"state" : {
"revision" : "861afd5816a98d38f86220eab2f812d76cad84a0",
"version" : "0.5.0"
Expand Down Expand Up @@ -87,8 +87,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "67043f6389d0e28b38fa02d1c6952afeb04d807f",
"version" : "1.62.1"
"revision" : "e9fad491d0673bdda7063a0341fb6b47a30c5359",
"version" : "1.62.2"
}
},
{
Expand All @@ -105,8 +105,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR.git",
"state" : {
"revision" : "00d64d38a8f0d826ee9e27b6f3ce32314a29fd3e",
"version" : "0.2.6"
"revision" : "d6ceecf11800d73fed0c6ce33717f3dc71a44bd7",
"version" : "0.2.7"
}
},
{
Expand Down Expand Up @@ -150,17 +150,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKit",
"state" : {
"revision" : "6b28cdf0d06c3d6e96b5585369968b85deac96e0",
"version" : "2.2.29"
"revision" : "3f70adf898b5985ba15e25d5074d86a9c657d305",
"version" : "2.2.30"
}
},
{
"identity" : "researchkitonfhir",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR",
"state" : {
"revision" : "7c2efdcb17796fc9ee686900304dbbe9dd4aaf85",
"version" : "1.1.2"
"revision" : "7cd02fe3eee061b8cfbb32d272715af8838b978e",
"version" : "1.2.0"
}
},
{
Expand All @@ -186,8 +186,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziAccount.git",
"state" : {
"revision" : "a7d289ef3be54de62b25dc92e8f7ff1a0f093906",
"version" : "1.2.1"
"revision" : "cb9441e5fe9ca31a17be2507d03817a080e63e9d",
"version" : "1.2.2"
}
},
{
Expand All @@ -204,14 +204,14 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFirebase.git",
"state" : {
"revision" : "e05e665b7da39aa399ecd7fba393aab49b8f3034",
"version" : "1.0.1"
"revision" : "16c1c751c14b08ae593eacf9bc2752c2e070fe2f",
"version" : "1.1.0"
}
},
{
"identity" : "spezifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation.git",
"state" : {
"revision" : "01af5b91a54f30ddd121258e81aff2ddc2a99ff9",
"version" : "1.0.4"
Expand All @@ -232,16 +232,7 @@
"location" : "https://github.com/StanfordSpezi/SpeziLicense",
"state" : {
"branch" : "dependency-list",
"revision" : "9b1713dd9ac14708c0381cf54ad84e13f3780083"
}
},
{
"identity" : "spezimockwebservice",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziMockWebService.git",
"state" : {
"revision" : "b18067d3499e630bbd995ef05a296ef8fdd42528",
"version" : "1.0.0"
"revision" : "14e5581aa4dfcaeb2a3301318bc4f05bac9f182b"
}
},
{
Expand All @@ -262,15 +253,6 @@
"version" : "1.1.0"
}
},
{
"identity" : "spezischeduler",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziScheduler.git",
"state" : {
"revision" : "eed3980f20b01a788720c869010e3fe2fbfcd1fd",
"version" : "0.8.2"
}
},
{
"identity" : "spezistorage",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,30 @@
// SPDX-License-Identifier: MIT
//

import SpeziMockWebService
import SwiftUI


struct MockUpload: View {
struct Dashboard: View {
@Binding var presentingAccount: Bool


var body: some View {
NavigationStack {
RequestList()
VStack {
Greeting()
Spacer()
}
.navigationTitle("Home")
.toolbar {
if AccountButton.shouldDisplay {
AccountButton(isPresented: $presentingAccount)
}
}
}
}


init(presentingAccount: Binding<Bool>) {
self._presentingAccount = presentingAccount
}
}


#if DEBUG
#Preview {
MockUpload(presentingAccount: .constant(false))
.previewWith {
MockWebService()
}
Dashboard(presentingAccount: .constant(false))
}
#endif
29 changes: 29 additions & 0 deletions ENGAGEHF/Dashboard/Greeting.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// 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
//

import SwiftUI


struct Greeting: View {
var body: some View {
HStack(alignment: .top) {
Text("Hello, world!")
.font(.title.bold())
Spacer()
Text(.now, style: .date)
.font(.title3)
.foregroundStyle(.secondary)
}
.padding()
}
}


#Preview {
Greeting()
}
5 changes: 0 additions & 5 deletions ENGAGEHF/ENGAGEHFDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import SpeziFirebaseAccount
import SpeziFirebaseStorage
import SpeziFirestore
import SpeziHealthKit
import SpeziMockWebService
import SpeziOnboarding
import SpeziScheduler
import SwiftUI


Expand Down Expand Up @@ -45,15 +43,12 @@ class ENGAGEHFDelegate: SpeziAppDelegate {
} else {
FirebaseStorageConfiguration()
}
} else {
MockWebService()
}

if HKHealthStore.isHealthDataAvailable() {
healthKit
}

ENGAGEHFScheduler()
OnboardingDataSource()
}
}
Expand Down
21 changes: 0 additions & 21 deletions ENGAGEHF/ENGAGEHFStandard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import SpeziAccount
import SpeziFirebaseAccountStorage
import SpeziFirestore
import SpeziHealthKit
import SpeziMockWebService
import SpeziOnboarding
import SpeziQuestionnaire
import SwiftUI
Expand All @@ -31,7 +30,6 @@ actor ENGAGEHFStandard: Standard, EnvironmentAccessible, HealthKitConstraint, On
Firestore.firestore().collection("users")
}

@Dependency var mockWebService: MockWebService?
@Dependency var accountStorage: FirestoreAccountStorage?

@AccountReference var account: Account
Expand Down Expand Up @@ -68,14 +66,6 @@ actor ENGAGEHFStandard: Standard, EnvironmentAccessible, HealthKitConstraint, On


func add(sample: HKSample) async {
if let mockWebService {
let encoder = JSONEncoder()
encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]
let jsonRepresentation = (try? String(data: encoder.encode(sample.resource), encoding: .utf8)) ?? ""
try? await mockWebService.upload(path: "healthkit/\(sample.uuid.uuidString)", body: jsonRepresentation)
return
}

do {
try await healthKitDocument(id: sample.id).setData(from: sample.resource)
} catch {
Expand All @@ -84,11 +74,6 @@ actor ENGAGEHFStandard: Standard, EnvironmentAccessible, HealthKitConstraint, On
}

func remove(sample: HKDeletedObject) async {
if let mockWebService {
try? await mockWebService.remove(path: "healthkit/\(sample.uuid.uuidString)")
return
}

do {
try await healthKitDocument(id: sample.uuid).delete()
} catch {
Expand All @@ -99,12 +84,6 @@ actor ENGAGEHFStandard: Standard, EnvironmentAccessible, HealthKitConstraint, On
func add(response: ModelsR4.QuestionnaireResponse) async {
let id = response.identifier?.value?.value?.string ?? UUID().uuidString

if let mockWebService {
let jsonRepresentation = (try? String(data: JSONEncoder().encode(response), encoding: .utf8)) ?? ""
try? await mockWebService.upload(path: "questionnaireResponse/\(id)", body: jsonRepresentation)
return
}

do {
try await userDocumentReference
.collection("QuestionnaireResponse") // Add all HealthKit sources in a /QuestionnaireResponse collection.
Expand Down
44 changes: 6 additions & 38 deletions ENGAGEHF/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,30 @@
//

import SpeziAccount
import SpeziMockWebService
import SwiftUI


struct HomeView: View {
enum Tabs: String {
case schedule
case contact
case mockUpload
case home
}

static var accountEnabled: Bool {
!FeatureFlags.disableFirebase && !FeatureFlags.skipOnboarding
}


@AppStorage(StorageKeys.homeTabSelection) private var selectedTab = Tabs.schedule
@AppStorage(StorageKeys.homeTabSelection) private var selectedTab = Tabs.home
@State private var presentingAccount = false


var body: some View {
TabView(selection: $selectedTab) {
ScheduleView(presentingAccount: $presentingAccount)
.tag(Tabs.schedule)
Dashboard(presentingAccount: $presentingAccount)
.tag(Tabs.home)
.tabItem {
Label("SCHEDULE_TAB_TITLE", systemImage: "list.clipboard")
Label("Home", systemImage: "house")
}
Contacts(presentingAccount: $presentingAccount)
.tag(Tabs.contact)
.tabItem {
Label("CONTACTS_TAB_TITLE", systemImage: "person.fill")
}
if FeatureFlags.disableFirebase {
MockUpload(presentingAccount: $presentingAccount)
.tag(Tabs.mockUpload)
.tabItem {
Label("MOCK_WEB_SERVICE_TAB_TITLE", systemImage: "server.rack")
}
}
}
.sheet(isPresented: $presentingAccount) {
AccountSheet()
Expand All @@ -58,29 +43,12 @@ struct HomeView: View {
}


#if DEBUG
#Preview {
let details = AccountDetails.Builder()
.set(\.userId, value: "[email protected]")
.set(\.name, value: PersonNameComponents(givenName: "Leland", familyName: "Stanford"))

return HomeView()
.previewWith(standard: ENGAGEHFStandard()) {
ENGAGEHFScheduler()
MockWebService()
AccountConfiguration(building: details, active: MockUserIdPasswordAccountService())
}
}

#Preview {
CommandLine.arguments.append("--disableFirebase") // make sure the MockWebService is displayed
CommandLine.arguments.append("--disableFirebase")
return HomeView()
.previewWith(standard: ENGAGEHFStandard()) {
ENGAGEHFScheduler()
MockWebService()
AccountConfiguration {
MockUserIdPasswordAccountService()
}
}
}
#endif
Loading
Loading