From 44f062f9b9011f6871a8fd641616d0e757b42d6b Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 16 Nov 2022 18:09:46 -0300 Subject: [PATCH] Bump react-native-notifications to 4.3.3 (#4692) --- ios/Podfile.lock | 4 +- package.json | 2 +- ...=> react-native-notifications+4.3.3.patch} | 48 ++++++++++++------- yarn.lock | 8 ++-- 4 files changed, 37 insertions(+), 25 deletions(-) rename patches/{react-native-notifications+4.3.2.patch => react-native-notifications+4.3.3.patch} (89%) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c70ea7cc38..9f1650b1ee 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -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 @@ -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 diff --git a/package.json b/package.json index cfee034808..15b49ca15c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/patches/react-native-notifications+4.3.2.patch b/patches/react-native-notifications+4.3.3.patch similarity index 89% rename from patches/react-native-notifications+4.3.2.patch rename to patches/react-native-notifications+4.3.3.patch index 591f491fc8..5637dea82c 100644 --- a/patches/react-native-notifications+4.3.2.patch +++ b/patches/react-native-notifications+4.3.3.patch @@ -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 { @@ -127,7 +128,7 @@ 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); @@ -135,10 +136,21 @@ index 4bc5292..4839d55 100644 typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error); -@import UserNotifications; -+#import ++#import @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 +-@import UserNotifications; ++#import + #import "RNNotificationEventHandler.h" + + @interface RNNotificationCenterListener : NSObject 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 diff --git a/yarn.lock b/yarn.lock index 26b470218e..ab1a14d7bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17221,10 +17221,10 @@ react-native-navigation-bar-color@2.0.1: 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== react-native-notifier@1.6.1: version "1.6.1"