Skip to content

Commit

Permalink
Bump react-native-notifications to 4.3.3 (#4692)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello authored Nov 16, 2022
1 parent 438b69b commit 44f062f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ PODS:
- React-Core
- react-native-netinfo (6.0.0):
- React-Core
- react-native-notifications (4.3.2):
- react-native-notifications (4.3.3):
- React-Core
- react-native-orientation-locker (1.1.8):
- React
Expand Down Expand Up @@ -946,7 +946,7 @@ SPEC CHECKSUMS:
react-native-jitsi-meet: 3e3ac5d0445091154119f94342efd55c8b1124ce
react-native-mmkv-storage: ba38e5e813ea3d5d37af834a9d867b1ce10aa96d
react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d
react-native-notifications: f3215821dfd74234f8f3910e2fe37e19fa8673b0
react-native-notifications: 83b4fd4a127a6c918fc846cae90da60f84819e44
react-native-orientation-locker: f0ca1a8e5031dab6b74bfb4ab33a17ed2c2fcb0d
react-native-restart: 733a51ad137f15b0f8dc34c4082e55af7da00979
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"react-native-mmkv-storage": "^0.7.6",
"react-native-modal": "13.0.1",
"react-native-navigation-bar-color": "2.0.1",
"react-native-notifications": "^4.3.2",
"react-native-notifications": "^4.3.3",
"react-native-notifier": "1.6.1",
"react-native-orientation-locker": "1.1.8",
"react-native-picker-select": "^8.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,68 +27,69 @@ index 90969b2..4c00e69 100644
if (notification != null) {
notification.onOpened();
diff --git a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java
index c090247..494aae8 100644
index a249c6a..5b1e9c7 100644
--- a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java
+++ b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java
@@ -20,6 +20,7 @@ import com.wix.reactnativenotifications.core.notification.PushNotification;
import com.wix.reactnativenotifications.core.notification.PushNotificationProps;
@@ -19,6 +19,7 @@ import com.wix.reactnativenotifications.core.notification.IPushNotification;
import com.wix.reactnativenotifications.core.notification.PushNotification;
import com.wix.reactnativenotifications.core.notificationdrawer.IPushNotificationsDrawer;
import com.wix.reactnativenotifications.core.notificationdrawer.PushNotificationsDrawer;
+import com.wix.reactnativenotifications.core.ReactAppLifecycleFacade;

import java.util.Arrays;
import java.util.Collections;
@@ -67,7 +68,12 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade.
@@ -66,7 +67,13 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade.

@Override
public void onActivityStarted(Activity activity) {
- if (InitialNotificationHolder.getInstance().get() != null) {
- if (InitialNotificationHolder.getInstance().get() == null) {
+ boolean isReactInitialized = false;
+ if (AppLifecycleFacadeHolder.get() instanceof ReactAppLifecycleFacade) {
+ isReactInitialized = AppLifecycleFacadeHolder.get().isReactInitialized();
+ }
+
+ if (InitialNotificationHolder.getInstance().get() == null && !isReactInitialized) {
+
callOnOpenedIfNeed(activity);
}
}
@@ -96,8 +102,7 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade.
@@ -95,8 +102,7 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade.
Intent intent = activity.getIntent();
if (NotificationIntentAdapter.canHandleIntent(intent)) {
Context appContext = mApplication.getApplicationContext();
- Bundle notificationData = NotificationIntentAdapter.cannotHandleTrampolineActivity(appContext) ?
- NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent) : intent.getExtras();
- Bundle notificationData = NotificationIntentAdapter.canHandleTrampolineActivity(appContext) ?
- intent.getExtras() : NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
+ Bundle notificationData = NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
final IPushNotification pushNotification = PushNotification.get(appContext, notificationData);
if (pushNotification != null) {
pushNotification.onOpened();
diff --git a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java
index 41b4824..4285ac5 100644
index 70f609a..4484808 100644
--- a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java
+++ b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java
@@ -14,17 +14,9 @@ public class NotificationIntentAdapter {

@SuppressLint("UnspecifiedImmutableFlag")
public static PendingIntent createPendingNotificationIntent(Context appContext, PushNotificationProps notification) {
- if (cannotHandleTrampolineActivity(appContext)) {
- if (canHandleTrampolineActivity(appContext)) {
- Intent intent = new Intent(appContext, ProxyService.class);
- intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
- return PendingIntent.getService(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT);
- } else {
- Intent mainActivityIntent = appContext.getPackageManager().getLaunchIntentForPackage(appContext.getPackageName());
- mainActivityIntent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
- TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(appContext);
- taskStackBuilder.addNextIntentWithParentStack(mainActivityIntent);
- return taskStackBuilder.getPendingIntent((int) System.currentTimeMillis(), PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
- } else {
- Intent intent = new Intent(appContext, ProxyService.class);
- intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
- return PendingIntent.getService(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT);
- }
+ Intent intent = appContext.getPackageManager().getLaunchIntentForPackage(appContext.getPackageName());
+ intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle());
+ return PendingIntent.getActivity(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
}

public static boolean cannotHandleTrampolineActivity(Context appContext) {
public static boolean canHandleTrampolineActivity(Context appContext) {
diff --git a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
index 54a5fb8..06bbfb9 100644
index eade08d..a9f2864 100644
--- a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
+++ b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
@@ -28,7 +28,7 @@ public class PushNotification implements IPushNotification {
Expand Down Expand Up @@ -127,18 +128,29 @@ index 8b2c269..8667351 100644
@interface RCTConvert (UIMutableUserNotificationAction)
+ (UIMutableUserNotificationAction *)UIMutableUserNotificationAction:(id)json;
diff --git a/node_modules/react-native-notifications/lib/ios/RNNotificationCenter.h b/node_modules/react-native-notifications/lib/ios/RNNotificationCenter.h
index 4bc5292..4839d55 100644
index 4bc5292..71df0bc 100644
--- a/node_modules/react-native-notifications/lib/ios/RNNotificationCenter.h
+++ b/node_modules/react-native-notifications/lib/ios/RNNotificationCenter.h
@@ -4,7 +4,7 @@ typedef void (^RCTPromiseResolveBlock)(id result);
typedef void (^RCTResponseSenderBlock)(NSArray *response);
typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error);

-@import UserNotifications;
+#import <UserNotifications/UserNotifications.h>
+#import <UserNotifications/UserNotifications.h>

@interface RNNotificationCenter : NSObject

diff --git a/node_modules/react-native-notifications/lib/ios/RNNotificationCenterListener.h b/node_modules/react-native-notifications/lib/ios/RNNotificationCenterListener.h
index 77a67dd..eaf0043 100644
--- a/node_modules/react-native-notifications/lib/ios/RNNotificationCenterListener.h
+++ b/node_modules/react-native-notifications/lib/ios/RNNotificationCenterListener.h
@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>
-@import UserNotifications;
+#import <UserNotifications/UserNotifications.h>
#import "RNNotificationEventHandler.h"

@interface RNNotificationCenterListener : NSObject <UNUserNotificationCenterDelegate>
diff --git a/node_modules/react-native-notifications/lib/ios/RNNotificationEventHandler.h b/node_modules/react-native-notifications/lib/ios/RNNotificationEventHandler.h
index a07c6e9..8e3ca6a 100644
--- a/node_modules/react-native-notifications/lib/ios/RNNotificationEventHandler.h
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17221,10 +17221,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/react-native-navigation-bar-color/-/react-native-navigation-bar-color-2.0.1.tgz#ee2be25cc37105f7da355717b0a9a32c9c059ae6"
integrity sha512-1kE/oxWt+HYjRxdZdvke9tJ365xaee5n3+euOQA1En8zQuSbOxiE4SYEGM7TeaWnmLJ0l37mRnPHaB2H4mGh0A==

react-native-notifications@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/react-native-notifications/-/react-native-notifications-4.3.2.tgz#43b5fa6b2dbd49e38eadca8b8d102394a9ac7929"
integrity sha512-QGzlO9ON2nyk1G8y1JIwv9kqpu8OQYSmqsmSzl/rXtXwCWx/WDFNb5rkBtAZQKuebtK2/Vczhfk4khraRmJj0Q==
react-native-notifications@^4.3.3:
version "4.3.3"
resolved "https://registry.yarnpkg.com/react-native-notifications/-/react-native-notifications-4.3.3.tgz#5be05cb144127f4db518079dd202415af497dfcb"
integrity sha512-t7uPgpC93A4L41Jea2zet3BUqgh45gpN/ATS9gxejNH3r6kWgMdGeeZJhuMpl1gSXw1gcvgzdjzIjN7YZSOP0A==

[email protected]:
version "1.6.1"
Expand Down

0 comments on commit 44f062f

Please sign in to comment.