Browse Source

FIX: Don't show alert unless password is invalid.

settingsui
Marcos Rodriguez 5 years ago
parent
commit
d48bbd7340
  1. 4
      class/app-storage.js
  2. 6
      screen/settings/encryptStorage.js

4
class/app-storage.js

@ -148,13 +148,13 @@ export class AppStorage {
if (!decrypted) {
throw new Error('Wrong password for main storage.');
}
const decryptedParsed = JSON.parse(decrypted)
const decryptedParsed = JSON.parse(decrypted);
if (decrypted.wallets !== null) {
this.wallets = decryptedParsed.wallets;
this.tx_metadata = decryptedParsed.tx_metadata;
this.cachedPassword = undefined;
await RNSecureKeyStore.set(AppStorage.FLAG_ENCRYPTED, '', { accessible: ACCESSIBLE.WHEN_UNLOCKED });
await RNSecureKeyStore.set('deleteWalletAfterUninstall', true, { accessible: ACCESSIBLE.WHEN_UNLOCKED });
await RNSecureKeyStore.set('deleteWalletAfterUninstall', '1', { accessible: ACCESSIBLE.WHEN_UNLOCKED });
return this.saveToDisk();
}
}

6
screen/settings/encryptStorage.js

@ -58,8 +58,10 @@ export default class EncryptStorage extends Component {
});
} catch (e) {
console.log(e);
alert(loc._.bad_password);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
if (password) {
alert(loc._.bad_password);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
}
this.setState({
isLoading: false,
storageIsEncrypted: await BlueApp.storageIsEncrypted(),

Loading…
Cancel
Save