android icon indicating copy to clipboard operation
android copied to clipboard

Handle Missing DeepLinks

Open alperozturk96 opened this issue 1 year ago • 3 comments

  • [x] Tests written, or not not needed

What this PR does?

It adds auto verify for intent filters Adds missing intent filters Calls handleOpenFileViaIntent() function in line 564 for missing case

Note: If we support only Android 12+ we can delete path patterns and http scheme

How to Test

Note: Works for Only Android 11 and Below

adb shell am start
-W -a android.intent.action.VIEW
-d "YOUR_INTERNAL_SHARE_LINK"\

Why It's Not Working For Android 12+

In Android 12 and beyond, it's not possible to provide generic host data, and you must add an assetlinks.json file to the .well-known directory of every potential host so we can't do that.

How It's Working For Android 12+

  1. Host URL must have assetlinks.json in .well-known directory with correct sha256_cert_fingerprints. Example -> https://example.cloud.com/.well-known/assetlinks.json
[
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "com.nextcloud.client",
      "sha256_cert_fingerprints": [
        ".............."
      ]
    }
  }
]
  1. In Android Manifest file for FileDisplayActivity intent filter must added. Example ->
  <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="https" />
                <data android:host="example.cloud.com" />
 </intent-filter> 

Useful links

Our previous topic Official Documentation Similar Documentation

alperozturk96 avatar Apr 04 '24 10:04 alperozturk96

Codacy

Lint

TypemasterPR
Warnings7272
Errors33

SpotBugs

CategoryBaseNew
Bad practice6666
Correctness7373
Dodgy code349349
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness66
Performance5757
Security1919
Total580580

github-actions[bot] avatar May 03 '24 10:05 github-actions[bot]

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12820.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

github-actions[bot] avatar May 03 '24 10:05 github-actions[bot]

Looks good, but can't tell if the app I'd in the manifest causes brander issues, hence cc @tobiasKaminsky

AndyScherzinger avatar May 04 '24 08:05 AndyScherzinger

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12820.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

github-actions[bot] avatar Aug 19 '24 06:08 github-actions[bot]

Codacy

Lint

TypemasterPR
Warnings6262
Errors33

SpotBugs

CategoryBaseNew
Bad practice6363
Correctness6464
Dodgy code305305
Experimental11
Internationalization77
Multithreaded correctness66
Performance5252
Security1818
Total516516

github-actions[bot] avatar Aug 19 '24 07:08 github-actions[bot]

blue-Light-Screenshot test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/12820-Screenshot-blue-Light-07-07

github-actions[bot] avatar Aug 19 '24 07:08 github-actions[bot]