Remove unused Context from DatabaseHelper
This commit is contained in:
parent
69910ebc15
commit
5fb3666dfd
2 changed files with 5 additions and 5 deletions
|
@ -439,7 +439,7 @@ public class BackupActivity extends BaseActivity {
|
||||||
SecretKey key = EncryptionHelper.generateSymmetricKeyFromPassword(password);
|
SecretKey key = EncryptionHelper.generateSymmetricKeyFromPassword(password);
|
||||||
byte[] decrypted = EncryptionHelper.decrypt(key, encrypted);
|
byte[] decrypted = EncryptionHelper.decrypt(key, encrypted);
|
||||||
|
|
||||||
ArrayList<Entry> entries = DatabaseHelper.stringToEntries(this, new String(decrypted, StandardCharsets.UTF_8));
|
ArrayList<Entry> entries = DatabaseHelper.stringToEntries(new String(decrypted, StandardCharsets.UTF_8));
|
||||||
|
|
||||||
if (! replace.isChecked()) {
|
if (! replace.isChecked()) {
|
||||||
ArrayList<Entry> currentEntries = DatabaseHelper.loadDatabase(this);
|
ArrayList<Entry> currentEntries = DatabaseHelper.loadDatabase(this);
|
||||||
|
@ -508,7 +508,7 @@ public class BackupActivity extends BaseActivity {
|
||||||
|
|
||||||
private void doRestoreEncrypted(String content) {
|
private void doRestoreEncrypted(String content) {
|
||||||
if (Tools.isExternalStorageReadable()) {
|
if (Tools.isExternalStorageReadable()) {
|
||||||
ArrayList<Entry> entries = DatabaseHelper.stringToEntries(this, content);
|
ArrayList<Entry> entries = DatabaseHelper.stringToEntries(content);
|
||||||
|
|
||||||
if (entries.size() > 0) {
|
if (entries.size() > 0) {
|
||||||
if (! replace.isChecked()) {
|
if (! replace.isChecked()) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class DatabaseHelper {
|
||||||
SecretKey key = KeyStoreHelper.loadOrGenerateWrappedKey(context, new File(context.getFilesDir() + "/" + KEY_FILE));
|
SecretKey key = KeyStoreHelper.loadOrGenerateWrappedKey(context, new File(context.getFilesDir() + "/" + KEY_FILE));
|
||||||
data = EncryptionHelper.decrypt(key, data);
|
data = EncryptionHelper.decrypt(key, data);
|
||||||
|
|
||||||
entries = stringToEntries(context, new String(data));
|
entries = stringToEntries(new String(data));
|
||||||
} catch (Exception error) {
|
} catch (Exception error) {
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class DatabaseHelper {
|
||||||
return json.toString();
|
return json.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Entry> stringToEntries(Context context, String data) {
|
public static ArrayList<Entry> stringToEntries(String data) {
|
||||||
ArrayList<Entry> entries = new ArrayList<>();
|
ArrayList<Entry> entries = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -120,7 +120,7 @@ public class DatabaseHelper {
|
||||||
ArrayList<Entry> entries = null;
|
ArrayList<Entry> entries = null;
|
||||||
|
|
||||||
if (! content.isEmpty())
|
if (! content.isEmpty())
|
||||||
entries = stringToEntries(context, content);
|
entries = stringToEntries(content);
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue