don't create OpenKeychain dir on startup

This commit is contained in:
Vincent Breitmoser
2017-11-29 14:52:49 +01:00
parent 86e41f8996
commit ecf9249247
9 changed files with 23 additions and 31 deletions

View File

@@ -18,6 +18,15 @@
package org.sufficientlysecure.keychain.ui;
import java.io.File;
import java.io.IOException;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
@@ -61,14 +70,6 @@ import org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator;
import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Passphrase;
import java.io.File;
import java.io.IOException;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;
public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringParcel, ExportResult>
implements OnBackStackChangedListener {
@@ -559,6 +560,11 @@ public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringPar
return;
}
if (!Constants.Path.APP_DIR.mkdirs()) {
Notify.create(activity, R.string.snack_backup_error_saving, Style.ERROR).show();
return;
}
File file = new File(Constants.Path.APP_DIR, filename);
if (!overwrite && file.exists()) {

View File

@@ -254,7 +254,7 @@ public class BackupRestoreFragment extends Fragment {
}
private void restore() {
FileHelper.openDocument(this, null, "*/*", false, REQUEST_CODE_INPUT);
FileHelper.openDocument(this, "*/*", false, REQUEST_CODE_INPUT);
}
}

View File

@@ -82,7 +82,7 @@ public class EncryptDecryptFragment extends Fragment {
mDecryptFile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FileHelper.openDocument(EncryptDecryptFragment.this, null, "*/*", false, REQUEST_CODE_INPUT);
FileHelper.openDocument(EncryptDecryptFragment.this, "*/*", false, REQUEST_CODE_INPUT);
}
});

View File

@@ -211,9 +211,7 @@ public class EncryptFilesFragment
}
private void addInputUri() {
FileHelper.openDocument(EncryptFilesFragment.this, mFilesAdapter.getModelCount() == 0 ?
null : mFilesAdapter.getModelItem(mFilesAdapter.getModelCount() - 1).inputUri,
"*/*", true, REQUEST_CODE_INPUT);
FileHelper.openDocument(EncryptFilesFragment.this, "*/*", true, REQUEST_CODE_INPUT);
}
public void addInputUri(Intent data) {

View File

@@ -102,8 +102,7 @@ public class ImportKeysFileFragment extends Fragment {
// open .asc or .gpg files
// setting it to text/plain prevents Cyanogenmod's file manager from selecting asc
// or gpg types!
FileHelper.openDocument(ImportKeysFileFragment.this,
Uri.fromFile(Constants.Path.APP_DIR), "*/*", false, REQUEST_CODE_FILE);
FileHelper.openDocument(ImportKeysFileFragment.this, "*/*", false, REQUEST_CODE_FILE);
return true;
case R.id.menu_import_keys_file_paste:
importFromClipboard();

View File

@@ -122,7 +122,7 @@ public class AddEditSmartPGPAuthorityDialogFragment extends DialogFragment imple
mAuthorityAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FileHelper.openDocument(AddEditSmartPGPAuthorityDialogFragment.this, null, "*/*", false,
FileHelper.openDocument(AddEditSmartPGPAuthorityDialogFragment.this, "*/*", false,
EncryptFilesFragment.REQUEST_CODE_INPUT);
}
});

View File

@@ -317,7 +317,7 @@ public class ManageSecurityTokenFragment extends Fragment implements ManageSecur
@Override
public void showFileSelectDialog() {
FileHelper.openDocument(this, null, "*/*", false, REQUEST_CODE_OPEN_FILE);
FileHelper.openDocument(this, "*/*", false, REQUEST_CODE_OPEN_FILE);
}
@Override