diff --git a/src/libs/actions/PushNotification.js b/src/libs/actions/PushNotification.ts similarity index 84% rename from src/libs/actions/PushNotification.js rename to src/libs/actions/PushNotification.ts index 7abbd7b94ba0..888892fdc188 100644 --- a/src/libs/actions/PushNotification.js +++ b/src/libs/actions/PushNotification.ts @@ -6,15 +6,18 @@ import * as Device from './Device'; let isUserOptedInToPushNotifications = false; Onyx.connect({ key: ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED, - callback: (val) => (isUserOptedInToPushNotifications = val), + callback: (value) => { + if (value === null) { + return; + } + isUserOptedInToPushNotifications = value; + }, }); /** * Record that user opted-in or opted-out of push notifications on the current device. - * - * @param {Boolean} isOptingIn */ -function setPushNotificationOptInStatus(isOptingIn) { +function setPushNotificationOptInStatus(isOptingIn: boolean) { Device.getDeviceID().then((deviceID) => { const commandName = isOptingIn ? 'OptInToPushNotifications' : 'OptOutOfPushNotifications'; const optimisticData = [