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

Introduce Omron Device Pairing #16

Merged
merged 24 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
20e37da
Add Basic Pairing UI
Supereg Jun 10, 2024
6f572f0
Minor fixes
Supereg Jun 18, 2024
04e2a7c
Refine pairing UI and sourrounding infrastructure
Supereg Jun 18, 2024
13a2f32
Restructure project, tidy up pairing procedure.
Supereg Jun 18, 2024
5decc9c
Start with device details view.
Supereg Jun 18, 2024
ff355d5
Restructure devices grid, add details view. Battery Information and n…
Supereg Jun 19, 2024
be71119
Connect to paired devices. Support showing multiple devices in pairin…
Supereg Jun 20, 2024
ee6669b
Structure PairingUI into seprate files
Supereg Jun 20, 2024
550b5ab
Compiler issues
Supereg Jun 20, 2024
46216ca
Start building protocol hierarchy for SpeziDevices
Supereg Jun 21, 2024
91fb6b0
Move reusable infrastructure to SpeziDevices
Supereg Jun 21, 2024
f02b094
Move Measurements to SpeziDevices
Supereg Jun 27, 2024
b3d8320
Integrate newest versions and finalize device implementations
Supereg Jun 27, 2024
8c73b6f
Merge branch 'main' into feature/control-point
Supereg Jun 27, 2024
51baa14
Additional fixes
Supereg Jun 27, 2024
d4aae85
Update file names and REUSE
Supereg Jun 27, 2024
cc704b9
Save some time
Supereg Jun 27, 2024
a23dc3a
Minor fix
Supereg Jun 27, 2024
5eb4ca9
Move devices to SpeziDeviecs
Supereg Jun 27, 2024
50db0da
Remove old images
Supereg Jun 27, 2024
6e61d95
Minor changes
Supereg Jun 27, 2024
e7527ed
Minor changes
Supereg Jul 1, 2024
b5f8711
Add review button for pending measurements and upgrade to SpeziDevice…
Supereg Jul 2, 2024
5766a1f
Remove duplicate tests and fix weight date check
Supereg Jul 2, 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
1 change: 0 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
with:
artifactname: ENGAGEHF.xcresult
runsonlabels: '["macOS", "self-hosted"]'
setupSimulators: true
setupfirebaseemulator: true
fastlanelane: test
firebaseemulatorimport: ./firebase
Expand Down
215 changes: 49 additions & 166 deletions ENGAGEHF.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "4680bbbdca4179318420f5e90c76b7b5892a3fbaf02dc6668d80ce474e195a4d",
"originHash" : "bf5084f3a1640b549abaeb7502f3d1650efe31a71ce63ae49ff0fb7732a037e2",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -105,8 +105,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "0382ca27f22fb3494cf657d8dc356dc282cd1193",
"version" : "3.4.1"
"revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b",
"version" : "3.5.0"
}
},
{
Expand Down Expand Up @@ -169,7 +169,7 @@
"location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR",
"state" : {
"revision" : "dcd5f95522ed02a873b03c9638dbf397b99c74e0",
"version" : "1.4.0"
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -204,8 +204,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziBluetooth.git",
"state" : {
"revision" : "f3b8cc8461f12268b15db17aa45cc66b889cd1d0",
"version" : "1.6.0"
"revision" : "6b88cae1ea9a18ec875dcc8fae80cbeb291133f0",
"version" : "2.0.1"
}
},
{
Expand All @@ -217,6 +217,15 @@
"version" : "1.0.0"
}
},
{
"identity" : "spezidevices",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziDevices.git",
"state" : {
"revision" : "6b5e24f9983ae0ffccd57d078edb3981400af721",
"version" : "1.0.0"
}
},
{
"identity" : "spezifirebase",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -258,8 +267,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziNetworking",
"state" : {
"revision" : "71236efc911d5580fbf4d53748f38ad22ef00a2d",
"version" : "1.0.0"
"revision" : "b01333fbe46bc02445cc06a1d721bc490d77d95e",
"version" : "2.1.2"
}
},
{
Expand All @@ -276,8 +285,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziQuestionnaire.git",
"state" : {
"revision" : "76732ebcb0b521fa94d41c38a5fe35e6e1a87173",
"version" : "1.2.1"
"revision" : "853585fbdd5d2d0af440c805d629a025ef5545d9",
"version" : "1.2.2"
}
},
{
Expand Down Expand Up @@ -330,8 +339,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "e5a216ba89deba84356bad9d4c2eab99071c745b",
"version" : "2.67.0"
"revision" : "fc79798d5a150d61361a27ce0c51169b889e23de",
"version" : "2.68.0"
}
},
{
Expand Down Expand Up @@ -402,8 +411,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTestExtensions.git",
"state" : {
"revision" : "1fe9b8e76aeb7a132af37bfa0892160c9b662dcc",
"version" : "0.4.10"
"revision" : "cc2705fde81978eacd5496e14c9caf58909e2322",
"version" : "0.4.12"
}
},
{
Expand Down
17 changes: 12 additions & 5 deletions ENGAGEHF.xcodeproj/xcshareddata/xcschemes/ENGAGEHF.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -83,23 +83,23 @@
</CommandLineArgument>
<CommandLineArgument
argument = "--assumeOnboardingComplete"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--setupTestEnvironment"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--testMockDevices"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--skipOnboarding"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--skipOnboarding"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--skipOnboarding"
Expand All @@ -114,6 +114,13 @@
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "IDEPreferLogStreaming"
value = "YES"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
38 changes: 21 additions & 17 deletions ENGAGEHF/Dashboard/Dashboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
// SPDX-License-Identifier: MIT
//

@_spi(TestingSupport) import SpeziDevices
import SwiftUI


struct Dashboard: View {
@Binding var presentingAccount: Bool

#if DEBUG || TEST
@Environment(MeasurementManager.self) private var measurementManager
@Environment(HealthMeasurements.self) private var measurements
#endif


Expand All @@ -29,26 +30,29 @@
}
.padding()
}
.background(Color(.systemGroupedBackground))
.navigationTitle("Home")
.toolbar {
if AccountButton.shouldDisplay {
AccountButton(isPresented: $presentingAccount)
.background(Color(.systemGroupedBackground))
Supereg marked this conversation as resolved.
Show resolved Hide resolved
.navigationTitle("Home")
.toolbar {
if AccountButton.shouldDisplay {
AccountButton(isPresented: $presentingAccount)
}
}
}
#if DEBUG || TEST
.toolbar {
if FeatureFlags.testMockDevices {
ToolbarItemGroup(placement: .secondaryAction) {
Button("Trigger Weight Measurement", systemImage: "scalemass.fill") {
measurementManager.loadMockWeightMeasurement()
}
Button("Trigger Blood Pressure Measurement", systemImage: "drop.fill") {
measurementManager.loadMockBloodPressureMeasurement()
.toolbar {
if FeatureFlags.testMockDevices {
ToolbarItemGroup(placement: .secondaryAction) {
Button("Trigger Weight Measurement", systemImage: "scalemass.fill") {
measurements.loadMockWeightMeasurement()
}
Button("Trigger Blood Pressure Measurement", systemImage: "drop.fill") {
measurements.loadMockBloodPressureMeasurement()
}
Button("Show Measurements", systemImage: "heart.text.square") {
measurements.shouldPresentMeasurements = true
}

Check warning on line 52 in ENGAGEHF/Dashboard/Dashboard.swift

View check run for this annotation

Codecov / codecov/patch

ENGAGEHF/Dashboard/Dashboard.swift#L51-L52

Added lines #L51 - L52 were not covered by tests
}
}
}
}
#endif
}
}
Expand All @@ -60,7 +64,7 @@
Dashboard(presentingAccount: .constant(false))
.previewWith(standard: ENGAGEHFStandard()) {
NotificationManager()
MeasurementManager()
HealthMeasurements(mock: [.weight(.mockWeighSample)])
VitalsManager()
}
}
Expand Down
12 changes: 6 additions & 6 deletions ENGAGEHF/Dashboard/Notifications/NotificationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
if FeatureFlags.setupTestEnvironment, let user {
// Make sure to not load the mock notifications multiple times
if let notifications = self?.notifications, notifications.isEmpty {
Task {
Task { [weak self] in
try await self?.setupNotificationTests(user: user)
}
}
Expand Down Expand Up @@ -99,8 +99,8 @@
///
/// Creates a snapshot listener to save new notifications to the manager as they are added to the user's directory in Firebase
func registerSnapshotListener(user: User?) {
logger.info("Initializing notifiation snapshot listener...")
logger.info("Initializing notification snapshot listener...")

// Remove previous snapshot listener for the user before creating new one
snapshotListener?.remove()
guard let uid = user?.uid else {
Expand Down Expand Up @@ -139,12 +139,12 @@
return
}

logger.debug("Marking notitification complete with the following id: \(id)")
logger.debug("Marking notification complete with the following id: \(id)")

let firestore = Firestore.firestore()

guard let user = Auth.auth().currentUser else {
logger.error("Unable to mark notitificaitons complete: \(FetchingError.userNotAuthenticated)")
logger.error("Unable to mark notifications complete: \(FetchingError.userNotAuthenticated)")

Check warning on line 147 in ENGAGEHF/Dashboard/Notifications/NotificationManager.swift

View check run for this annotation

Codecov / codecov/patch

ENGAGEHF/Dashboard/Notifications/NotificationManager.swift#L147

Added line #L147 was not covered by tests
return
}

Expand Down
52 changes: 30 additions & 22 deletions ENGAGEHF/Dashboard/Vitals/Views/RecentVitalsSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
//

import HealthKit
@_spi(TestingSupport) import SpeziDevices
import SwiftUI


struct RecentVitalsSection: View {
@Environment(VitalsManager.self) private var vitalsManager

@Environment(HealthMeasurements.self) private var measurements


private var massUnits: HKUnit {
switch Locale.current.measurementSystem {
Expand Down Expand Up @@ -58,33 +60,38 @@


var body: some View {
Section(
content: {
VStack {
HStack {
VitalsCard(
type: "Weight",
units: massUnits.unitString,
measurement: weightMeasurement
)
VitalsCard(
type: "Heart Rate",
units: "BPM",
measurement: heartRateMeasurement
)
}
Section {
VStack {
HStack {
VitalsCard(
type: "Weight",
units: massUnits.unitString,
measurement: weightMeasurement
)
VitalsCard(
type: "Blood Pressure",
units: "mmHg",
measurement: bloodPressureMeasurement
type: "Heart Rate",
units: "BPM",
measurement: heartRateMeasurement
)
}
},
header: {
VitalsCard(
type: "Blood Pressure",
units: "mmHg",
measurement: bloodPressureMeasurement
)
}
} header: {
HStack {
Text("Recent Vitals")
.studyApplicationHeaderStyle()
Spacer()
if !measurements.pendingMeasurements.isEmpty {
Button("Review", systemImage: "heart.text.square") {
measurements.shouldPresentMeasurements = true
}

Check warning on line 91 in ENGAGEHF/Dashboard/Vitals/Views/RecentVitalsSection.swift

View check run for this annotation

Codecov / codecov/patch

ENGAGEHF/Dashboard/Vitals/Views/RecentVitalsSection.swift#L90-L91

Added lines #L90 - L91 were not covered by tests
}
}
)
}
}


Expand Down Expand Up @@ -118,5 +125,6 @@
RecentVitalsSection()
.previewWith(standard: ENGAGEHFStandard()) {
VitalsManager()
HealthMeasurements(mock: [.weight(.mockWeighSample)])
}
}
Loading
Loading