506: Review changes.

This commit is contained in:
Hannelore Meier
2024-10-02 15:29:29 +02:00
parent dddb095463
commit 79b268fe4c
7 changed files with 22 additions and 14 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ import {
advanceNoticeDaysObservable,
} from '../local-storage'
import * as PN from 'react-native-push-notification'
import { requestNotifications } from 'react-native-permissions'
import Moment from 'moment'
import { LocalDate } from '@js-joda/core'
@@ -19,6 +20,11 @@ const PERIOD_REMINDER_ID = '2'
const PushNotification = Platform.OS === 'ios' ? PN : PN.default
export default function setupNotifications(navigate, setDate) {
// for Android, this method call is necessary
if (Platform.OS === 'android') {
requestNotifications()
}
PushNotification.createChannel({
channelId: DRIP_CHANNEL_ID, // (required)
channelName: 'drip reminder', // (required)
@@ -99,7 +105,7 @@ function schedulePeriodNotification() {
'YYYY-MM-DD'
)
const advanceNoticeDays = parseInt(advanceNoticeDaysObservable.value, 10)
const advanceNoticeDays = parseInt(advanceNoticeDaysObservable.value)
// ${advanceNoticeDays} days before and at 6 am
const reminderDate = predictedBleedingStart