Changeset View
Changeset View
Standalone View
Standalone View
native/push/push-handler.react.js
Show All 31 Lines | import { | ||||
shouldSkipPushPermissionAlert, | shouldSkipPushPermissionAlert, | ||||
} from 'lib/utils/push-alerts.js'; | } from 'lib/utils/push-alerts.js'; | ||||
import sleep from 'lib/utils/sleep.js'; | import sleep from 'lib/utils/sleep.js'; | ||||
import { | import { | ||||
androidNotificationChannelID, | androidNotificationChannelID, | ||||
handleAndroidMessage, | handleAndroidMessage, | ||||
getCommAndroidNotificationsEventEmitter, | getCommAndroidNotificationsEventEmitter, | ||||
type AndroidForegroundMessage, | type AndroidMessage, | ||||
CommAndroidNotifications, | CommAndroidNotifications, | ||||
} from './android.js'; | } from './android.js'; | ||||
import { | import { | ||||
CommIOSNotification, | CommIOSNotification, | ||||
type CoreIOSNotificationData, | type CoreIOSNotificationData, | ||||
type CoreIOSNotificationDataWithRequestIdentifier, | type CoreIOSNotificationDataWithRequestIdentifier, | ||||
} from './comm-ios-notification.js'; | } from './comm-ios-notification.js'; | ||||
import InAppNotif from './in-app-notif.react.js'; | import InAppNotif from './in-app-notif.react.js'; | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | if (Platform.OS === 'ios') { | ||||
const commAndroidNotificationsEventEmitter = | const commAndroidNotificationsEventEmitter = | ||||
getCommAndroidNotificationsEventEmitter(); | getCommAndroidNotificationsEventEmitter(); | ||||
this.androidNotificationsEventSubscriptions.push( | this.androidNotificationsEventSubscriptions.push( | ||||
commAndroidNotificationsEventEmitter.addListener( | commAndroidNotificationsEventEmitter.addListener( | ||||
'commAndroidNotificationsToken', | 'commAndroidNotificationsToken', | ||||
this.handleAndroidDeviceToken, | this.handleAndroidDeviceToken, | ||||
), | ), | ||||
commAndroidNotificationsEventEmitter.addListener( | commAndroidNotificationsEventEmitter.addListener( | ||||
'commAndroidNotificationsForegroundMessage', | 'commAndroidNotificationsMessage', | ||||
this.androidMessageReceived, | this.androidMessageReceived, | ||||
), | ), | ||||
commAndroidNotificationsEventEmitter.addListener( | commAndroidNotificationsEventEmitter.addListener( | ||||
'commAndroidNotificationsNotificationOpened', | 'commAndroidNotificationsNotificationOpened', | ||||
this.androidNotificationOpened, | this.androidNotificationOpened, | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 381 Lines • ▼ Show 20 Lines | this.setState({ | ||||
onPress: () => { | onPress: () => { | ||||
InAppNotification.hide(); | InAppNotification.hide(); | ||||
this.onPressNotificationForThread(threadID, false); | this.onPressNotificationForThread(threadID, false); | ||||
}, | }, | ||||
}, | }, | ||||
}); | }); | ||||
} | } | ||||
androidNotificationOpened = async ( | androidNotificationOpened = async (notificationOpen: AndroidMessage) => { | ||||
notificationOpen: AndroidForegroundMessage, | |||||
) => { | |||||
this.onPushNotifBootsApp(); | this.onPushNotifBootsApp(); | ||||
const { threadID } = notificationOpen; | const { threadID } = notificationOpen; | ||||
this.onPressNotificationForThread(threadID, true); | this.onPressNotificationForThread(threadID, true); | ||||
}; | }; | ||||
androidMessageReceived = async (message: AndroidForegroundMessage) => { | androidMessageReceived = async (message: AndroidMessage) => { | ||||
this.onPushNotifBootsApp(); | this.onPushNotifBootsApp(); | ||||
const { messageInfos } = message; | const { messageInfos } = message; | ||||
this.saveMessageInfos(messageInfos); | this.saveMessageInfos(messageInfos); | ||||
handleAndroidMessage( | handleAndroidMessage( | ||||
message, | message, | ||||
this.props.updatesCurrentAsOf, | this.props.updatesCurrentAsOf, | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |