Skip to content

Commit 4117fcb

Browse files
committed
bugfix: fix heart range notifications not being delivered
1 parent c3822c1 commit 4117fcb

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

InfiniLink/Utils/NotificationManager.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,19 @@ extension NotificationManager {
114114
// MARK: Health
115115
extension NotificationManager {
116116
func sendHeartRangeNotification(_ bpm: Int) {
117-
let date = Date().formatted(.dateTime.hour().minute())
118117
let currentTime = Date().timeIntervalSince1970
119118

120-
// FIXME: closures are being executed, but notifications are not being sent
121-
122119
if bpm < minHeartRange, (currentTime - lastTimeMinHeartRangeNotified) >= (60 * 10) {
123120
self.bleWriteManager.sendNotification(
124-
AppNotification(title: NSLocalizedString("Heart Rate Low", comment: ""), subtitle: NSLocalizedString("Your heart rate fell below \(minHeartRange) BPM at \(date)", comment: ""))
121+
AppNotification(title: NSLocalizedString("Heart Rate Low", comment: ""), subtitle: NSLocalizedString("Your heart rate fell below \(minHeartRange) BPM", comment: ""))
125122
)
126123
self.lastTimeMinHeartRangeNotified = currentTime
127-
print("Triggered min check")
128124
}
129125
if bpm > maxHeartRange, (currentTime - lastTimeMaxHeartRangeNotified) >= (60 * 10) {
130126
self.bleWriteManager.sendNotification(
131-
AppNotification(title: NSLocalizedString("Heart Rate High", comment: ""), subtitle: NSLocalizedString("Your heart rate rose above \(maxHeartRange) BPM at \(date)", comment: ""))
127+
AppNotification(title: NSLocalizedString("Heart Rate High", comment: ""), subtitle: NSLocalizedString("Your heart rate rose above \(maxHeartRange)", comment: ""))
132128
)
133129
self.lastTimeMaxHeartRangeNotified = currentTime
134-
print("Triggered max check")
135130
}
136131
}
137132

0 commit comments

Comments
 (0)