[FIX] Push notification's deep linking not working when opened from a cold state on Android (#4648)

This commit is contained in:
Diego Mello 2022-11-04 13:33:03 -03:00
parent e25fb1dbc3
commit 9c0f70b92e
4 changed files with 31 additions and 9 deletions

View File

@ -370,7 +370,7 @@ PODS:
- React-Core - React-Core
- react-native-netinfo (6.0.0): - react-native-netinfo (6.0.0):
- React-Core - React-Core
- react-native-notifications (4.3.1): - react-native-notifications (4.3.2):
- React-Core - React-Core
- react-native-orientation-locker (1.1.8): - react-native-orientation-locker (1.1.8):
- React - React
@ -946,7 +946,7 @@ SPEC CHECKSUMS:
react-native-jitsi-meet: 3e3ac5d0445091154119f94342efd55c8b1124ce react-native-jitsi-meet: 3e3ac5d0445091154119f94342efd55c8b1124ce
react-native-mmkv-storage: ba38e5e813ea3d5d37af834a9d867b1ce10aa96d react-native-mmkv-storage: ba38e5e813ea3d5d37af834a9d867b1ce10aa96d
react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d
react-native-notifications: 33ec77006f7987bb22de8f1665889abc633b9196 react-native-notifications: f3215821dfd74234f8f3910e2fe37e19fa8673b0
react-native-orientation-locker: f0ca1a8e5031dab6b74bfb4ab33a17ed2c2fcb0d react-native-orientation-locker: f0ca1a8e5031dab6b74bfb4ab33a17ed2c2fcb0d
react-native-restart: 733a51ad137f15b0f8dc34c4082e55af7da00979 react-native-restart: 733a51ad137f15b0f8dc34c4082e55af7da00979
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79 react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79

View File

@ -104,7 +104,7 @@
"react-native-mmkv-storage": "^0.7.6", "react-native-mmkv-storage": "^0.7.6",
"react-native-modal": "13.0.1", "react-native-modal": "13.0.1",
"react-native-navigation-bar-color": "2.0.1", "react-native-navigation-bar-color": "2.0.1",
"react-native-notifications": "^4.3.1", "react-native-notifications": "^4.3.2",
"react-native-notifier": "1.6.1", "react-native-notifier": "1.6.1",
"react-native-orientation-locker": "1.1.8", "react-native-orientation-locker": "1.1.8",
"react-native-picker-select": "^8.0.4", "react-native-picker-select": "^8.0.4",

View File

@ -27,10 +27,32 @@ index 90969b2..4c00e69 100644
if (notification != null) { if (notification != null) {
notification.onOpened(); 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 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 eadf41e..a3f71dd 100644 index c090247..494aae8 100644
--- a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java --- 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 +++ b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java
@@ -96,8 +96,7 @@ public class RNNotificationsPackage implements ReactPackage, AppLifecycleFacade. @@ -20,6 +20,7 @@ import com.wix.reactnativenotifications.core.notification.PushNotification;
import com.wix.reactnativenotifications.core.notification.PushNotificationProps;
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.
@Override
public void onActivityStarted(Activity activity) {
- 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.
Intent intent = activity.getIntent(); Intent intent = activity.getIntent();
if (NotificationIntentAdapter.canHandleIntent(intent)) { if (NotificationIntentAdapter.canHandleIntent(intent)) {
Context appContext = mApplication.getApplicationContext(); Context appContext = mApplication.getApplicationContext();

View File

@ -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" 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== integrity sha512-1kE/oxWt+HYjRxdZdvke9tJ365xaee5n3+euOQA1En8zQuSbOxiE4SYEGM7TeaWnmLJ0l37mRnPHaB2H4mGh0A==
react-native-notifications@^4.3.1: react-native-notifications@^4.3.2:
version "4.3.1" version "4.3.2"
resolved "https://registry.yarnpkg.com/react-native-notifications/-/react-native-notifications-4.3.1.tgz#ad9a8e6881bc17cf03ef16d4dfdaee9ec8bb721d" resolved "https://registry.yarnpkg.com/react-native-notifications/-/react-native-notifications-4.3.2.tgz#43b5fa6b2dbd49e38eadca8b8d102394a9ac7929"
integrity sha512-A668d+Q0/VQRjmrh+LvDpc/REA8GXgwCijXDCIlDHGMK8enmrtdxY5OANQf1VM3hecf+fD0wYFw2uqL/ZR8jgg== integrity sha512-QGzlO9ON2nyk1G8y1JIwv9kqpu8OQYSmqsmSzl/rXtXwCWx/WDFNb5rkBtAZQKuebtK2/Vczhfk4khraRmJj0Q==
react-native-notifier@1.6.1: react-native-notifier@1.6.1:
version "1.6.1" version "1.6.1"