Fix: Target reminder with correct id

This commit is contained in:
BloodyMarie
2022-04-10 22:59:48 +02:00
parent 2a49e43065
commit 16d2afaf1e
+5 -3
View File
@@ -9,7 +9,7 @@ import nothingChanged from '../db/db-unchanged'
export default function setupNotifications(navigate) {
Notification.configure({
onNotification: (notification) => {
if (notification.id === '1') {
if (notification.data.id === '11' || notification.id === '1') {
navigate('TemperatureEditView')
} else {
navigate('Home')
@@ -18,7 +18,7 @@ export default function setupNotifications(navigate) {
})
tempReminderObservable(reminder => {
Notification.cancelLocalNotifications({id: '1'})
Notification.cancelLocalNotifications({id: '11'})
if (reminder.enabled) {
const [hours, minutes] = reminder.time.split(':')
let target = new Moment()
@@ -32,6 +32,7 @@ export default function setupNotifications(navigate) {
Notification.localNotificationSchedule({
id: '1',
userInfo: { id: '11' },
message: labels.tempReminder.notification,
date: target.toDate(),
vibrate: false,
@@ -41,7 +42,7 @@ export default function setupNotifications(navigate) {
}, false)
periodReminderObservable(reminder => {
Notification.cancelLocalNotifications({id: '2'})
Notification.cancelLocalNotifications({id: '22'})
if (reminder.enabled) setupPeriodReminder()
}, false)
@@ -71,6 +72,7 @@ function setupPeriodReminder() {
Notification.localNotificationSchedule({
id: '2',
userInfo: { id: '22' },
message: labels.periodReminder.notification(daysToEndOfPrediction),
date: reminderDate.toDate(),
vibrate: false