瀏覽代碼

Merge pull request #5829 from nextcloud/checkAccountBeforeReceivingFiles

check if at least one account is set up, before receiving files
Andy Scherzinger 5 年之前
父節點
當前提交
f1c8d40817
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

+ 10 - 0
src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -63,6 +63,7 @@ import android.widget.ListView;
 import android.widget.ProgressBar;
 import android.widget.Spinner;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.google.android.material.button.MaterialButton;
 import com.nextcloud.client.di.Injectable;
@@ -238,6 +239,15 @@ public class ReceiveExternalFilesActivity extends FileActivity
     @Override
     protected void onStart() {
         super.onStart();
+
+        if (mAccountManager.getAccountsByType(MainApp.getAccountType(this)).length == 0) {
+            Toast.makeText(this,
+                           String.format(getString(R.string.uploader_wrn_no_account_text),
+                                         getString(R.string.app_name)),
+                           Toast.LENGTH_LONG).show();
+            return;
+        }
+
         initTargetFolder();
         populateDirectoryList();
     }