From 1229fc924558f1c57a651485c4030e0136255713 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 30 Dec 2025 14:33:25 +0430 Subject: [PATCH 1/2] fix(android): prevent crash when launching app from notification --- .../PushNotification/subscribeToPushNotifications.ts | 8 +++++++- src/types/modules/react-native.d.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts b/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts index 6ac700c66841..4aaf27b0a6b1 100644 --- a/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts +++ b/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts @@ -107,7 +107,13 @@ function applyOnyxData({reportID, onyxData, lastUpdateID, previousUpdateID, hasP */ return getLastUpdateIDAppliedToClient() .then((lastUpdateIDAppliedToClient) => applyOnyxUpdatesReliably(updates, {shouldRunSync: true, clientLastUpdateID: lastUpdateIDAppliedToClient})) - .then(() => NativeModules.PushNotificationBridge.finishBackgroundProcessing()); + .then(() => { + const bridge = NativeModules.PushNotificationBridge; + + if (bridge?.finishBackgroundProcessing) { + bridge.finishBackgroundProcessing(); + } + }); } function navigateToReport({reportID}: PushNotificationData): Promise { diff --git a/src/types/modules/react-native.d.ts b/src/types/modules/react-native.d.ts index 32f594e54cc6..2678d9dcb1f8 100644 --- a/src/types/modules/react-native.d.ts +++ b/src/types/modules/react-native.d.ts @@ -64,7 +64,7 @@ declare module 'react-native' { ShortcutManager: ShortcutManagerModule; ShareActionHandler: ShareActionHandlerModule; TestToolsBridge: TestToolsBridge; - PushNotificationBridge: PushNotificationBridge; + PushNotificationBridge?: PushNotificationBridge; } namespace Animated { From ed5cf83b1f02d3abe02e69e16251811b862fa922 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 30 Dec 2025 20:27:09 +0430 Subject: [PATCH 2/2] refactor feedback applied --- .../PushNotification/subscribeToPushNotifications.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts b/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts index 4aaf27b0a6b1..bae1548cc5f6 100644 --- a/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts +++ b/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts @@ -107,13 +107,7 @@ function applyOnyxData({reportID, onyxData, lastUpdateID, previousUpdateID, hasP */ return getLastUpdateIDAppliedToClient() .then((lastUpdateIDAppliedToClient) => applyOnyxUpdatesReliably(updates, {shouldRunSync: true, clientLastUpdateID: lastUpdateIDAppliedToClient})) - .then(() => { - const bridge = NativeModules.PushNotificationBridge; - - if (bridge?.finishBackgroundProcessing) { - bridge.finishBackgroundProcessing(); - } - }); + .then(() => NativeModules.PushNotificationBridge?.finishBackgroundProcessing()); } function navigateToReport({reportID}: PushNotificationData): Promise {