From 7028add241c2ac3743c0293e5d8f37dbcb7ee96d Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Fri, 4 Aug 2023 17:18:45 -0400 Subject: [PATCH] call confirmReadyToOpenApp to allow reconnectApp to run --- .../PushNotification/backgroundRefresh/index.android.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/Notification/PushNotification/backgroundRefresh/index.android.js b/src/libs/Notification/PushNotification/backgroundRefresh/index.android.js index ac9822dd04dd..7bef99ad74a7 100644 --- a/src/libs/Notification/PushNotification/backgroundRefresh/index.android.js +++ b/src/libs/Notification/PushNotification/backgroundRefresh/index.android.js @@ -26,5 +26,11 @@ export default function backgroundRefresh() { return; } - getLastOnyxUpdateID().then((lastUpdateID) => App.reconnectApp(lastUpdateID)); + getLastOnyxUpdateID().then((lastUpdateID) => { + // ReconnectApp waits on our isReadyToOpenApp promise to resolve and this normally only resolves when the LHN is rendered. + // However, on Android this is run in the background using a HeadlessJS task (https://reactnative.dev/docs/headless-js-android) + // which does not render the React UI. So we must manually run confirmReadyToOpenApp here instead + App.confirmReadyToOpenApp(); + App.reconnectApp(lastUpdateID); + }); }