Improve the export functionality in numerous ways

This patch improves the export functionality in the following ways:
1. Allow setting a password even if the Aegis vault is not encrypted
2. Display a scary warning when exporting an unencrypted vault
3. Support exporting to a Google Authenticator URI file
4. Option to use Android's share mechanism

<img src="https://alexbakker.me/u/375oh146vz.png" width="300" />
This commit is contained in:
Alexander Bakker 2020-10-25 21:42:26 +01:00
parent 61364b5542
commit 5f2529ea33
27 changed files with 358 additions and 85 deletions

View file

@ -7,7 +7,7 @@ import android.preference.PreferenceManager;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.runner.AndroidJUnitRunner;
import java.io.File;
import com.beemdevelopment.aegis.util.IOUtils;
public class AegisTestRunner extends AndroidJUnitRunner {
@Override
@ -15,7 +15,7 @@ public class AegisTestRunner extends AndroidJUnitRunner {
Context context = app.getApplicationContext();
// clear internal storage so that there is no vault file
clearDirectory(context.getFilesDir(), false);
IOUtils.clearDirectory(context.getFilesDir(), false);
// clear preferences so that the intro is started from MainActivity
ApplicationProvider.getApplicationContext().getFilesDir();
@ -26,21 +26,4 @@ public class AegisTestRunner extends AndroidJUnitRunner {
super.callApplicationOnCreate(app);
}
private static void clearDirectory(File dir, boolean deleteParent) {
File[] files = dir.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
clearDirectory(file, true);
} else {
file.delete();
}
}
}
if (deleteParent) {
dir.delete();
}
}
}