Show dialog when trying to add a vault in the root folder of the cloud
Fixes #236
This commit is contained in:
parent
810a9877ca
commit
5a890b452b
@ -0,0 +1,28 @@
|
||||
package org.cryptomator.presentation.ui.dialog
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.DialogInterface
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import org.cryptomator.generator.Dialog
|
||||
import org.cryptomator.presentation.R
|
||||
|
||||
@Dialog(R.layout.dialog_vault_is_root_folder_of_cloud)
|
||||
class VaultIsRootFolderOfCloudDialog : BaseDialog<Activity>() {
|
||||
|
||||
public override fun setupDialog(builder: AlertDialog.Builder): android.app.Dialog {
|
||||
return builder //
|
||||
.setTitle(R.string.dialog_vault_is_root_folder_of_cloud_title) //
|
||||
.setNeutralButton(R.string.dialog_vaults_removed_during_migration_neutral_button) { dialog: DialogInterface, _: Int -> dialog.dismiss() }
|
||||
.create()
|
||||
}
|
||||
|
||||
override fun setupView() {}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(): DialogFragment {
|
||||
return VaultIsRootFolderOfCloudDialog()
|
||||
}
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@ import org.cryptomator.presentation.model.ProgressModel;
|
||||
import org.cryptomator.presentation.model.mappers.CloudModelMapper;
|
||||
import org.cryptomator.presentation.presenter.ChooseCloudServicePresenter;
|
||||
import org.cryptomator.presentation.presenter.VaultListPresenter;
|
||||
import org.cryptomator.presentation.ui.dialog.VaultIsRootFolderOfCloudDialog;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
@ -116,9 +117,13 @@ public class AddExistingVaultWorkflow extends Workflow<AddExistingVaultWorkflow.
|
||||
@Callback
|
||||
void cryptomatorFileChosen(SerializableResult<CloudFileModel> result) {
|
||||
CloudFileModel masterkeyFile = result.getResult();
|
||||
state().masterkeyFile = masterkeyFile.toCloudNode();
|
||||
presenter().getView().showProgress(ProgressModel.GENERIC);
|
||||
finish();
|
||||
if(!masterkeyFile.getPath().equals("/masterkey.cryptomator") && !masterkeyFile.getPath().equals("/vault.cryptomator")) {
|
||||
state().masterkeyFile = masterkeyFile.toCloudNode();
|
||||
presenter().getView().showProgress(ProgressModel.GENERIC);
|
||||
finish();
|
||||
} else {
|
||||
presenter().getView().showDialog(VaultIsRootFolderOfCloudDialog.Companion.newInstance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="@string/dialog_vault_is_root_folder_of_cloud_hint" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
@ -415,11 +415,12 @@
|
||||
<string name="dialog_app_is_obscured_info_hint">Another app is displaying something on top of Cryptomator (e.g., a blue light filter or night mode app). For security reasons, Cryptomator is disabled.\n\n<a href="https://docs.cryptomator.org/en/1.5/android/settings/#block-app-when-obscured">How to enable Cryptomator</a></string>
|
||||
<string name="dialog_app_is_obscured_info_neutral_button">Close</string>
|
||||
|
||||
|
||||
<string name="dialog_vaults_removed_during_migration_title">Please re-add vaults for %1s cloud</string>
|
||||
<string name="dialog_vaults_removed_during_migration_hint">While migrating to this app version we need to remove the following vaults from the app:\n%2s \n\nThose vaults aren\'t removed from the cloud but only from this app. Sorry for the inconvenience and please re-add these vaults to continue working with them.</string>
|
||||
<string name="dialog_vaults_removed_during_migration_neutral_button" translatable="false">@string/dialog_unable_to_share_positive_button</string>
|
||||
|
||||
<string name="dialog_vault_is_root_folder_of_cloud_title">Vault is root folder of the cloud connection</string>
|
||||
<string name="dialog_vault_is_root_folder_of_cloud_hint">Create a new cloud connection where you select at least the parent folder of this vault folder as the root directory to add this vault.</string>
|
||||
|
||||
<string name="dialog_disable_secure_screen_disclaimer_hint">This setting is a security feature and prevents other apps from tricking users into doing things they do not wan\'t to do.\n\nBy disabling, you confirm that you are <a href="https://docs.cryptomator.org/en/1.5/android/settings/#screen-security">aware of the risks</a>.</string>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user