瀏覽代碼

show compatibility warning

tobiasKaminsky 8 年之前
父節點
當前提交
90f582105f

+ 1 - 0
res/values/setup.xml

@@ -66,6 +66,7 @@
     <string name="mail_recommend">"mailto:"</string>
     <string name="mail_feedback">"mailto:android@nextcloud.com"</string>
     <string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
+    <string name="url_server_install">https://nextcloud.com/install</string>
 
     <!--Destination mail for sending log files -->
     <string name="mail_logger"></string>

+ 2 - 0
res/values/strings.xml

@@ -465,6 +465,8 @@
     <string name="confirmation_remove_folders_alert">Do you really want to remove the selected items and their contents?</string>
     <string name="uploads_view_upload_status_waiting_for_charging">Waiting for device charging</string>
     <string name="actionbar_search">Search</string>
+    <string name="files_drop_not_supported">This is a Nextcloud feature, please update.</string>
+    <string name="learn_more">Learn more</string>
     <plurals name="items_selected_count">
         <!--
              As a developer, you should always supply "one" and "other"

+ 3 - 0
src/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -1911,6 +1911,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.CAPABILITIES_FILES_BIGFILECHUNKING, capability.getFilesBigFileChuncking().getValue());
         cv.put(ProviderTableMeta.CAPABILITIES_FILES_UNDELETE, capability.getFilesUndelete().getValue());
         cv.put(ProviderTableMeta.CAPABILITIES_FILES_VERSIONING, capability.getFilesVersioning().getValue());
+        cv.put(ProviderTableMeta.CAPABILITIES_FILES_DROP, capability.getFilesFileDrop().getValue());
 
         if (capabilityExists(mAccount.name)) {
             if (getContentResolver() != null) {
@@ -2051,6 +2052,8 @@ public class FileDataStorageManager {
                     .getColumnIndex(ProviderTableMeta.CAPABILITIES_FILES_UNDELETE))));
             capability.setFilesVersioning(CapabilityBooleanType.fromValue(c.getInt(c
                     .getColumnIndex(ProviderTableMeta.CAPABILITIES_FILES_VERSIONING))));
+            capability.setFilesFileDrop(CapabilityBooleanType.fromValue(c.getInt(c
+                    .getColumnIndex(ProviderTableMeta.CAPABILITIES_FILES_DROP))));
 
         }
         return capability;

+ 2 - 1
src/com/owncloud/android/db/ProviderMeta.java

@@ -33,7 +33,7 @@ import com.owncloud.android.MainApp;
 public class ProviderMeta {
 
     public static final String DB_NAME = "filelist";
-    public static final int DB_VERSION = 14;
+    public static final int DB_VERSION = 15;
 
     private ProviderMeta() {
     }
@@ -131,6 +131,7 @@ public class ProviderMeta {
         public static final String CAPABILITIES_FILES_BIGFILECHUNKING = "files_bigfilechunking";
         public static final String CAPABILITIES_FILES_UNDELETE = "files_undelete";
         public static final String CAPABILITIES_FILES_VERSIONING = "files_versioning";
+        public static final String CAPABILITIES_FILES_DROP = "files_drop";
 
         public static final String CAPABILITIES_DEFAULT_SORT_ORDER = CAPABILITIES_ACCOUNT_NAME
                 + " collate nocase asc";

+ 3 - 3
src/com/owncloud/android/files/FileOperationsHelper.java

@@ -408,10 +408,10 @@ public class FileOperationsHelper {
         int permission = share.getPermissions();
         share.setPermissions(permission);
 
-        if(!hideFileListing) {
-            permission |= OCShare.READ_PERMISSION_FLAG;
+        if(hideFileListing) {
+            permission = OCShare.CREATE_PERMISSION_FLAG;
         } else {
-            permission &= ~OCShare.READ_PERMISSION_FLAG;
+            permission = OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER;
         }
 
         updateShareIntent.putExtra(

+ 17 - 1
src/com/owncloud/android/providers/FileContentProvider.java

@@ -764,6 +764,21 @@ public class FileContentProvider extends ContentProvider {
                 }
             }
 
+            if (oldVersion < 15 && newVersion >= 15) {
+                Log_OC.i("SQL", "Entering in the #15 ADD in onUpgrade");
+                db.beginTransaction();
+                try {
+                    // drop old capabilities table
+                    db.execSQL("DROP TABLE IF EXISTS " + "capabilities" + ";");
+                    // Create uploads table
+                    createCapabilitiesTable(db);
+                    upgraded = true;
+                    db.setTransactionSuccessful();
+                } finally {
+                    db.endTransaction();
+                }
+            }
+
             if (!upgraded)
                 Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion +
                         ", newVersion == " + newVersion);
@@ -844,7 +859,8 @@ public class FileContentProvider extends ContentProvider {
                 + ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_INCOMING + " INTEGER, "     // boolean
                 + ProviderTableMeta.CAPABILITIES_FILES_BIGFILECHUNKING + " INTEGER, "   // boolean
                 + ProviderTableMeta.CAPABILITIES_FILES_UNDELETE + " INTEGER, "  // boolean
-                + ProviderTableMeta.CAPABILITIES_FILES_VERSIONING + " INTEGER );" );   // boolean
+                + ProviderTableMeta.CAPABILITIES_FILES_VERSIONING + " INTEGER, "   // boolean
+                + ProviderTableMeta.CAPABILITIES_FILES_DROP + " INTEGER );" );   // boolean
     }
 
     private void createUploadsTable(SQLiteDatabase db){

+ 22 - 6
src/com/owncloud/android/ui/fragment/ShareFileFragment.java

@@ -23,8 +23,11 @@ package com.owncloud.android.ui.fragment;
 
 import android.accounts.Account;
 import android.app.Activity;
+import android.content.Intent;
 import android.graphics.Bitmap;
+import android.net.Uri;
 import android.os.Bundle;
+import android.support.design.widget.Snackbar;
 import android.support.v4.app.Fragment;
 import android.support.v7.widget.AppCompatButton;
 import android.support.v7.widget.SwitchCompat;
@@ -548,12 +551,25 @@ public class ShareFileFragment extends Fragment
                 return;
             }
 
-            ((FileActivity) getActivity()).getFileOperationsHelper().
-                    setHideFileListingPermissionsToShare(
-                            mPublicShare,
-                            isChecked
-                    );
-            ;
+            if (mCapabilities.getFilesFileDrop().isTrue()) {
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        setHideFileListingPermissionsToShare(
+                                mPublicShare,
+                                isChecked
+                        );
+            } else {
+                // not supported in ownCloud
+                Snackbar.make(getView(), R.string.files_drop_not_supported, Snackbar.LENGTH_LONG)
+                        .setAction(R.string.learn_more, new View.OnClickListener(){
+                            @Override
+                            public void onClick(View v) {
+                                Intent i = new Intent(Intent.ACTION_VIEW);
+                                i.setData(Uri.parse(getString(R.string.url_server_install)));
+                                startActivity(i);
+                            }
+                        })
+                        .show();
+            }
 
             // undo the toggle to grant the view will be correct if the dialog is cancelled
             switchView.setOnCheckedChangeListener(null);