[FIX] Reply and deep link from push notifications not working on iOS (#4550)
This commit is contained in:
parent
cbf9ae3d37
commit
e883795c5f
|
@ -1,3 +1,5 @@
|
||||||
|
import EJSON from 'ejson';
|
||||||
|
|
||||||
import data from '../../data';
|
import data from '../../data';
|
||||||
import { tapBack, checkServer, navigateToRegister, platformTypes, TTextMatcher } from '../../helpers/app';
|
import { tapBack, checkServer, navigateToRegister, platformTypes, TTextMatcher } from '../../helpers/app';
|
||||||
import { get, login, sendMessage } from '../../helpers/data_setup';
|
import { get, login, sendMessage } from '../../helpers/data_setup';
|
||||||
|
@ -141,6 +143,41 @@ describe('Deep linking', () => {
|
||||||
.toBeVisible()
|
.toBeVisible()
|
||||||
.withTimeout(2000);
|
.withTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should simulate a tap on a push notification and navigate to the room', async () => {
|
||||||
|
/**
|
||||||
|
* Ideally, we would repeat this test to simulate a resume from background,
|
||||||
|
* but for some reason it was not working as expected
|
||||||
|
* This was always turning to false right before running the logic https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/18f359a8ef9691144970c0c1fad990f82096b024/app/lib/notifications/push.ts#L58
|
||||||
|
*/
|
||||||
|
// await device.sendToHome();
|
||||||
|
await device.launchApp({
|
||||||
|
newInstance: true,
|
||||||
|
userNotification: {
|
||||||
|
trigger: {
|
||||||
|
type: 'push'
|
||||||
|
},
|
||||||
|
title: 'From push',
|
||||||
|
body: 'Body',
|
||||||
|
badge: 1,
|
||||||
|
payload: {
|
||||||
|
ejson: EJSON.stringify({
|
||||||
|
rid: null,
|
||||||
|
host: data.server,
|
||||||
|
name: data.groups.private.name,
|
||||||
|
type: 'p'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await waitFor(element(by.id(`room-view-title-${data.groups.private.name}`)))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(30000);
|
||||||
|
await tapBack();
|
||||||
|
await waitFor(element(by.id('rooms-list-view')))
|
||||||
|
.toBeVisible()
|
||||||
|
.withTimeout(2000);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Others', () => {
|
describe('Others', () => {
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <React/RCTBridgeDelegate.h>
|
#import <React/RCTBridgeDelegate.h>
|
||||||
#import <Expo/Expo.h>
|
#import <Expo/Expo.h>
|
||||||
|
// https://github.com/expo/expo/issues/17705#issuecomment-1196251146
|
||||||
|
#import "ExpoModulesCore-Swift.h"
|
||||||
|
#import "RocketChatRN-Swift.h"
|
||||||
|
|
||||||
@interface AppDelegate : EXAppDelegateWrapper <UIApplicationDelegate, RCTBridgeDelegate>
|
@interface AppDelegate : EXAppDelegateWrapper <UIApplicationDelegate, RCTBridgeDelegate>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
}
|
}
|
||||||
[Bugsnag start];
|
[Bugsnag start];
|
||||||
|
|
||||||
// UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"RocketChatRN", nil);
|
|
||||||
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"RocketChatRN" initialProperties:nil];
|
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"RocketChatRN" initialProperties:nil];
|
||||||
|
|
||||||
if (@available(iOS 13.0, *)) {
|
if (@available(iOS 13.0, *)) {
|
||||||
|
@ -60,7 +59,9 @@
|
||||||
rootViewController.view = rootView;
|
rootViewController.view = rootView;
|
||||||
self.window.rootViewController = rootViewController;
|
self.window.rootViewController = rootViewController;
|
||||||
[self.window makeKeyAndVisible];
|
[self.window makeKeyAndVisible];
|
||||||
[super application:application didFinishLaunchingWithOptions:launchOptions];
|
[RNNotifications startMonitorNotifications];
|
||||||
|
[ReplyNotification configure];
|
||||||
|
|
||||||
// AppGroup MMKV
|
// AppGroup MMKV
|
||||||
NSString *groupDir = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppGroup"]].path;
|
NSString *groupDir = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppGroup"]].path;
|
||||||
[MMKV initializeMMKV:nil groupDir:groupDir logLevel:MMKVLogNone];
|
[MMKV initializeMMKV:nil groupDir:groupDir logLevel:MMKVLogNone];
|
||||||
|
|
|
@ -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.2.4",
|
"react-native-notifications": "4.2.4",
|
||||||
"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",
|
||||||
|
|
|
@ -41,3 +41,61 @@ index f9c858b..94ea188 100644
|
||||||
|
|
||||||
public abstract class NotificationManagerCompatFacade {
|
public abstract class NotificationManagerCompatFacade {
|
||||||
public static NotificationManagerCompat from(@NonNull Context context) {
|
public static NotificationManagerCompat from(@NonNull Context context) {
|
||||||
|
diff --git a/node_modules/react-native-notifications/lib/ios/RCTConvert+RNNotifications.h b/node_modules/react-native-notifications/lib/ios/RCTConvert+RNNotifications.h
|
||||||
|
index 8b2c269..8667351 100644
|
||||||
|
--- a/node_modules/react-native-notifications/lib/ios/RCTConvert+RNNotifications.h
|
||||||
|
+++ b/node_modules/react-native-notifications/lib/ios/RCTConvert+RNNotifications.h
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
#import <React/RCTConvert.h>
|
||||||
|
-@import UserNotifications;
|
||||||
|
+#import <UserNotifications/UserNotifications.h>
|
||||||
|
|
||||||
|
@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
|
||||||
|
--- 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>
|
||||||
|
|
||||||
|
@interface RNNotificationCenter : 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
|
||||||
|
+++ b/node_modules/react-native-notifications/lib/ios/RNNotificationEventHandler.h
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
-@import UserNotifications;
|
||||||
|
+#import <UserNotifications/UserNotifications.h>
|
||||||
|
#import "RNNotificationsStore.h"
|
||||||
|
#import "RNEventEmitter.h"
|
||||||
|
|
||||||
|
diff --git a/node_modules/react-native-notifications/lib/ios/RNNotificationParser.h b/node_modules/react-native-notifications/lib/ios/RNNotificationParser.h
|
||||||
|
index 7aa2bfb..c1c019c 100644
|
||||||
|
--- a/node_modules/react-native-notifications/lib/ios/RNNotificationParser.h
|
||||||
|
+++ b/node_modules/react-native-notifications/lib/ios/RNNotificationParser.h
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
-@import UserNotifications;
|
||||||
|
+#import <UserNotifications/UserNotifications.h>
|
||||||
|
|
||||||
|
@interface RNNotificationParser : NSObject
|
||||||
|
|
||||||
|
diff --git a/node_modules/react-native-notifications/lib/ios/RNNotificationsStore.h b/node_modules/react-native-notifications/lib/ios/RNNotificationsStore.h
|
||||||
|
index 4f8a171..7e4f9ca 100644
|
||||||
|
--- a/node_modules/react-native-notifications/lib/ios/RNNotificationsStore.h
|
||||||
|
+++ b/node_modules/react-native-notifications/lib/ios/RNNotificationsStore.h
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
-@import UserNotifications;
|
||||||
|
+#import <UserNotifications/UserNotifications.h>
|
||||||
|
|
||||||
|
@interface RNNotificationsStore : NSObject
|
||||||
|
|
||||||
|
|
|
@ -17212,7 +17212,7 @@ 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.2.4:
|
react-native-notifications@4.2.4:
|
||||||
version "4.2.4"
|
version "4.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/react-native-notifications/-/react-native-notifications-4.2.4.tgz#0d686eb1576d3d9cb73dd9db1ee4f212e00f7d89"
|
resolved "https://registry.yarnpkg.com/react-native-notifications/-/react-native-notifications-4.2.4.tgz#0d686eb1576d3d9cb73dd9db1ee4f212e00f7d89"
|
||||||
integrity sha512-ffToxERa2bRUsXShCO19yXY6c6l4Esq7MqRKAb4mPSn+T428X7Je7WYvWOIOVw/BMGJ3R0lPrZk52vDpoYqanw==
|
integrity sha512-ffToxERa2bRUsXShCO19yXY6c6l4Esq7MqRKAb4mPSn+T428X7Je7WYvWOIOVw/BMGJ3R0lPrZk52vDpoYqanw==
|
||||||
|
|
Loading…
Reference in New Issue