mirror of
https://github.com/m2049r/xmrwallet
synced 2025-04-28 07:33:36 +02:00
store only through service & setPassword (#802)
This commit is contained in:
parent
05720e63ab
commit
22d9173cea
app/src/main/java/com/m2049r/xmrwallet
build.gradle@ -407,7 +407,6 @@ public class GenerateReviewFragment extends Fragment {
|
||||
Wallet.Status walletStatus = wallet.getStatus();
|
||||
if (walletStatus.isOk()) {
|
||||
wallet.setPassword(newPassword);
|
||||
wallet.store();
|
||||
ok = true;
|
||||
} else {
|
||||
Timber.e(walletStatus.getErrorString());
|
||||
|
@ -67,6 +67,8 @@ public class SubaddressFragment extends Fragment implements SubaddressInfoAdapte
|
||||
void setToolbarButton(int type);
|
||||
|
||||
void showSubaddress(View view, final int subaddressIndex);
|
||||
|
||||
void saveWallet();
|
||||
}
|
||||
|
||||
public interface ProgressListener {
|
||||
@ -217,7 +219,9 @@ public class SubaddressFragment extends Fragment implements SubaddressInfoAdapte
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
if (params.length != 0) return false;
|
||||
wallet.getNewSubaddress();
|
||||
wallet.store();
|
||||
if (activityCallback != null) {
|
||||
activityCallback.saveWallet();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -505,6 +505,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
||||
Timber.d("onResume()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWallet() {
|
||||
if (mIsBound) { // no point in talking to unbound service
|
||||
Intent intent = new Intent(getApplicationContext(), WalletService.class);
|
||||
@ -609,9 +610,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
||||
@Override
|
||||
public void onWalletStored(final boolean success) {
|
||||
runOnUiThread(() -> {
|
||||
if (success) {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_wallet_unloaded), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
if (!success) {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_wallet_unload_failed), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
@ -147,7 +147,7 @@ public class Wallet {
|
||||
|
||||
private native Status statusWithErrorString();
|
||||
|
||||
public native boolean setPassword(String password);
|
||||
public native synchronized boolean setPassword(String password);
|
||||
|
||||
public String getAddress() {
|
||||
return getAddress(accountIndex);
|
||||
@ -203,12 +203,10 @@ public class Wallet {
|
||||
public native String getSecretSpendKey();
|
||||
|
||||
public boolean store() {
|
||||
final boolean ok = store("");
|
||||
Timber.d("stored");
|
||||
return ok;
|
||||
return store("");
|
||||
}
|
||||
|
||||
public native boolean store(String path);
|
||||
public native synchronized boolean store(String path);
|
||||
|
||||
public boolean close() {
|
||||
disposePendingTransaction();
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user