Skip to content

Commit

Permalink
Merge pull request #4160 from Expensify/horus-remove-notification-bad…
Browse files Browse the repository at this point in the history
…ge-icon

Clear push notifications when logging out
  • Loading branch information
madmax330 authored Jul 22, 2021
2 parents ed33dcb + dc0f373 commit c9c2ee9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Expensify.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class Expensify extends PureComponent {
// boot screen right away
if (!this.getAuthToken()) {
this.hideSplash();

// In case of a crash that led to disconnection, we want to remove all the push notifications.
PushNotification.clearNotifications();
}

this.setState({isOnyxMigrated: true});
Expand Down
1 change: 1 addition & 0 deletions src/libs/Notification/PushNotification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export default {
onReceived: () => {},
onSelected: () => {},
TYPE: NotificationType,
clearNotifications: () => {},
};
8 changes: 8 additions & 0 deletions src/libs/Notification/PushNotification/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,18 @@ function onSelected(notificationType, callback) {
bind(notificationType, callback, EventType.NotificationResponse);
}

/**
* Clear all push notifications
*/
function clearNotifications() {
UrbanAirship.clearNotifications();
}

export default {
register,
deregister,
onReceived,
onSelected,
TYPE: NotificationType,
clearNotifications,
};
1 change: 1 addition & 0 deletions src/libs/actions/SignInRedirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Onyx.connect({
function redirectToSignIn(errorMessage) {
UnreadIndicatorUpdater.stopListeningForReportChanges();
PushNotification.deregister();
PushNotification.clearNotifications();
Pusher.disconnect();
Timers.clearAll();

Expand Down

0 comments on commit c9c2ee9

Please sign in to comment.