From ce41b7932eb253f1fd58c310ba203caab24d0575 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Sun, 31 Jan 2021 14:17:37 -0600 Subject: [PATCH 1/2] Track whether bolus was delivered automatically --- Loop.xcodeproj/project.pbxproj | 20 +++++++-------- .../Complication - WatchApp.xcscheme | 25 +++++-------------- .../Notification - WatchApp.xcscheme | 25 +++++-------------- .../xcshareddata/xcschemes/WatchApp.xcscheme | 25 +++++-------------- Loop/AppDelegate.swift | 2 +- ...aManager+BolusEntryViewModelDelegate.swift | 3 --- ...Manager+SimpleBolusViewModelDelegate.swift | 4 +-- .../DoseStore+SimulatedCoreData.swift | 6 +++-- Loop/Managers/DeviceDataManager.swift | 14 ++++------- Loop/Managers/WatchDataManager.swift | 2 +- Loop/View Models/BolusEntryViewModel.swift | 4 +-- Loop/View Models/SimpleBolusViewModel.swift | 4 +-- Loop/Views/SimpleBolusView.swift | 2 +- .../ViewModels/BolusEntryViewModelTests.swift | 20 +++++++-------- .../ViewModels/LoggedDoseViewModelTests.swift | 4 +-- .../SimpleBolusViewModelTests.swift | 6 ++--- WatchApp/DerivedAssets.xcassets/Contents.json | 6 ++--- 17 files changed, 63 insertions(+), 109 deletions(-) diff --git a/Loop.xcodeproj/project.pbxproj b/Loop.xcodeproj/project.pbxproj index 7495e88d4a..ba6dd14fcc 100644 --- a/Loop.xcodeproj/project.pbxproj +++ b/Loop.xcodeproj/project.pbxproj @@ -4573,7 +4573,7 @@ CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_DEBUG)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Loop/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -4595,7 +4595,7 @@ CODE_SIGN_ENTITLEMENTS = "$(LOOP_ENTITLEMENTS)"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_RELEASE)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Loop/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -4614,7 +4614,7 @@ CODE_SIGN_ENTITLEMENTS = "WatchApp Extension/WatchApp Extension.entitlements"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_DEBUG)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Carthage/Build/watchOS"; INFOPLIST_FILE = "WatchApp Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; @@ -4636,7 +4636,7 @@ CODE_SIGN_ENTITLEMENTS = "WatchApp Extension/WatchApp Extension.entitlements"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_RELEASE)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Carthage/Build/watchOS"; INFOPLIST_FILE = "WatchApp Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; @@ -4658,7 +4658,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "$(APPICON_NAME)"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_DEBUG)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Carthage/Build/watchOS"; IBSC_MODULE = WatchApp_Extension; INFOPLIST_FILE = WatchApp/Info.plist; @@ -4680,7 +4680,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "$(APPICON_NAME)"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_RELEASE)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Carthage/Build/watchOS"; IBSC_MODULE = WatchApp_Extension; INFOPLIST_FILE = WatchApp/Info.plist; @@ -4847,7 +4847,7 @@ CODE_SIGN_ENTITLEMENTS = "Loop Status Extension/Loop Status Extension.entitlements"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_DEBUG)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Loop Status Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -4866,7 +4866,7 @@ CODE_SIGN_ENTITLEMENTS = "Loop Status Extension/Loop Status Extension.entitlements"; CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_RELEASE)"; CODE_SIGN_STYLE = "$(LOOP_CODE_SIGN_STYLE)"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Loop Status Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -4931,7 +4931,7 @@ CODE_SIGN_IDENTITY = "$(LOOP_CODE_SIGN_IDENTITY_DEBUG)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 57; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; GCC_DYNAMIC_NO_PIC = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; INFOPLIST_FILE = "Loop Intent Extension/Info.plist"; @@ -4968,7 +4968,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 57; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UY678SP37Q; + DEVELOPMENT_TEAM = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; INFOPLIST_FILE = "Loop Intent Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/Loop.xcodeproj/xcshareddata/xcschemes/Complication - WatchApp.xcscheme b/Loop.xcodeproj/xcshareddata/xcschemes/Complication - WatchApp.xcscheme index c0bd8693bc..0e7664a95f 100644 --- a/Loop.xcodeproj/xcshareddata/xcschemes/Complication - WatchApp.xcscheme +++ b/Loop.xcodeproj/xcshareddata/xcschemes/Complication - WatchApp.xcscheme @@ -88,10 +88,8 @@ debugServiceExtension = "internal" allowLocationSimulation = "YES" launchAutomaticallySubstyle = "32"> - + - + - + - - - - - + diff --git a/Loop.xcodeproj/xcshareddata/xcschemes/Notification - WatchApp.xcscheme b/Loop.xcodeproj/xcshareddata/xcschemes/Notification - WatchApp.xcscheme index 954d6c42f6..85323bccce 100644 --- a/Loop.xcodeproj/xcshareddata/xcschemes/Notification - WatchApp.xcscheme +++ b/Loop.xcodeproj/xcshareddata/xcschemes/Notification - WatchApp.xcscheme @@ -89,10 +89,8 @@ allowLocationSimulation = "YES" launchAutomaticallySubstyle = "8" notificationPayloadFile = "WatchApp Extension/PushNotificationPayload.apns"> - + - + - + - - - - - + diff --git a/Loop.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme b/Loop.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme index 438b434bda..6d90be659a 100644 --- a/Loop.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme +++ b/Loop.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme @@ -88,10 +88,8 @@ debugServiceExtension = "internal" allowLocationSimulation = "YES" notificationPayloadFile = "WatchApp Extension/PushNotificationPayload.apns"> - + - + - + - - - - - + diff --git a/Loop/AppDelegate.swift b/Loop/AppDelegate.swift index b34b72981e..d31b1c7d30 100644 --- a/Loop/AppDelegate.swift +++ b/Loop/AppDelegate.swift @@ -228,7 +228,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate { { deviceDataManager?.analyticsServicesManager.didRetryBolus() - deviceDataManager?.enactBolus(units: units, at: startDate) { (_) in + deviceDataManager?.enactBolus(units: units, automatic: false) { (_) in completionHandler() } return diff --git a/Loop/Extensions/DeviceDataManager+BolusEntryViewModelDelegate.swift b/Loop/Extensions/DeviceDataManager+BolusEntryViewModelDelegate.swift index 66fa0affd9..4550c22feb 100644 --- a/Loop/Extensions/DeviceDataManager+BolusEntryViewModelDelegate.swift +++ b/Loop/Extensions/DeviceDataManager+BolusEntryViewModelDelegate.swift @@ -32,9 +32,6 @@ extension DeviceDataManager: BolusEntryViewModelDelegate, LoggedDoseViewModelDel loopManager.storeBolusDosingDecision(bolusDosingDecision, withDate: date) } - /// func enactBolus(units: Double, at startDate: Date, completion: @escaping (_ error: Error?) -> Void) - /// is already implemented in DeviceDataManager - func getGlucoseSamples(start: Date?, end: Date?, completion: @escaping (Swift.Result<[StoredGlucoseSample], Error>) -> Void) { glucoseStore.getGlucoseSamples(start: start, end: end, completion: completion) } diff --git a/Loop/Extensions/DeviceDataManager+SimpleBolusViewModelDelegate.swift b/Loop/Extensions/DeviceDataManager+SimpleBolusViewModelDelegate.swift index ed5e71274a..161ca71d00 100644 --- a/Loop/Extensions/DeviceDataManager+SimpleBolusViewModelDelegate.swift +++ b/Loop/Extensions/DeviceDataManager+SimpleBolusViewModelDelegate.swift @@ -22,8 +22,8 @@ extension DeviceDataManager: SimpleBolusViewModelDelegate { } } - func enactBolus(units: Double, at startDate: Date) { - enactBolus(units: units, at: startDate) { (_) in } + func enactBolus(units: Double, automatic: Bool) { + enactBolus(units: units, automatic: automatic) { (_) in } } func computeSimpleBolusRecommendation(at date: Date, mealCarbs: HKQuantity?, manualGlucose: HKQuantity?) -> BolusDosingDecision? { diff --git a/Loop/Extensions/DoseStore+SimulatedCoreData.swift b/Loop/Extensions/DoseStore+SimulatedCoreData.swift index aa7e445bf1..f37ebbc2f8 100644 --- a/Loop/Extensions/DoseStore+SimulatedCoreData.swift +++ b/Loop/Extensions/DoseStore+SimulatedCoreData.swift @@ -191,7 +191,8 @@ fileprivate extension PersistedPumpEvent { raw: Data(UUID().uuidString.utf8), title: UUID().uuidString, type: type, - isMutable: false) + isMutable: false, + automatic: nil) } private static func simulated(dose: DoseEntry) -> PersistedPumpEvent { @@ -203,6 +204,7 @@ fileprivate extension PersistedPumpEvent { raw: Data(UUID().uuidString.utf8), title: String(describing: dose), type: dose.type.pumpEventType!, - isMutable: false) + isMutable: false, + automatic: nil) } } diff --git a/Loop/Managers/DeviceDataManager.swift b/Loop/Managers/DeviceDataManager.swift index f742563d0d..9131db02aa 100644 --- a/Loop/Managers/DeviceDataManager.swift +++ b/Loop/Managers/DeviceDataManager.swift @@ -580,23 +580,19 @@ private extension DeviceDataManager { // MARK: - Client API extension DeviceDataManager { - func enactBolus(units: Double, at startDate: Date = Date(), completion: @escaping (_ error: Error?) -> Void = { _ in }) { + func enactBolus(units: Double, automatic: Bool, completion: @escaping (_ error: Error?) -> Void = { _ in }) { guard let pumpManager = pumpManager else { completion(LoopError.configurationError(.pumpManager)) return } self.loopManager.addRequestedBolus(DoseEntry(type: .bolus, startDate: Date(), value: units, unit: .units), completion: nil) - pumpManager.enactBolus(units: units, at: startDate) { (result) in + pumpManager.enactBolus(units: units, automatic: automatic) { (result) in switch result { case .failure(let error): self.log.error("%{public}@", String(describing: error)) - switch error { - case .uncertainDelivery: - // Do not generate notification on uncertain delivery error - break - default: - NotificationManager.sendBolusFailureNotification(for: error, units: units, at: startDate) + if case .uncertainDelivery = error, !automatic { + NotificationManager.sendBolusFailureNotification(for: error, units: units, at: Date()) } self.loopManager.bolusRequestFailed(error) { completion(error) @@ -1147,7 +1143,7 @@ extension DeviceDataManager: LoopDataManagerDelegate { if automaticDose.recommendation.bolusUnits > 0 { self.log.default("LoopManager did recommend bolus dose") doseDispatchGroup.enter() - pumpManager.enactBolus(units: automaticDose.recommendation.bolusUnits, at: Date()) { (result) in + pumpManager.enactBolus(units: automaticDose.recommendation.bolusUnits, automatic: true) { (result) in switch result { case .failure(let error): bolusError = error diff --git a/Loop/Managers/WatchDataManager.swift b/Loop/Managers/WatchDataManager.swift index 4ba4cd1161..27d7a6c1b0 100644 --- a/Loop/Managers/WatchDataManager.swift +++ b/Loop/Managers/WatchDataManager.swift @@ -366,7 +366,7 @@ final class WatchDataManager: NSObject { return } - deviceManager.enactBolus(units: bolus.value, at: bolus.startDate) { (error) in + deviceManager.enactBolus(units: bolus.value, automatic: true) { (error) in if error == nil { self.deviceManager.analyticsServicesManager.didSetBolusFromWatch(bolus.value) } diff --git a/Loop/View Models/BolusEntryViewModel.swift b/Loop/View Models/BolusEntryViewModel.swift index 4b7c118213..405d5dfb19 100644 --- a/Loop/View Models/BolusEntryViewModel.swift +++ b/Loop/View Models/BolusEntryViewModel.swift @@ -28,7 +28,7 @@ protocol BolusEntryViewModelDelegate: class { func storeBolusDosingDecision(_ bolusDosingDecision: BolusDosingDecision, withDate date: Date) - func enactBolus(units: Double, at startDate: Date, completion: @escaping (_ error: Error?) -> Void) + func enactBolus(units: Double, automatic: Bool, completion: @escaping (_ error: Error?) -> Void) func logOutsideInsulinDose(startDate: Date, units: Double, insulinType: InsulinType?) @@ -379,7 +379,7 @@ final class BolusEntryViewModel: ObservableObject { isInitiatingSaveOrBolus = true savedPreMealOverride = nil // TODO: should we pass along completion or not??? - delegate?.enactBolus(units: bolusVolume, at: now, completion: { _ in }) + delegate?.enactBolus(units: bolusVolume, automatic: false, completion: { _ in }) completion() } diff --git a/Loop/View Models/SimpleBolusViewModel.swift b/Loop/View Models/SimpleBolusViewModel.swift index 9df2a915fc..62fea5250b 100644 --- a/Loop/View Models/SimpleBolusViewModel.swift +++ b/Loop/View Models/SimpleBolusViewModel.swift @@ -25,7 +25,7 @@ protocol SimpleBolusViewModelDelegate: class { func storeBolusDosingDecision(_ bolusDosingDecision: BolusDosingDecision, withDate date: Date) - func enactBolus(units: Double, at startDate: Date) + func enactBolus(units: Double, automatic: Bool) func insulinOnBoard(at date: Date, completion: @escaping (_ result: DoseStoreResult) -> Void) @@ -306,7 +306,7 @@ class SimpleBolusViewModel: ObservableObject { func enactBolus() { if let bolusVolume = bolus?.doubleValue(for: .internationalUnit()), bolusVolume > 0 { - delegate.enactBolus(units: bolusVolume, at: saveDate) + delegate.enactBolus(units: bolusVolume, automatic: false) dosingDecision?.requestedBolus = bolusVolume } } diff --git a/Loop/Views/SimpleBolusView.swift b/Loop/Views/SimpleBolusView.swift index 82b8adab61..9db4fdb8f6 100644 --- a/Loop/Views/SimpleBolusView.swift +++ b/Loop/Views/SimpleBolusView.swift @@ -353,7 +353,7 @@ struct SimpleBolusCalculatorView_Previews: PreviewProvider { completion(.success(storedCarbEntry)) } - func enactBolus(units: Double, at startDate: Date) { + func enactBolus(units: Double, automatic: Bool) { } func insulinOnBoard(at date: Date, completion: @escaping (DoseStoreResult) -> Void) { diff --git a/LoopTests/ViewModels/BolusEntryViewModelTests.swift b/LoopTests/ViewModels/BolusEntryViewModelTests.swift index baea7dcaf0..dfff857db7 100644 --- a/LoopTests/ViewModels/BolusEntryViewModelTests.swift +++ b/LoopTests/ViewModels/BolusEntryViewModelTests.swift @@ -430,7 +430,7 @@ class BolusEntryViewModelTests: XCTestCase { authenticateOverrideCompletion(.success(())) XCTAssertEqual(1.0, delegate.enactedBolusUnits) - XCTAssertEqual(now, delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertTrue(success) XCTAssertTrue(delegate.glucoseSamplesAdded.isEmpty) XCTAssertTrue(delegate.carbEntriesAdded.isEmpty) @@ -451,7 +451,7 @@ class BolusEntryViewModelTests: XCTestCase { authenticateOverrideCompletion(.failure(MockError())) XCTAssertNil(delegate.enactedBolusUnits) - XCTAssertNil(delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertFalse(success) XCTAssertTrue(delegate.glucoseSamplesAdded.isEmpty) XCTAssertTrue(delegate.carbEntriesAdded.isEmpty) @@ -486,7 +486,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 0.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertNil(delegate.enactedBolusUnits) - XCTAssertNil(delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) } @@ -512,7 +512,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 0.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertNil(delegate.enactedBolusUnits) - XCTAssertNil(delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) } @@ -535,7 +535,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 1.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertEqual(1.0, delegate.enactedBolusUnits) - XCTAssertEqual(now, delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) } @@ -560,7 +560,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 1.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertEqual(1.0, delegate.enactedBolusUnits) - XCTAssertEqual(now, delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) } @@ -621,7 +621,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 1.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertEqual(1.0, delegate.enactedBolusUnits) - XCTAssertEqual(now, delegate.enactedBolusDate) + XCTAssertEqual(false, delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) } @@ -880,10 +880,10 @@ fileprivate class MockBolusEntryViewModelDelegate: BolusEntryViewModelDelegate { } var enactedBolusUnits: Double? - var enactedBolusDate: Date? - func enactBolus(units: Double, at startDate: Date, completion: @escaping (Error?) -> Void) { + var enactedBolusAutomatic: Bool? + func enactBolus(units: Double, automatic: Bool, completion: @escaping (Error?) -> Void) { enactedBolusUnits = units - enactedBolusDate = startDate + enactedBolusAutomatic = automatic } var getGlucoseSamplesResponse: [StoredGlucoseSample] = [] diff --git a/LoopTests/ViewModels/LoggedDoseViewModelTests.swift b/LoopTests/ViewModels/LoggedDoseViewModelTests.swift index 12c79f3e35..803c532283 100644 --- a/LoopTests/ViewModels/LoggedDoseViewModelTests.swift +++ b/LoopTests/ViewModels/LoggedDoseViewModelTests.swift @@ -97,10 +97,8 @@ fileprivate class MockLoggedDoseViewModelDelegate: LoggedDoseViewModelDelegate { } var enactedBolusUnits: Double? - var enactedBolusDate: Date? - func enactBolus(units: Double, at startDate: Date, completion: @escaping (Error?) -> Void) { + func enactBolus(units: Double, automatic: Bool, completion: @escaping (Error?) -> Void) { enactedBolusUnits = units - enactedBolusDate = startDate } var getGlucoseSamplesResponse: [StoredGlucoseSample] = [] diff --git a/LoopTests/ViewModels/SimpleBolusViewModelTests.swift b/LoopTests/ViewModels/SimpleBolusViewModelTests.swift index 32e7260560..eba3d13bca 100644 --- a/LoopTests/ViewModels/SimpleBolusViewModelTests.swift +++ b/LoopTests/ViewModels/SimpleBolusViewModelTests.swift @@ -21,7 +21,7 @@ class SimpleBolusViewModelTests: XCTestCase { var addedGlucose: [NewGlucoseSample] = [] var addedCarbEntry: NewCarbEntry? var storedBolusDecision: BolusDosingDecision? - var enactedBolus: (units: Double, startDate: Date)? + var enactedBolus: (units: Double, automatic: Bool)? var currentIOB: InsulinValue = SimpleBolusViewModelTests.noIOB var currentRecommendation: Double = 0 @@ -222,8 +222,8 @@ extension SimpleBolusViewModelTests: SimpleBolusViewModelDelegate { completion(.success(storedCarbEntry)) } - func enactBolus(units: Double, at startDate: Date) { - enactedBolus = (units: units, startDate: startDate) + func enactBolus(units: Double, automatic: Bool) { + enactedBolus = (units: units, automatic: automatic) } func insulinOnBoard(at date: Date, completion: @escaping (DoseStoreResult) -> Void) { diff --git a/WatchApp/DerivedAssets.xcassets/Contents.json b/WatchApp/DerivedAssets.xcassets/Contents.json index da4a164c91..73c00596a7 100644 --- a/WatchApp/DerivedAssets.xcassets/Contents.json +++ b/WatchApp/DerivedAssets.xcassets/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} From a0a6ced6ae223808b1e5906589b5608f54110a39 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Sun, 31 Jan 2021 15:17:11 -0600 Subject: [PATCH 2/2] Fix tests --- LoopTests/ViewModels/BolusEntryViewModelTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LoopTests/ViewModels/BolusEntryViewModelTests.swift b/LoopTests/ViewModels/BolusEntryViewModelTests.swift index dfff857db7..00cc301b8b 100644 --- a/LoopTests/ViewModels/BolusEntryViewModelTests.swift +++ b/LoopTests/ViewModels/BolusEntryViewModelTests.swift @@ -451,7 +451,7 @@ class BolusEntryViewModelTests: XCTestCase { authenticateOverrideCompletion(.failure(MockError())) XCTAssertNil(delegate.enactedBolusUnits) - XCTAssertEqual(false, delegate.enactedBolusAutomatic) + XCTAssertNil(delegate.enactedBolusAutomatic) XCTAssertFalse(success) XCTAssertTrue(delegate.glucoseSamplesAdded.isEmpty) XCTAssertTrue(delegate.carbEntriesAdded.isEmpty) @@ -486,7 +486,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 0.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertNil(delegate.enactedBolusUnits) - XCTAssertEqual(false, delegate.enactedBolusAutomatic) + XCTAssertNil(delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) } @@ -512,7 +512,7 @@ class BolusEntryViewModelTests: XCTestCase { requestedBolus: 0.0)) XCTAssertEqual(delegate.bolusDosingDecisionsAdded.first?.1, now) XCTAssertNil(delegate.enactedBolusUnits) - XCTAssertEqual(false, delegate.enactedBolusAutomatic) + XCTAssertNil(delegate.enactedBolusAutomatic) XCTAssertTrue(saveAndDeliverSuccess) }