From 306607b045c8ec090c3866ebca9027f204798001 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Thu, 11 Aug 2022 16:40:31 -0300 Subject: [PATCH] Regression: Resume the app with a deep link not navigating (#4428) --- e2e/tests/assorted/11-deeplinking.spec.js | 19 +++++++++++++++++ ios/RocketChatRN/AppDelegate.mm | 25 +++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/e2e/tests/assorted/11-deeplinking.spec.js b/e2e/tests/assorted/11-deeplinking.spec.js index 3f8e7864c..00862f1b8 100644 --- a/e2e/tests/assorted/11-deeplinking.spec.js +++ b/e2e/tests/assorted/11-deeplinking.spec.js @@ -122,6 +122,25 @@ describe('Deep linking', () => { .toExist() .withTimeout(30000); await tapBack(); + await waitFor(element(by.id('rooms-list-view'))) + .toBeVisible() + .withTimeout(2000); + }); + + it('should resume from background and navigate to the room', async () => { + await device.sendToHome(); + await device.launchApp({ + permissions: { notifications: 'YES' }, + newInstance: false, + url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${data.groups.private.name}`) + }); + 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); }); }); diff --git a/ios/RocketChatRN/AppDelegate.mm b/ios/RocketChatRN/AppDelegate.mm index 9f482d8ac..d647af0e8 100644 --- a/ios/RocketChatRN/AppDelegate.mm +++ b/ios/RocketChatRN/AppDelegate.mm @@ -119,24 +119,23 @@ [RNNotifications didFailToRegisterForRemoteNotificationsWithError:error]; } -- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url - sourceApplication:(NSString *)sourceApplication annotation:(id)annotation +- (BOOL)application:(UIApplication *)application + openURL:(NSURL *)url + options:(NSDictionary *)options { - return [RCTLinkingManager application:application openURL:url - sourceApplication:sourceApplication annotation:annotation]; + return [RCTLinkingManager application:application openURL:url options:options]; +} + +- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity + restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler +{ + return [RCTLinkingManager application:application + continueUserActivity:userActivity + restorationHandler:restorationHandler]; } - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return [Orientation getOrientation]; } - -// Only if your app is using [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html). -- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity - restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler -{ - return [RCTLinkingManager application:application - continueUserActivity:userActivity - restorationHandler:restorationHandler]; -} @end