Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
FC8D0BDACEFE2E545E2605E1 /* DeviceDataManagerTherapyProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACB490099D0931F6B695C39E /* DeviceDataManagerTherapyProfileTests.swift */; };
2E3F5FD7B369167E41E59667 /* DeviceDataManagerScheduledProfileSwitchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF676119621CDFDD638367 /* DeviceDataManagerScheduledProfileSwitchTests.swift */; };
101AA7370B0E499FBD88BB9F /* G7SensorKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F8760AF31E3C43F6AFBA1BE7 /* G7SensorKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
921B7FAE002E40EFAB3F50C6 /* G7SensorKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8760AF31E3C43F6AFBA1BE7 /* G7SensorKit.framework */; };
52CB9A826E3B3DFC4E483084 /* AlgorithmBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36421A4B9676EF68CDDC4ECD /* AlgorithmBridge.swift */; };
Expand Down Expand Up @@ -892,6 +894,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
ACB490099D0931F6B695C39E /* DeviceDataManagerTherapyProfileTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceDataManagerTherapyProfileTests.swift; sourceTree = "<group>"; };
0AFF676119621CDFDD638367 /* DeviceDataManagerScheduledProfileSwitchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceDataManagerScheduledProfileSwitchTests.swift; sourceTree = "<group>"; };
F8760AF31E3C43F6AFBA1BE7 /* G7SensorKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = G7SensorKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
00A28F30399B460CABF4EDD2 /* SettingsProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsProvider.swift; sourceTree = "<group>"; };
0FC34B523FE5A50C920506D5 /* Loop/Resources/Sounds/alarm.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Loop/Resources/Sounds/alarm.caf; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -1824,6 +1828,8 @@
C16575722538AFF6004AE16E /* CGMStalenessMonitorTests.swift */,
A91E4C2224F86F1000BE9213 /* CriticalEventLogExportManagerTests.swift */,
C188599A2AF15E1B0010F21F /* DeviceDataManagerTests.swift */,
ACB490099D0931F6B695C39E /* DeviceDataManagerTherapyProfileTests.swift */,
0AFF676119621CDFDD638367 /* DeviceDataManagerScheduledProfileSwitchTests.swift */,
C16B983F26B4898800256B05 /* DoseEnactorTests.swift */,
E9C58A7124DB489100487A17 /* LoopDataManagerTests.swift */,
A1B2C3D40000000000000001 /* GlucoseAlertManagerTests.swift */,
Expand Down Expand Up @@ -4192,6 +4198,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FC8D0BDACEFE2E545E2605E1 /* DeviceDataManagerTherapyProfileTests.swift in Sources */,
2E3F5FD7B369167E41E59667 /* DeviceDataManagerScheduledProfileSwitchTests.swift in Sources */,
A9DF02CB24F72B9E00B7C988 /* CriticalEventLogTests.swift in Sources */,
1D80313D24746274002810DF /* AlertStoreTests.swift in Sources */,
C1777A6625A125F100595963 /* ManualEntryDoseViewModelTests.swift in Sources */,
Expand Down
36 changes: 29 additions & 7 deletions Loop/Extensions/SettingsStore+SimulatedCoreData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ extension SettingsStore {

while startDate < endDate {
for index in 0..<simulatedPerDay {
simulated.append(StoredSettings.simulated(date: startDate.addingTimeInterval(.hours(24) * Double(index) / Double(simulatedPerDay))))
// The second settings of each day switch to the Exercise profile.
simulated.append(StoredSettings.simulated(date: startDate.addingTimeInterval(.hours(24) * Double(index) / Double(simulatedPerDay)),
activeProfileName: index % 2 == 1 ? "Exercise" : nil))
}

if simulated.count >= simulatedLimit {
Expand All @@ -45,7 +47,7 @@ extension SettingsStore {
}

fileprivate extension StoredSettings {
static func simulated(date: Date) -> StoredSettings {
static func simulated(date: Date, activeProfileName: String?) -> StoredSettings {
let controllerTimeZone = TimeZone(identifier: "America/Los_Angeles")!
let scheduleTimeZone = TimeZone(secondsFromGMT: TimeZone(identifier: "America/Phoenix")!.secondsFromGMT())!
let glucoseTargetRangeSchedule = GlucoseRangeSchedule(rangeSchedule: DailyQuantitySchedule(unit: .milligramsPerDeciliter,
Expand Down Expand Up @@ -90,6 +92,24 @@ fileprivate extension StoredSettings {
RepeatingScheduleValue(startTime: .hours(18), value: 8.0),
RepeatingScheduleValue(startTime: .hours(21), value: 10.0)],
timeZone: scheduleTimeZone)
let defaultProfile = TherapyProfile(name: TherapyProfile.defaultName,
glucoseTargetRangeSchedule: glucoseTargetRangeSchedule,
carbRatioSchedule: carbRatioSchedule!,
basalRateSchedule: basalRateSchedule!,
insulinSensitivitySchedule: insulinSensitivitySchedule!)
let exerciseProfile = TherapyProfile(name: "Exercise",
glucoseTargetRangeSchedule: GlucoseRangeSchedule(unit: .milligramsPerDeciliter,
dailyItems: [RepeatingScheduleValue(startTime: .hours(0), value: DoubleRange(minValue: 120.0, maxValue: 130.0))],
timeZone: scheduleTimeZone)!,
carbRatioSchedule: CarbRatioSchedule(unit: .gram,
dailyItems: [RepeatingScheduleValue(startTime: .hours(0), value: 14.0)],
timeZone: scheduleTimeZone)!,
basalRateSchedule: BasalRateSchedule(dailyItems: [RepeatingScheduleValue(startTime: .hours(0), value: 0.75)],
timeZone: scheduleTimeZone)!,
insulinSensitivitySchedule: InsulinSensitivitySchedule(unit: .milligramsPerDeciliter,
dailyItems: [RepeatingScheduleValue(startTime: .hours(0), value: 60.0)],
timeZone: scheduleTimeZone)!)
let activeProfile = activeProfileName == exerciseProfile.name ? exerciseProfile : defaultProfile
let notificationSettings = NotificationSettings(authorizationStatus: .authorized,
soundSetting: .enabled,
badgeSetting: .enabled,
Expand Down Expand Up @@ -129,7 +149,7 @@ fileprivate extension StoredSettings {
return StoredSettings(date: date,
controllerTimeZone: controllerTimeZone,
dosingEnabled: true,
glucoseTargetRangeSchedule: glucoseTargetRangeSchedule,
glucoseTargetRangeSchedule: activeProfile.glucoseTargetRangeSchedule,
preMealTargetRange: DoubleRange(minValue: 80.0, maxValue: 90.0).quantityRange(for: .milligramsPerDeciliter),
overridePresets: [],
maximumBasalRatePerHour: 3.5,
Expand All @@ -138,13 +158,15 @@ fileprivate extension StoredSettings {
deviceToken: UUID().uuidString,
insulinType: .humalog,
defaultRapidActingModel: StoredInsulinModel(ExponentialInsulinModelPreset.rapidActingAdult),
basalRateSchedule: basalRateSchedule,
insulinSensitivitySchedule: insulinSensitivitySchedule,
carbRatioSchedule: carbRatioSchedule,
basalRateSchedule: activeProfile.basalRateSchedule,
insulinSensitivitySchedule: activeProfile.insulinSensitivitySchedule,
carbRatioSchedule: activeProfile.carbRatioSchedule,
notificationSettings: notificationSettings,
controllerDevice: controllerDevice,
cgmDevice: cgmDevice,
pumpDevice: pumpDevice,
bloodGlucoseUnit: .milligramsPerDeciliter)
bloodGlucoseUnit: .milligramsPerDeciliter,
therapyProfiles: [defaultProfile, exerciseProfile],
activeProfileName: activeProfileName)
}
}
87 changes: 87 additions & 0 deletions Loop/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,54 @@
},
" -" : {

},
"%1$@ (paused)" : {
"comment" : "A paused scheduled switch in a notification (1: scheduled switch)"
},
"%1$d scheduled switches removed" : {
"comment" : "Remote profile delete notification: scheduled switches to the deleted profile were removed (1: number of scheduled switches)"
},
"%1$d starts paused" : {
"comment" : "Status screen: scheduled profile starts are paused (1: number of paused starts)"
},
"1 start paused" : {
"comment" : "Status screen: one scheduled profile start is paused"
},
"All scheduled switches were removed remotely" : {
"comment" : "Remote scheduled switches notification when the list was cleared"
},
"all starts paused" : {
"comment" : "Status screen: every scheduled profile start is paused"
},
"It is more than %1$d hours late." : {
"comment" : "Reason a scheduled profile switch did not run: too late (1: hours)"
},
"Loop has not been able to switch to %1$@ as scheduled at %2$@. Open Loop." : {
"comment" : "Alert body when a scheduled profile switch has not run (1: profile name, 2: time)"
},
"Loop switched to %1$@ as scheduled (%2$@)." : {
"comment" : "Notification body of a scheduled profile switch (1: profile name, 2: scheduled time)"
},
"Loop switched to %1$@, scheduled for %2$@, at %3$@." : {
"comment" : "Notification body of a late scheduled profile switch (1: profile name, 2: scheduled time, 3: time of the switch)"
},
"Profile Not Switched" : {
"comment" : "Title of the alerts about a scheduled profile switch that did not run"
},
"Profile Switched" : {
"comment" : "The notification title for a scheduled profile switch"
},
"Scheduled switches changed remotely: %1$@" : {
"comment" : "Remote scheduled switches notification (1: the scheduled switches)"
},
"Scheduled switches not saved: %1$@" : {
"comment" : "Remote scheduled switches failure notification (1: reason)"
},
"The scheduled switch to %1$@ (%2$@) did not happen: %3$@" : {
"comment" : "Alert body when a scheduled profile switch did not run (1: profile name, 2: weekday and time, 3: reason)"
},
"until %1$@ starts %2$@ %3$@" : {
"comment" : "Status screen: the next scheduled profile start (1: profile name, 2: short weekday, 3: time)"
},
" - " : {

Expand Down Expand Up @@ -2239,6 +2287,9 @@
}
}
},
"%1$@ of profile %2$@" : {
"comment" : "Setup change item for a therapy setting of a therapy profile (1: setting name, 2: profile name)"
},
"%1$@ Still Active" : {
"comment" : "The format title for the preset still active alert. (1: preset name)"
},
Expand Down Expand Up @@ -5315,6 +5366,9 @@
}
}
},
"Active: %1$@" : {
"comment" : "Descriptive text for Profiles (1: active profile name)"
},
"Add a new favorite food" : {
"comment" : "Button label to open new favorite food view",
"localizations" : {
Expand Down Expand Up @@ -30747,6 +30801,24 @@
},
"Presets for Illness" : {

},
"Profile '%1$@' activated" : {
"comment" : "Remote profile switch notification (1: profile name)"
},
"Profile '%1$@' deleted" : {
"comment" : "Remote profile delete notification (1: profile name)"
},
"Profile '%1$@' not activated: %2$@" : {
"comment" : "Remote profile switch failure notification (1: profile name, 2: reason)"
},
"Profile '%1$@' not deleted: %2$@" : {
"comment" : "Remote profile delete failure notification (1: profile name, 2: reason)"
},
"Profile '%1$@' not saved: %2$@" : {
"comment" : "Remote profile save failure notification (1: profile name, 2: reason)"
},
"Profile '%1$@' saved" : {
"comment" : "Remote profile save notification (1: profile name)"
},
"Profile Expiration" : {
"comment" : "Settings App Profile expiration view",
Expand Down Expand Up @@ -31013,6 +31085,15 @@
"comment" : "The title of the text field where the user can set the name of a glucose alert profile.",
"isCommentAutoGenerated" : true
},
"Profile: %1$@" : {
"comment" : "Status screen label naming the active therapy profile (1: profile name)"
},
"Profiles" : {
"comment" : "Title text for button to Profiles"
},
"Profiles are not available" : {
"comment" : "Therapy profile action error description: no profile handler."
},
"Pump" : {
"comment" : "The title of the pump section in settings",
"extractionState" : "manual",
Expand Down Expand Up @@ -32822,6 +32903,9 @@
}
}
},
"Remote Profile Command" : {
"comment" : "The notification title for a remote therapy profile command"
},
"Repeat every" : {
"comment" : "A label describing the option to change how often a glucose alert will repeat.",
"isCommentAutoGenerated" : true
Expand Down Expand Up @@ -35413,6 +35497,9 @@
}
}
},
"Switched to profile %1$@ (from %2$@)" : {
"comment" : "Setup change item for a switch of therapy profile (1: profile switched to, 2: profile switched from)"
},
"Tap “Apps”." : {
"comment" : "Focus modes step 3"
},
Expand Down
Loading