Fix: Target reminder with correct id
This commit is contained in:
@@ -9,7 +9,7 @@ import nothingChanged from '../db/db-unchanged'
|
|||||||
export default function setupNotifications(navigate) {
|
export default function setupNotifications(navigate) {
|
||||||
Notification.configure({
|
Notification.configure({
|
||||||
onNotification: (notification) => {
|
onNotification: (notification) => {
|
||||||
if (notification.id === '1') {
|
if (notification.data.id === '11' || notification.id === '1') {
|
||||||
navigate('TemperatureEditView')
|
navigate('TemperatureEditView')
|
||||||
} else {
|
} else {
|
||||||
navigate('Home')
|
navigate('Home')
|
||||||
@@ -18,7 +18,7 @@ export default function setupNotifications(navigate) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
tempReminderObservable(reminder => {
|
tempReminderObservable(reminder => {
|
||||||
Notification.cancelLocalNotifications({id: '1'})
|
Notification.cancelLocalNotifications({id: '11'})
|
||||||
if (reminder.enabled) {
|
if (reminder.enabled) {
|
||||||
const [hours, minutes] = reminder.time.split(':')
|
const [hours, minutes] = reminder.time.split(':')
|
||||||
let target = new Moment()
|
let target = new Moment()
|
||||||
@@ -32,6 +32,7 @@ export default function setupNotifications(navigate) {
|
|||||||
|
|
||||||
Notification.localNotificationSchedule({
|
Notification.localNotificationSchedule({
|
||||||
id: '1',
|
id: '1',
|
||||||
|
userInfo: { id: '11' },
|
||||||
message: labels.tempReminder.notification,
|
message: labels.tempReminder.notification,
|
||||||
date: target.toDate(),
|
date: target.toDate(),
|
||||||
vibrate: false,
|
vibrate: false,
|
||||||
@@ -41,7 +42,7 @@ export default function setupNotifications(navigate) {
|
|||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
periodReminderObservable(reminder => {
|
periodReminderObservable(reminder => {
|
||||||
Notification.cancelLocalNotifications({id: '2'})
|
Notification.cancelLocalNotifications({id: '22'})
|
||||||
if (reminder.enabled) setupPeriodReminder()
|
if (reminder.enabled) setupPeriodReminder()
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@ function setupPeriodReminder() {
|
|||||||
|
|
||||||
Notification.localNotificationSchedule({
|
Notification.localNotificationSchedule({
|
||||||
id: '2',
|
id: '2',
|
||||||
|
userInfo: { id: '22' },
|
||||||
message: labels.periodReminder.notification(daysToEndOfPrediction),
|
message: labels.periodReminder.notification(daysToEndOfPrediction),
|
||||||
date: reminderDate.toDate(),
|
date: reminderDate.toDate(),
|
||||||
vibrate: false
|
vibrate: false
|
||||||
|
|||||||
Reference in New Issue
Block a user