From d3e8bd3e9a1f71b1177c0493634515379b0d1de8 Mon Sep 17 00:00:00 2001 From: Ansh Date: Thu, 4 May 2023 14:18:27 -0700 Subject: [PATCH] [APP-547] Universal links & deeplinking (#555) * added ios scheme and intentFilters for deep linking * added intentFilters for android deep linking * add .env files to .gitignore * add autoVerify for android deep links --- .gitignore | 6 +++++- app.json | 19 +++++++++++++++++-- eas.json | 1 + src/Navigation.tsx | 4 +++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index bab37d2a..2fa850bf 100644 --- a/.gitignore +++ b/.gitignore @@ -92,4 +92,8 @@ web-build/ # Android & iOS folders android/ -ios/ \ No newline at end of file +ios/ + +# environment variables +.env +.env.* \ No newline at end of file diff --git a/app.json b/app.json index c9c48b07..cd017388 100644 --- a/app.json +++ b/app.json @@ -2,6 +2,7 @@ "expo": { "name": "Bluesky", "slug": "bluesky", + "scheme": "bluesky", "owner": "blueskysocial", "version": "1.27.0", "orientation": "portrait", @@ -31,7 +32,8 @@ "NSMicrophoneUsageDescription": "Used for posts and other kinds of content.", "NSPhotoLibraryAddUsageDescription": "Used to save images to your library.", "NSPhotoLibraryUsageDescription": "Used for profile pictures, posts, and other kinds of content" - } + }, + "associatedDomains": ["applinks:bsky.app", "applinks:staging.bsky.app"] }, "androidStatusBar": { "barStyle": "dark-content", @@ -43,7 +45,20 @@ "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" }, - "package": "xyz.blueskyweb.app" + "package": "xyz.blueskyweb.app", + "intentFilters": [ + { + "action": "VIEW", + "autoVerify": true, + "data": [ + { + "scheme": "https", + "host": "bsky.app" + } + ], + "category": ["BROWSABLE", "DEFAULT"] + } + ] }, "web": { "favicon": "./assets/favicon.png" diff --git a/eas.json b/eas.json index 37671c08..32d5b13d 100644 --- a/eas.json +++ b/eas.json @@ -8,6 +8,7 @@ "developmentClient": true, "distribution": "internal", "ios": { + "simulator": true, "resourceClass": "medium" }, "channel": "development", diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 9a163fc4..afc7b39b 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -299,7 +299,9 @@ function navigate( function resetToTab(tabName: 'HomeTab' | 'SearchTab' | 'NotificationsTab') { if (navigationRef.isReady()) { navigate(tabName) - navigationRef.dispatch(StackActions.popToTop()) + if (navigationRef.canGoBack()) { + navigationRef.dispatch(StackActions.popToTop()) //we need to check .canGoBack() before calling it + } } }