Remove exportAsJSON function from DatabaseHelper

This commit is contained in:
Jakob Nixdorf 2017-12-27 15:44:45 +01:00
parent 08ad01b3db
commit cb155823f7
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
2 changed files with 2 additions and 11 deletions

View file

@ -399,9 +399,9 @@ public class BackupActivity extends BaseActivity {
private void doBackupPlain(Uri uri) { private void doBackupPlain(Uri uri) {
if (Tools.isExternalStorageWritable()) { if (Tools.isExternalStorageWritable()) {
boolean success = DatabaseHelper.exportAsJSON(this, uri); ArrayList<Entry> entries = DatabaseHelper.loadDatabase(this);
if (success) if (FileHelper.writeStringToFile(this, uri, DatabaseHelper.entriesToString(entries)))
Toast.makeText(this, R.string.backup_toast_export_success, Toast.LENGTH_LONG).show(); Toast.makeText(this, R.string.backup_toast_export_success, Toast.LENGTH_LONG).show();
else else
Toast.makeText(this, R.string.backup_toast_export_failed, Toast.LENGTH_LONG).show(); Toast.makeText(this, R.string.backup_toast_export_failed, Toast.LENGTH_LONG).show();

View file

@ -24,7 +24,6 @@
package org.shadowice.flocke.andotp.Utilities; package org.shadowice.flocke.andotp.Utilities;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import org.json.JSONArray; import org.json.JSONArray;
import org.shadowice.flocke.andotp.Database.Entry; import org.shadowice.flocke.andotp.Database.Entry;
@ -108,12 +107,4 @@ public class DatabaseHelper {
return entries; return entries;
} }
/* Export functions */
public static boolean exportAsJSON(Context context, Uri file) {
ArrayList<Entry> entries = loadDatabase(context);
return FileHelper.writeStringToFile(context, file, entriesToString(entries));
}
} }