@@ -61,25 +61,13 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
61
61
final IPushNotificationsDrawer notificationsDrawer = PushNotificationsDrawer .get (mApplication .getApplicationContext ());
62
62
notificationsDrawer .onNewActivity (activity );
63
63
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 );
73
65
}
74
66
75
67
@ Override
76
68
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 );
83
71
}
84
72
}
85
73
@@ -102,4 +90,16 @@ public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
102
90
@ Override
103
91
public void onActivityDestroyed (Activity activity ) {
104
92
}
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
+ }
105
105
}
0 commit comments