@@ -61,25 +61,13 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
6161 final IPushNotificationsDrawer notificationsDrawer = PushNotificationsDrawer .get (mApplication .getApplicationContext ());
6262 notificationsDrawer .onNewActivity (activity );
6363
64- Intent intent = activity .getIntent ();
65- if (NotificationIntentAdapter .canHandleIntent (intent )) {
66- Bundle notificationData = android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .R ?
67- NotificationIntentAdapter .extractPendingNotificationDataFromIntent (intent ) : intent .getExtras ();
68- final IPushNotification pushNotification = PushNotification .get (mApplication .getApplicationContext (), notificationData );
69- if (pushNotification != null ) {
70- pushNotification .onOpened ();
71- }
72- }
64+ callOnOpenedIfNeed (activity );
7365 }
7466
7567 @ Override
7668 public void onActivityStarted (Activity activity ) {
77- Bundle bundle = activity .getIntent ().getExtras ();
78- if (bundle != null ) {
79- PushNotificationProps props = new PushNotificationProps (bundle );
80- if (props .isFirebaseBackgroundPayload ()) {
81- InitialNotificationHolder .getInstance ().set (props );
82- }
69+ if (InitialNotificationHolder .getInstance ().get () == null ) {
70+ callOnOpenedIfNeed (activity );
8371 }
8472 }
8573
@@ -102,4 +90,16 @@ public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
10290 @ Override
10391 public void onActivityDestroyed (Activity activity ) {
10492 }
93+
94+ private void callOnOpenedIfNeed (Activity activity ) {
95+ Intent intent = activity .getIntent ();
96+ if (NotificationIntentAdapter .canHandleIntent (intent )) {
97+ Bundle notificationData = android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .R ?
98+ NotificationIntentAdapter .extractPendingNotificationDataFromIntent (intent ) : intent .getExtras ();
99+ final IPushNotification pushNotification = PushNotification .get (mApplication .getApplicationContext (), notificationData );
100+ if (pushNotification != null ) {
101+ pushNotification .onOpened ();
102+ }
103+ }
104+ }
105105}
0 commit comments