mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 04:41:43 +03:00
Fixed #883. Fixed pin code crash issue
This commit is contained in:
parent
e96ffb2ccb
commit
643c4ce08e
@ -245,39 +245,50 @@ class PinCodeContainer extends Component {
|
||||
const { intl, currentAccount, applicationPinCode } = this.props;
|
||||
const { isExistUser, pinCode } = this.state;
|
||||
|
||||
const realmData = await getUserDataWithUsername(currentAccount.name);
|
||||
const userData = realmData[0];
|
||||
try {
|
||||
const realmData = await getUserDataWithUsername(currentAccount.name);
|
||||
const userData = realmData[0];
|
||||
|
||||
// For exist users
|
||||
if (isReset) {
|
||||
await this._resetPinCode(pin);
|
||||
return true;
|
||||
}
|
||||
if (isExistUser) {
|
||||
if (!userData.accessToken && !userData.masterKey && applicationPinCode) {
|
||||
const verifiedPin = decryptKey(applicationPinCode, Config.PIN_KEY);
|
||||
if (verifiedPin === pin) {
|
||||
await this._setFirstPinCode(pin);
|
||||
} else {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
id: 'alert.warning',
|
||||
}),
|
||||
intl.formatMessage({
|
||||
id: 'alert.invalid_pincode',
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await this._verifyPinCode(pin);
|
||||
// For exist users
|
||||
if (isReset) {
|
||||
await this._resetPinCode(pin);
|
||||
return true;
|
||||
}
|
||||
if (isExistUser) {
|
||||
if (!userData.accessToken && !userData.masterKey && applicationPinCode) {
|
||||
const verifiedPin = decryptKey(applicationPinCode, Config.PIN_KEY);
|
||||
if (verifiedPin === pin) {
|
||||
await this._setFirstPinCode(pin);
|
||||
} else {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
id: 'alert.warning',
|
||||
}),
|
||||
intl.formatMessage({
|
||||
id: 'alert.invalid_pincode',
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await this._verifyPinCode(pin);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// For new users
|
||||
if (pinCode === pin) {
|
||||
await this._setFirstPinCode(pin);
|
||||
return true;
|
||||
// For new users
|
||||
if (pinCode === pin) {
|
||||
await this._setFirstPinCode(pin);
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
id: 'alert.warning',
|
||||
}),
|
||||
intl.formatMessage({
|
||||
id: error.message,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (!pinCode) {
|
||||
|
@ -158,7 +158,7 @@ export const groomingWalletData = async (user, globalProps) => {
|
||||
|
||||
walletData.showPowerDown = user.next_vesting_withdrawal !== '1969-12-31T23:59:59';
|
||||
const timeDiff = Math.abs(parseDate(user.next_vesting_withdrawal) - new Date());
|
||||
walletData.nextVestingWithdrawal = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
||||
walletData.nextVestingWithdrawal = Math.floor(timeDiff / (1000 * 3600 * 24));
|
||||
|
||||
const { transfer_history: transferHistory } = get(accounts, user.name, []);
|
||||
walletData.transactions = transferHistory
|
||||
|
Loading…
Reference in New Issue
Block a user