Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup deep links for iOS / Android #2052

Merged
merged 8 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="expensify-cash"/>
<data android:scheme="https" android:host="www.expensify.cash" />
<data android:scheme="https" android:host="staging.expensify.cash" />
<data android:scheme="https" android:host="expensify.cash" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

</manifest>
16 changes: 16 additions & 0 deletions apple-app-site-association
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"applinks": {
"apps": [],
"details": [
{
"appID": "368M544MTT.com.chat.expensify.chat",
"paths": [
"/r/*",
"/settings/*",
"/setpassword/*",
"/details/*"
]
}
]
}
}
1 change: 1 addition & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const webpackConfig = {
{from: 'assets/css', to: 'css'},
{from: 'node_modules/react-pdf/dist/esm/Page/AnnotationLayer.css', to: 'css/AnnotationLayer.css'},
{from: 'assets/images/shadow.png', to: 'images/shadow.png'},
{from: 'apple-app-site-association'},

// These files are copied over as per instructions here
// https://github.com/wojtekmaj/react-pdf#copying-cmaps
Expand Down
22 changes: 19 additions & 3 deletions ios/ExpensifyCash/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTRootView.h>
#import <Firebase.h>

Expand Down Expand Up @@ -32,7 +33,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
// Configure firebase
[FIRApp configure];

#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
Expand All @@ -49,11 +50,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];

// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

return YES;
}

Expand All @@ -66,4 +67,19 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
#endif
}

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}

@end
6 changes: 6 additions & 0 deletions ios/ExpensifyCash/Chat.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.expensify.cash</string>
<string>applinks:staging.expensify.cash</string>
<string>applinks:expensify.cash</string>
</array>
</dict>
</plist>
9 changes: 9 additions & 0 deletions ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,14 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>expensify-cash</string>
</array>
</dict>
</array>
</dict>
</plist>
8 changes: 7 additions & 1 deletion src/libs/Navigation/linkingConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import ROUTES from '../../ROUTES';

export default {
prefixes: ['expensify-cash://', 'https://expensify.cash', 'https://www.expensify.cash', 'http://localhost'],
prefixes: [
'expensify-cash://',
'https://expensify.cash',
'https://www.expensify.cash',
'https://staging.expensify.cash',
'http://localhost',
],
config: {
screens: {
Home: {
Expand Down