Skip to content

Fix Deep Links not working on Android 12+ #10128

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

Merged
merged 20 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6a1741f
feat: upgrading targetSdkVersion
tomivs Jul 27, 2022
0d21e9e
feat: updating npm pkgs for new targetSdkVersion
tomivs Jul 27, 2022
33ef541
feat: android:exported for activities
tomivs Jul 27, 2022
b1ccedf
chore: adds assetlinks.json for link verification
tomivs Jul 27, 2022
e55f74d
chore: webpack config to deploy assetlinks.json
tomivs Jul 27, 2022
921bf0c
fix: removing old Swift reference
tomivs Aug 4, 2022
fa5ccf8
fix: removing old Swift reference 2
tomivs Aug 4, 2022
15f6dc4
feat: updating to [email protected]
tomivs Aug 4, 2022
93e92b1
Revert "feat: upgrading targetSdkVersion"
tomivs Aug 11, 2022
f5ecc63
Revert "feat: updating npm pkgs for new targetSdkVersion"
tomivs Aug 11, 2022
c0844c0
Revert "feat: android:exported for activities"
tomivs Aug 11, 2022
01b905e
Revert "fix: removing old Swift reference"
tomivs Aug 11, 2022
2fb9853
Revert "fix: removing old Swift reference 2"
tomivs Aug 11, 2022
99b0890
Revert "feat: updating to [email protected]"
tomivs Aug 11, 2022
c8aa9fa
Revert "feat: updating npm pkgs for new targetSdkVersion"
tomivs Aug 11, 2022
9904c07
Merge branch 'Expensify:main' into tomivs-deep-links-android-12
tomivs Aug 11, 2022
6399644
fix: set up AndroidManifest.xml for Android 12+
tomivs Aug 11, 2022
695862c
Merge branch 'Expensify:main' into tomivs-deep-links-android-12
tomivs Aug 11, 2022
1b4fa01
Merge branch 'Expensify:main' into tomivs-deep-links-android-12
tomivs Aug 11, 2022
3e01ca4
Merge branch 'Expensify:main' into tomivs-deep-links-android-12
tomivs Aug 12, 2022
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
8 changes: 8 additions & 0 deletions .well-known/assetlinks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.expensify.chat",
"sha256_cert_fingerprints": ["2E:65:6F:1C:34:F5:7E:BF:FC:C0:2D:A3:14:0E:83:FE:61:51:F2:9B:5D:59:58:61:C4:4D:A9:99:0C:CA:F4:8E"]
Copy link
Member

@parasharrajat parasharrajat Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Or we have to change it. The gpg key in the codebase is encrypted if you used that to get the signature.

Copy link
Contributor Author

@tomivs tomivs Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted it from the New Expensify's APK from the Play Store, so it should probably work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndrewGable might be a bit slow to respond this week… He's getting married 😅 💍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, definitely he won't be able to respond. In that case, @deetergp Could you please check the signature? https://developer.android.com/training/app-links/verify-site-associations#web-assoc has details to get the signature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. Please let's double check this..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified in Google Play store and it is correct!
Screen Shot 2022-08-03 at 1 02 00 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @luacmartins

}
}]
9 changes: 5 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@
<activity
android:name=".bootsplash.BootSplashActivity"
android:theme="@style/BootTheme"
android:launchMode="singleTask">
android:launchMode="singleTask"
android:exported="true">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
android:exported="true">
android:exported="false">

Copy link
Contributor Author

@tomivs tomivs Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value for android:exported must be set to true, otherwise the links won't open the app.

According to Android docs:

If the app component includes the LAUNCHER category, set android:exported to true. In most other cases, set android:exported to false.

Our app component includes the LAUNCHER category

https://github.com/tomivs/App/blob/e55f74de55f087e1b0fd77afdc1c6d2356ccb0b2/android/app/src/main/AndroidManifest.xml#L37

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh! I see.


<intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!-- Custom URI handlers. Used to intercept Urban Airship deep links. -->
<intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="new-expensify"/>
</intent-filter>

<!-- Web URL handlers. Used to intercept web links. -->
<intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
compileSdkVersion = 31
targetSdkVersion = 31
androidXCore = "1.0.2"
multiDexEnabled = true
googlePlayServicesVersion = "17.0.0"
kotlinVersion = '1.4.21'
kotlinVersion = '1.6.0'
}
repositories {
google()
Expand Down
1 change: 1 addition & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
{from: 'node_modules/react-pdf/dist/esm/Page/AnnotationLayer.css', to: 'css/AnnotationLayer.css'},
{from: 'assets/images/shadow.png', to: 'images/shadow.png'},
{from: '.well-known/apple-app-site-association', to: '.well-known/apple-app-site-association', toType: 'file'},
{from: '.well-known/assetlinks.json', to: '.well-known/assetlinks.json'},

// These files are copied over as per instructions here
// https://github.com/wojtekmaj/react-pdf#copying-cmaps
Expand Down
242 changes: 18 additions & 224 deletions ios/NewExpensify.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

39 changes: 21 additions & 18 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
PODS:
- Airship (14.4.2):
- Airship/Automation (= 14.4.2)
- Airship/Core (= 14.4.2)
- Airship/ExtendedActions (= 14.4.2)
- Airship/MessageCenter (= 14.4.2)
- Airship/Automation (14.4.2):
- Airship (16.4.0):
- Airship/Automation (= 16.4.0)
- Airship/Basement (= 16.4.0)
- Airship/Core (= 16.4.0)
- Airship/ExtendedActions (= 16.4.0)
- Airship/MessageCenter (= 16.4.0)
- Airship/Automation (16.4.0):
- Airship/Core
- Airship/Core (14.4.2)
- Airship/ExtendedActions (14.4.2):
- Airship/Basement (16.4.0)
- Airship/Core (16.4.0):
- Airship/Basement
- Airship/ExtendedActions (16.4.0):
- Airship/Core
- Airship/MessageCenter (14.4.2):
- Airship/MessageCenter (16.4.0):
- Airship/Core
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
Expand Down Expand Up @@ -443,7 +446,7 @@ PODS:
- React-Core
- react-native-document-picker (8.0.0):
- React-Core
- react-native-flipper (0.117.0):
- react-native-flipper (0.146.1):
- React-Core
- react-native-image-picker (4.7.3):
- React-Core
Expand Down Expand Up @@ -531,7 +534,7 @@ PODS:
- React-perflogger (= 0.66.4)
- rn-fetch-blob (0.12.0):
- React-Core
- RNCAsyncStorage (1.15.5):
- RNCAsyncStorage (1.17.7):
- React-Core
- RNCClipboard (1.5.1):
- React-Core
Expand Down Expand Up @@ -605,8 +608,8 @@ PODS:
- SDWebImageWebPCoder (0.8.5):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- urbanairship-react-native (11.0.2):
- Airship (= 14.4.2)
- urbanairship-react-native (14.0.0):
- Airship (= 16.4.0)
- React-Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
Expand Down Expand Up @@ -880,7 +883,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
Airship: 29d674abeac754f783fc46c7d383d6f046687341
Airship: 755b12485ab6001bc846001edf31a9bceb675689
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
Expand Down Expand Up @@ -938,7 +941,7 @@ SPEC CHECKSUMS:
react-native-cameraroll: 60ac50a5209777cbccfe8d7a62d0743a9da87060
react-native-config: 6502b1879f97ed5ac570a029961fc35ea606cd14
react-native-document-picker: 772d04a4bc5c35da9abe27b08ac271420ae3f9ef
react-native-flipper: cd9eabd8917104c1bbdca2621717cdca3b2addef
react-native-flipper: 4bfe0a324e663f1ae2f76ad0da75673de6895efe
react-native-image-picker: ae1202414bd5c37c00b2a701daa5b6194a06b7d9
react-native-netinfo: ebbcd8fbe1a0ce7035e43cd18c5a545dcb93dd08
react-native-pdf: 4b5a9e4465a6a3b399e91dc4838eb44ddf716d1f
Expand All @@ -961,7 +964,7 @@ SPEC CHECKSUMS:
React-runtimeexecutor: dec32ee6f2e2a26e13e58152271535fadff5455a
ReactCommon: 57b69f6383eafcbd7da625bfa6003810332313c4
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
RNCAsyncStorage: 8324611026e8dc3706f829953aa6e3899f581589
RNCAsyncStorage: 19af8f3e136504e0450e7f85cfb46fc38da87ec9
RNCClipboard: 5e299c6df8e0c98f3d7416b86ae563d3a9f768a3
RNCMaskedView: 138134c4d8a9421b4f2bf39055a79aa05c2d47b1
RNCPicker: f6c760d4b314585ff35165d8640d7917ae30afb1
Expand All @@ -979,10 +982,10 @@ SPEC CHECKSUMS:
RNSVG: ce9d996113475209013317e48b05c21ee988d42e
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
urbanairship-react-native: 60b4b4235838ff109a2639b639e2ef01d54ad455
urbanairship-react-native: 4e805253e716f01c410ab7614f152d00676bd390
Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 431123d7514c52fa4516724b89c20d02c87ad8c8

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@formatjs/intl-numberformat": "^6.2.5",
"@formatjs/intl-pluralrules": "^4.0.13",
"@onfido/react-native-sdk": "^5.4.0",
"@react-native-async-storage/async-storage": "^1.15.5",
"@react-native-async-storage/async-storage": "^1.17.7",
"@react-native-community/cameraroll": "^4.1.2",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/datetimepicker": "^3.5.2",
Expand Down Expand Up @@ -109,7 +109,7 @@
"save": "^2.4.0",
"shim-keyboard-event-key": "^1.0.3",
"underscore": "^1.13.1",
"urbanairship-react-native": "^11.0.2"
"urbanairship-react-native": "^14.0.0"
},
"devDependencies": {
"@actions/core": "^1.2.6",
Expand Down