Skip to content

Commit

Permalink
Save and display recorded weight measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
nriedman committed May 12, 2024
1 parent 56c673d commit 7e0f4d5
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 130 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ jobs:
runsonlabels: '["macOS", "self-hosted"]'
setupSimulators: true
setupfirebaseemulator: true
customcommand: "npm install --prefix ./functions && firebase emulators:exec --import=./firebase 'fastlane test'"
fastlanelane: test
firebaseemulatorimport: ./firebase
secrets:
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
uploadcoveragereport:
name: Upload Coverage Report
needs: buildandtest
Expand Down
12 changes: 12 additions & 0 deletions ENGAGEHF.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
4D052DBB2BE08227006A784E /* SpeziFHIR in Frameworks */ = {isa = PBXBuildFile; productRef = 4D052DBA2BE08227006A784E /* SpeziFHIR */; };
4D052DBD2BE08227006A784E /* SpeziFHIRHealthKit in Frameworks */ = {isa = PBXBuildFile; productRef = 4D052DBC2BE08227006A784E /* SpeziFHIRHealthKit */; };
4D052DBF2BE08227006A784E /* SpeziFHIRMockPatients in Frameworks */ = {isa = PBXBuildFile; productRef = 4D052DBE2BE08227006A784E /* SpeziFHIRMockPatients */; };
4D19ED012BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D19ED002BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift */; };
4D49AAFE2BC9D50400C77310 /* BluetoothServices in Frameworks */ = {isa = PBXBuildFile; productRef = 4D49AAFD2BC9D50400C77310 /* BluetoothServices */; };
4D49AB002BC9D50400C77310 /* BluetoothViews in Frameworks */ = {isa = PBXBuildFile; productRef = 4D49AAFF2BC9D50400C77310 /* BluetoothViews */; };
4D49AB022BC9D50400C77310 /* SpeziBluetooth in Frameworks */ = {isa = PBXBuildFile; productRef = 4D49AB012BC9D50400C77310 /* SpeziBluetooth */; };
Expand Down Expand Up @@ -124,6 +125,7 @@
2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountOnboarding.swift; sourceTree = "<group>"; };
2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ENGAGEHFStandard.swift; sourceTree = "<group>"; };
4D052DB72BE07892006A784E /* MeasurementManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasurementManager.swift; sourceTree = "<group>"; };
4D19ED002BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasurementRecordedView.swift; sourceTree = "<group>"; };
4D49AB032BC9D54100C77310 /* BPCuffDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BPCuffDevice.swift; sourceTree = "<group>"; };
4D49AB052BC9D56900C77310 /* WeightScaleDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeightScaleDevice.swift; sourceTree = "<group>"; };
4D49AB0C2BC9DF9100C77310 /* WeightScaleFeature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeightScaleFeature.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -267,9 +269,18 @@
path = Helper;
sourceTree = "<group>";
};
4D19ECFC2BE5B9F200CDBAA8 /* Views */ = {
isa = PBXGroup;
children = (
4D19ED002BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift */,
);
path = Views;
sourceTree = "<group>";
};
4D49AAFB2BC9D46F00C77310 /* Bluetooth */ = {
isa = PBXGroup;
children = (
4D19ECFC2BE5B9F200CDBAA8 /* Views */,
4D49AB142BCF6FC400C77310 /* Devices */,
4D052DB72BE07892006A784E /* MeasurementManager.swift */,
);
Expand Down Expand Up @@ -599,6 +610,7 @@
buildActionMask = 2147483647;
files = (
2FE5DC4129EDD7EE004B9AB4 /* StorageKeys.swift in Sources */,
4D19ED012BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift in Sources */,
2FE5DCB129EE6107004B9AB4 /* AccountOnboarding.swift in Sources */,
2FE5DC3A29EDD7CA004B9AB4 /* Welcome.swift in Sources */,
2FE5DC3829EDD7CA004B9AB4 /* InterestingModules.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "2c55dbecac23b82cf07b0fd0b66c6bc3a201f32281bb207cf3602411201464ed",
"originHash" : "7e58979750991913f95f478a5ab91f3aa74dcbeda1c85fd75cc73056a8533e1b",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand All @@ -10,13 +10,22 @@
"version" : "1.2024011601.1"
}
},
{
"identity" : "antlr4",
"kind" : "remoteSourceControl",
"location" : "https://github.com/antlr/antlr4",
"state" : {
"revision" : "7ed420ff2c78d62883875c442d75f32e73bc86c8",
"version" : "4.13.1"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "c218c2054299b15ae577e818bbba16084d3eabe6",
"version" : "10.18.2"
"revision" : "7d2688de038d5484866d835acb47b379722d610e",
"version" : "10.19.0"
}
},
{
Expand All @@ -33,8 +42,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c",
"version" : "1.8.1"
"revision" : "c9c3df6ab812de32bae61fc0cd1bf6d45170ebf0",
"version" : "1.8.2"
}
},
{
Expand All @@ -51,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "888f0b6026e2441a69e3ee2ad5293c7a92031e62",
"version" : "10.23.1"
"revision" : "97940381e57703c07f31a8058d8f39ec53b7c272",
"version" : "10.25.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "c7a5917ebe48d69f421aadf154ef3969c8b7f12d",
"version" : "10.23.1"
"revision" : "16244d177c4e989f87b25e9db1012b382cfedc55",
"version" : "10.25.0"
}
},
{
Expand All @@ -78,8 +87,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "26c898aed8bed13b8a63057ee26500abbbcb8d55",
"version" : "7.13.1"
"revision" : "8e5d57ed87057cd7b0e4e8f474d9e78f73eb85f7",
"version" : "7.13.2"
}
},
{
Expand All @@ -96,17 +105,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "9534039303015a84837090d20fa21cae6e5eadb6",
"version" : "3.3.2"
"revision" : "0382ca27f22fb3494cf657d8dc356dc282cd1193",
"version" : "3.4.1"
}
},
{
"identity" : "healthkitonfhir",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR.git",
"state" : {
"revision" : "d6ceecf11800d73fed0c6ce33717f3dc71a44bd7",
"version" : "0.2.7"
"revision" : "418929f315f37e6d9c8f30f40030bc65b9cc47c9",
"version" : "0.2.8"
}
},
{
Expand All @@ -123,8 +132,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "43aaef65e0c665daadf848761d560e446d350d3d",
"version" : "1.22.4"
"revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
"version" : "1.22.5"
}
},
{
Expand Down Expand Up @@ -177,8 +186,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR",
"state" : {
"revision" : "7cd02fe3eee061b8cfbb32d272715af8838b978e",
"version" : "1.2.0"
"revision" : "cdb24dd5607d5a63aaf3a3597c98122189cb548e",
"version" : "1.3.0"
}
},
{
Expand All @@ -204,8 +213,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziAccount.git",
"state" : {
"revision" : "cb9441e5fe9ca31a17be2507d03817a080e63e9d",
"version" : "1.2.2"
"revision" : "83f505c69865d5aaacf71fd5ae8d2ffb8c3187d8",
"version" : "1.2.3"
}
},
{
Expand Down Expand Up @@ -265,7 +274,7 @@
{
"identity" : "spezifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation.git",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation",
"state" : {
"revision" : "01af5b91a54f30ddd121258e81aff2ddc2a99ff9",
"version" : "1.0.4"
Expand Down Expand Up @@ -303,8 +312,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziOnboarding",
"state" : {
"revision" : "4971a82e94996ce0c3d8ecf64fdeec874a1f20d6",
"version" : "1.1.1"
"revision" : "8d6dda3501720a1952573439b21a503cbecd9e0f",
"version" : "1.2.0"
}
},
{
Expand Down Expand Up @@ -375,8 +384,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982",
"version" : "2.64.0"
"revision" : "359c461e5561d22c6334828806cc25d759ca7aa6",
"version" : "2.65.0"
}
},
{
Expand Down Expand Up @@ -474,8 +483,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/Yams.git",
"state" : {
"revision" : "8a835d918245ca22f36663dd3862138805d7f707",
"version" : "5.1.0"
"revision" : "9234124cff5e22e178988c18d8b95a8ae8007f76",
"version" : "5.1.2"
}
}
],
Expand Down
8 changes: 4 additions & 4 deletions ENGAGEHF.xcodeproj/xcshareddata/xcschemes/ENGAGEHF.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@
<CommandLineArguments>
<CommandLineArgument
argument = "--disableFirebase"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--showOnboarding"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--skipOnboarding"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--testSchedule"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--useFirebaseEmulator"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,3 @@ extension WeightMeasurement: ByteDecodable {
self.weight = weight
}
}

private func getTimeStamp(from byteBuffer: inout NIOCore.ByteBuffer, preferredEndianness endianness: NIOCore.Endianness) -> Date? {
guard let year = UInt16(from: &byteBuffer, preferredEndianness: endianness),
let month = UInt8(from: &byteBuffer, preferredEndianness: endianness),
let day = UInt8(from: &byteBuffer, preferredEndianness: endianness),
let hour = UInt8(from: &byteBuffer, preferredEndianness: endianness),
let minute = UInt8(from: &byteBuffer, preferredEndianness: endianness),
let second = UInt8(from: &byteBuffer, preferredEndianness: endianness) else {
return nil
}

let dateComponents = DateComponents(
year: year != 0 ? Int(year) : nil,
month: month != 0 ? Int(month) : nil,
day: day != 0 ? Int(day) : nil,
hour: hour != 0 ? Int(hour) : nil,
minute: minute != 0 ? Int(minute) : nil,
second: second != 0 ? Int(second) : nil
)

return Calendar.current.date(from: dateComponents)
}
20 changes: 0 additions & 20 deletions ENGAGEHF/Bluetooth/Devices/WeightScale/WeightScaleDevice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,9 @@ class WeightScaleDevice: BluetoothDevice, Identifiable {


required init() {
// $state.onChange(perform: handleConnect)
service.$weightMeasurement.onChange(perform: processMeasurement)
}


// private func handleConnect(_ state: PeripheralState) async {
// // For now, only handle connection and ignore other stages
// if state != .connected {
// return
// }
//
// // Read device information and weight feature
// do {
// if service.$weightScaleFeature.isPresent {
// try await service.$weightScaleFeature.read()
// }
//
// try await deviceInformation.retrieveDeviceInformation()
// } catch {
// print("\(error)")
// }
// }

private func processMeasurement(_ measurement: WeightMeasurement) {
if !service.$weightMeasurement.isPresent {
return
Expand Down
Loading

0 comments on commit 7e0f4d5

Please sign in to comment.