Skip to content

Commit 91cb7d4

Browse files
committed
Merge remote-tracking branch 'origin/dev' into ps2/LOOP-4371/diy-sync
2 parents 07e0b6d + e2e063b commit 91cb7d4

File tree

9 files changed

+345
-135
lines changed

9 files changed

+345
-135
lines changed

Loop.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@
427427
B40D07C7251A89D500C1C6D7 /* GlucoseDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40D07C6251A89D500C1C6D7 /* GlucoseDisplay.swift */; };
428428
B42C951424A3C76000857C73 /* CGMStatusHUDViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B42C951324A3C76000857C73 /* CGMStatusHUDViewModel.swift */; };
429429
B42D124328D371C400E43D22 /* AlertMuter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B42D124228D371C400E43D22 /* AlertMuter.swift */; };
430+
B43CF07E29434EC4008A520B /* HowMuteAlertWorkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B43CF07D29434EC4008A520B /* HowMuteAlertWorkView.swift */; };
430431
B43DA44124D9C12100CAFF4E /* DismissibleHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B43DA44024D9C12100CAFF4E /* DismissibleHostingController.swift */; };
431432
B44251B3252350CE00605937 /* ChartAxisValuesStaticGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44251B2252350CE00605937 /* ChartAxisValuesStaticGeneratorTests.swift */; };
432433
B44251B62523578300605937 /* PredictedGlucoseChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44251B52523578300605937 /* PredictedGlucoseChartTests.swift */; };
@@ -1412,6 +1413,7 @@
14121413
B40D07C6251A89D500C1C6D7 /* GlucoseDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseDisplay.swift; sourceTree = "<group>"; };
14131414
B42C951324A3C76000857C73 /* CGMStatusHUDViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGMStatusHUDViewModel.swift; sourceTree = "<group>"; };
14141415
B42D124228D371C400E43D22 /* AlertMuter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertMuter.swift; sourceTree = "<group>"; };
1416+
B43CF07D29434EC4008A520B /* HowMuteAlertWorkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HowMuteAlertWorkView.swift; sourceTree = "<group>"; };
14151417
B43DA44024D9C12100CAFF4E /* DismissibleHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DismissibleHostingController.swift; sourceTree = "<group>"; };
14161418
B44251B2252350CE00605937 /* ChartAxisValuesStaticGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartAxisValuesStaticGeneratorTests.swift; sourceTree = "<group>"; };
14171419
B44251B52523578300605937 /* PredictedGlucoseChartTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PredictedGlucoseChartTests.swift; sourceTree = "<group>"; };
@@ -2203,6 +2205,7 @@
22032205
A9A056B224B93C62007CF06D /* CriticalEventLogExportView.swift */,
22042206
C191D2A025B3ACAA00C26C0B /* DosingStrategySelectionView.swift */,
22052207
43D381611EBD9759007F8C8F /* HeaderValuesTableViewCell.swift */,
2208+
B43CF07D29434EC4008A520B /* HowMuteAlertWorkView.swift */,
22062209
430D85881F44037000AF2D4F /* HUDViewTableViewCell.swift */,
22072210
A91D2A3E26CF0FF80023B075 /* IconTitleSubtitleTableViewCell.swift */,
22082211
C1742331259BEADC00399C9D /* ManualEntryDoseView.swift */,
@@ -3667,6 +3670,7 @@
36673670
4FC8C8011DEB93E400A1452E /* NSUserDefaults+StatusExtension.swift in Sources */,
36683671
43E93FB61E469A4000EAB8DB /* NumberFormatter.swift in Sources */,
36693672
C1FB428C217806A400FAB378 /* StateColorPalette.swift in Sources */,
3673+
B43CF07E29434EC4008A520B /* HowMuteAlertWorkView.swift in Sources */,
36703674
1D6B1B6726866D89009AC446 /* AlertPermissionsChecker.swift in Sources */,
36713675
4F08DE8F1E7BB871006741EA /* CollectionType+Loop.swift in Sources */,
36723676
A9F703772489D8AA00C98AD8 /* PersistentDeviceLog+SimulatedCoreData.swift in Sources */,

Loop/Base.lproj/Main.storyboard

Lines changed: 42 additions & 69 deletions
Large diffs are not rendered by default.

Loop/Managers/AlertMuter.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ public class AlertMuter: ObservableObject {
5454
}
5555

5656
func shouldMuteAlert(scheduledAt timeFromNow: TimeInterval = 0, now: Date = Date()) -> Bool {
57-
guard timeFromNow >= 0 else { return false }
58-
5957
guard let mutingEndTime = mutingEndTime else { return false }
6058

6159
let alertTriggerTime = now.advanced(by: timeFromNow)
62-
guard alertTriggerTime < mutingEndTime
60+
guard let startTime = startTime,
61+
alertTriggerTime >= startTime,
62+
alertTriggerTime < mutingEndTime
6363
else { return false }
6464

6565
return true
@@ -125,4 +125,16 @@ public class AlertMuter: ObservableObject {
125125
return shouldMuteAlert(scheduledAt: triggerInterval)
126126
}
127127
}
128+
129+
func unmuteAlerts() {
130+
configuration.startTime = nil
131+
}
132+
133+
var formattedEndTime: String {
134+
guard let endTime = configuration.mutingEndTime else { return NSLocalizedString("Unknown", comment: "result when time cannot be formatted") }
135+
let formatter = DateFormatter()
136+
formatter.timeStyle = .short
137+
formatter.dateStyle = .none
138+
return formatter.string(from: endTime)
139+
}
128140
}

0 commit comments

Comments
 (0)