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

Handle Missing DeepLinks #12820

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Handle Missing DeepLinks #12820

wants to merge 4 commits into from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Apr 4, 2024

  • 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 alperozturk96 force-pushed the bugfix/deep-link branch 2 times, most recently from ca1838f to bf91a8a Compare April 12, 2024 13:26
@alperozturk96 alperozturk96 changed the title Add Auto Verify For DeepLink Handler DeepLink Handler Fix For Android 12+ Apr 24, 2024
@alperozturk96 alperozturk96 force-pushed the bugfix/deep-link branch 4 times, most recently from 6310bdd to 8d6f792 Compare April 29, 2024 06:51
@alperozturk96 alperozturk96 changed the title DeepLink Handler Fix For Android 12+ Handle Missing DeepLinks Apr 29, 2024
@alperozturk96 alperozturk96 force-pushed the bugfix/deep-link branch 3 times, most recently from 3de68d7 to 5d0d081 Compare May 2, 2024 14:29
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Copy link

github-actions bot commented May 3, 2024

Codacy

Lint

TypemasterPR
Warnings7272
Errors33

SpotBugs

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

Copy link

github-actions bot commented May 3, 2024

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.

@AndyScherzinger
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Associating website with Android app For Better DeepLink Support
2 participants