Skip to content

Commit

Permalink
Merge pull request #31444 from software-mansion-labs/ts-migration/pus…
Browse files Browse the repository at this point in the history
…h-notification

[TS migration] Migrate 'PushNotification.js' lib to TypeScript
  • Loading branch information
blimpich authored Nov 20, 2023
2 parents cdb47b7 + 6316a02 commit 0913335
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 0913335

Please sign in to comment.