Skip to content

Commit f85d534

Browse files
authored
Fix Open Action not working for push in RN (#487)
1 parent 3b98e74 commit f85d534

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

AndroidSDKPush/src/main/java/com/leanplum/LeanplumPushService.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import androidx.annotation.NonNull;
3939
import androidx.annotation.WorkerThread;
4040
import com.leanplum.LeanplumActivityHelper.NoTrampolinesLifecycleCallbacks;
41+
import com.leanplum.callbacks.StartCallback;
4142
import com.leanplum.callbacks.VariablesChangedCallback;
4243
import com.leanplum.internal.ActionManager;
4344
import com.leanplum.internal.Constants;
@@ -534,7 +535,7 @@ static void openNotification(Context context, @NonNull Bundle notification) {
534535
context.startActivity(actionIntent);
535536
}
536537
// Post handles push notification.
537-
performPushNotificationAction(notification);
538+
performActionAfterIssuedStart(notification);
538539
}
539540

540541
/**
@@ -569,7 +570,7 @@ static void onActivityNotificationClick(@NonNull Bundle notification) {
569570
}
570571
return;
571572
}
572-
performPushNotificationAction(notification);
573+
performActionAfterIssuedStart(notification);
573574
}
574575
}
575576

@@ -633,7 +634,13 @@ public static void postHandlePushNotification(Context context, Intent intent) {
633634
Log.d("Could not post handle push notification, extras are null.");
634635
return;
635636
}
636-
performPushNotificationAction(notification);
637+
performActionAfterIssuedStart(notification);
638+
}
639+
640+
private static void performActionAfterIssuedStart(@NonNull Bundle notification) {
641+
LeanplumInternal.addStartIssuedHandler(() -> {
642+
performPushNotificationAction(notification);
643+
});
637644
}
638645

639646
private static void performPushNotificationAction(@NonNull Bundle notification) {

0 commit comments

Comments
 (0)