Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,13 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
final IPushNotificationsDrawer notificationsDrawer = PushNotificationsDrawer.get(mApplication.getApplicationContext());
notificationsDrawer.onNewActivity(activity);

Intent intent = activity.getIntent();
if (NotificationIntentAdapter.canHandleIntent(intent)) {
Bundle notificationData = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R ?
NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent) : intent.getExtras();
final IPushNotification pushNotification = PushNotification.get(mApplication.getApplicationContext(), notificationData);
if (pushNotification != null) {
pushNotification.onOpened();
}
}
callOnOpenedIfNeed(activity);
}

@Override
public void onActivityStarted(Activity activity) {
Bundle bundle = activity.getIntent().getExtras();
if (bundle != null) {
PushNotificationProps props = new PushNotificationProps(bundle);
if (props.isFirebaseBackgroundPayload()) {
InitialNotificationHolder.getInstance().set(props);
}
if (InitialNotificationHolder.getInstance().get() == null) {
callOnOpenedIfNeed(activity);
}
}

Expand All @@ -102,4 +90,16 @@ public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
@Override
public void onActivityDestroyed(Activity activity) {
}

private void callOnOpenedIfNeed(Activity activity) {
Intent intent = activity.getIntent();
if (NotificationIntentAdapter.canHandleIntent(intent)) {
Bundle notificationData = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R ?
NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent) : intent.getExtras();
final IPushNotification pushNotification = PushNotification.get(mApplication.getApplicationContext(), notificationData);
if (pushNotification != null) {
pushNotification.onOpened();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.wix.reactnativenotifications.core.InitialNotificationHolder;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
import com.wix.reactnativenotifications.core.ProxyService;

import static com.wix.reactnativenotifications.Defs.NOTIFICATION_OPENED_EVENT_NAME;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_RECEIVED_EVENT_NAME;
Expand Down