Skip to content

Commit 23cc934

Browse files
committed
rm waiting on params network call on notifi open
This fixes a bug where the app would not be brought to the foreground when tapping on a notification if the app could not connect to onesignal.com or was offline during the full life time of the app process. This also fixes another a compatibility issue with Xiaomi devices where the app would not foreground if the app process was dead and also no task exists in the recent list. It is critical we don't wait for a network call for the notification open logic this method does the work to bring the app to the foreground. This get params network call isn't needed before we handle the notification open logic anyway. This network wait was present in 4.0.0 through 4.4.x but was not an issue in 4.5.0 when a "Reverse Activity Trampoline" was setup. However in PR #1581 we are switching back to a standard Activity Trampoline and we don't want to reintroduce this bug. A failing test was added for this in a previous commit, which now passes.
1 parent 89fb595 commit 23cc934

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,22 +2395,6 @@ static void fireForegroundHandlers(OSNotificationController notificationControll
23952395
* Method called when opening a notification
23962396
*/
23972397
static void handleNotificationOpen(final Activity context, final JSONArray data, @Nullable final String notificationId) {
2398-
// Delay call until remote params are set
2399-
if (taskRemoteController.shouldQueueTaskForInit(OSTaskRemoteController.HANDLE_NOTIFICATION_OPEN)) {
2400-
logger.error("Waiting for remote params. " +
2401-
"Moving " + OSTaskRemoteController.HANDLE_NOTIFICATION_OPEN + " operation to a pending queue.");
2402-
taskRemoteController.addTaskToQueue(new Runnable() {
2403-
@Override
2404-
public void run() {
2405-
if (appContext != null) {
2406-
logger.debug("Running " + OSTaskRemoteController.HANDLE_NOTIFICATION_OPEN + " operation from pending queue.");
2407-
handleNotificationOpen(context, data, notificationId);
2408-
}
2409-
}
2410-
});
2411-
return;
2412-
}
2413-
24142398
// If applicable, check if the user provided privacy consent
24152399
if (shouldLogUserPrivacyConsentErrorMessageForMethodName(null))
24162400
return;

0 commit comments

Comments
 (0)