Browse Source

Merge pull request #12820 from nextcloud/bugfix/deep-link

Handle Missing DeepLinks
Andy Scherzinger 8 months ago
parent
commit
6d399d9988

+ 1 - 0
app/build.gradle

@@ -104,6 +104,7 @@ android {
     }
 
     defaultConfig {
+        applicationId "com.nextcloud.client"
         minSdkVersion 24
         targetSdkVersion 34
         compileSdk 34

+ 72 - 5
app/src/main/AndroidManifest.xml

@@ -148,26 +148,93 @@
             <intent-filter>
                 <action android:name="android.intent.action.SEARCH" />
             </intent-filter>
-            <intent-filter>
+
+            <meta-data
+                android:name="android.app.searchable"
+                android:resource="@xml/users_and_groups_searchable" />
+
+            <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="http" />
+                <data android:host="*" />
+                <data android:pathPattern="/f/..*" />
+            </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="http" />
+                <data android:host="*" />
+                <data android:pathPattern="/..*/f/..*" />
+            </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="http" />
+                <data android:host="*" />
+                <data android:pathPattern="/..*/..*/f/..*" />
+            </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="http" />
+                <data android:host="*" />
+                <data android:pathPattern="/..*/..*/..*/f/..*" />
+            </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="https" />
                 <data android:host="*" />
                 <data android:pathPattern="/f/..*" />
+            </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="https" />
+                <data android:host="*" />
                 <data android:pathPattern="/..*/f/..*" />
+            </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="https" />
+                <data android:host="*" />
                 <data android:pathPattern="/..*/..*/f/..*" />
+            </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="https" />
+                <data android:host="*" />
                 <data android:pathPattern="/..*/..*/..*/f/..*" />
                 <!-- path pattern to handle deep link -->
                 <data android:pathPattern="/app/..*" />
             </intent-filter>
-
-            <meta-data
-                android:name="android.app.searchable"
-                android:resource="@xml/users_and_groups_searchable" />
         </activity>
         <activity
             android:name=".ui.activity.ManageAccountsActivity"

+ 6 - 2
app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -35,6 +35,7 @@ import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
 import android.os.Parcelable;
+import android.provider.Settings;
 import android.text.TextUtils;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -521,7 +522,8 @@ public class FileDisplayActivity extends FileActivity
         } else if (RESTART.equals(intent.getAction())) {
             finish();
             startActivity(intent);
-        } else // Verify the action and get the query
+        } else {
+            // Verify the action and get the query
             if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
                 setIntent(intent);
 
@@ -563,7 +565,10 @@ public class FileDisplayActivity extends FileActivity
 
                 setLeftFragment(new GroupfolderListFragment());
                 getSupportFragmentManager().executePendingTransactions();
+            } else {
+                handleOpenFileViaIntent(intent);
             }
+        }
     }
 
     private void onOpenFileIntent(Intent intent) {
@@ -2345,7 +2350,6 @@ public class FileDisplayActivity extends FileActivity
     @Override
     protected void onRestart() {
         super.onRestart();
-
         checkForNewDevVersionNecessary(getApplicationContext());
     }