@imatis/react-native-notifications 4.3.3-imatis.10 → 4.3.3-imatis.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,7 +63,7 @@ public class RNNotificationsModule extends ReactContextBaseJavaModule implements
63
63
  @Override
64
64
  public void onNewIntent(Intent intent) {
65
65
  if (NotificationIntentAdapter.canHandleIntent(intent)) {
66
- Bundle notificationData = NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
66
+ Bundle notificationData = intent.getExtras();
67
67
  final IPushNotification notification = PushNotification.get(getReactApplicationContext().getApplicationContext(), notificationData);
68
68
  if (notification != null) {
69
69
  notification.onOpened();
@@ -19,7 +19,6 @@ import com.wix.reactnativenotifications.core.notification.IPushNotification;
19
19
  import com.wix.reactnativenotifications.core.notification.PushNotification;
20
20
  import com.wix.reactnativenotifications.core.notificationdrawer.IPushNotificationsDrawer;
21
21
  import com.wix.reactnativenotifications.core.notificationdrawer.PushNotificationsDrawer;
22
- import com.wix.reactnativenotifications.core.ReactAppLifecycleFacade;
23
22
 
24
23
  import java.util.Arrays;
25
24
  import java.util.Collections;
@@ -67,12 +66,7 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade.
67
66
 
68
67
  @Override
69
68
  public void onActivityStarted(Activity activity) {
70
- boolean isReactInitialized = false;
71
- if (AppLifecycleFacadeHolder.get() instanceof ReactAppLifecycleFacade) {
72
- isReactInitialized = AppLifecycleFacadeHolder.get().isReactInitialized();
73
- }
74
-
75
- if (InitialNotificationHolder.getInstance().get() == null && !isReactInitialized) {
69
+ if (InitialNotificationHolder.getInstance().get() == null) {
76
70
  callOnOpenedIfNeed(activity);
77
71
  }
78
72
  }
@@ -101,7 +95,8 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade.
101
95
  Intent intent = activity.getIntent();
102
96
  if (NotificationIntentAdapter.canHandleIntent(intent)) {
103
97
  Context appContext = mApplication.getApplicationContext();
104
- Bundle notificationData = NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
98
+ Bundle notificationData = NotificationIntentAdapter.canHandleTrampolineActivity(appContext) ?
99
+ intent.getExtras() : NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
105
100
  final IPushNotification pushNotification = PushNotification.get(appContext, notificationData);
106
101
  if (pushNotification != null) {
107
102
  pushNotification.onOpened();
@@ -14,9 +14,17 @@ public class NotificationIntentAdapter {
14
14
 
15
15
  @SuppressLint("UnspecifiedImmutableFlag")
16
16
  public static PendingIntent createPendingNotificationIntent(Context appContext, PushNotificationProps notification) {
17
- Intent intent = appContext.getPackageManager().getLaunchIntentForPackage(appContext.getPackageName());
18
- intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
19
- return PendingIntent.getActivity(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
17
+ if (canHandleTrampolineActivity(appContext)) {
18
+ Intent intent = new Intent(appContext, ProxyService.class);
19
+ intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
20
+ return PendingIntent.getService(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT);
21
+ } else {
22
+ Intent mainActivityIntent = appContext.getPackageManager().getLaunchIntentForPackage(appContext.getPackageName());
23
+ mainActivityIntent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
24
+ TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(appContext);
25
+ taskStackBuilder.addNextIntentWithParentStack(mainActivityIntent);
26
+ return taskStackBuilder.getPendingIntent((int) System.currentTimeMillis(), PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
27
+ }
20
28
  }
21
29
 
22
30
  public static boolean canHandleTrampolineActivity(Context appContext) {
@@ -2,8 +2,8 @@
2
2
  package com.wix.reactnativenotifications;
3
3
 
4
4
  import android.content.Context;
5
- import androidx.annotation.NonNull;
6
- import androidx.core.app.NotificationManagerCompat;
5
+ import android.support.annotation.NonNull;
6
+ import android.support.v4.app.NotificationManagerCompat;
7
7
 
8
8
  public abstract class NotificationManagerCompatFacade {
9
9
  public static NotificationManagerCompat from(@NonNull Context context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imatis/react-native-notifications",
3
- "version": "4.3.3-imatis.10",
3
+ "version": "4.3.3-imatis.11",
4
4
  "description": "Advanced Push Notifications (Silent, interactive notifications) for iOS & Android",
5
5
  "license": "MIT",
6
6
  "keywords": [