mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 04:41:43 +03:00
Merge branch 'migration-2' of github.com:esteemapp/esteem-mobile into bugfix/remove-realm
This commit is contained in:
commit
b94cff39dc
@ -107,7 +107,7 @@ class TransferContainer extends Component {
|
||||
return validUsers;
|
||||
};
|
||||
|
||||
_transferToAccount = (from, destination, amount, memo) => {
|
||||
_transferToAccount = async (from, destination, amount, memo) => {
|
||||
const { pinCode, navigation, dispatch, intl } = this.props;
|
||||
let { currentAccount } = this.props;
|
||||
const { selectedAccount } = this.state;
|
||||
@ -160,7 +160,7 @@ class TransferContainer extends Component {
|
||||
break;
|
||||
}
|
||||
if (!currentAccount.local) {
|
||||
const realmData = getUserDataWithUsername(currentAccount.name);
|
||||
const realmData = await getUserDataWithUsername(currentAccount.name);
|
||||
currentAccount.local = realmData[0];
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ export const login = async (username, password, isPinCodeOpen) => {
|
||||
if (!account) {
|
||||
return Promise.reject(new Error('auth.invalid_username'));
|
||||
}
|
||||
if (isLoggedInUser(username)) {
|
||||
if (await isLoggedInUser(username)) {
|
||||
return Promise.reject(new Error('auth.already_logged'));
|
||||
}
|
||||
// Public keys of user
|
||||
@ -144,7 +144,7 @@ export const loginWithSC2 = async (code, isPinCodeOpen) => {
|
||||
account.local.avatar = avatar;
|
||||
}
|
||||
|
||||
if (isLoggedInUser(account.name)) {
|
||||
if (await isLoggedInUser(account.name)) {
|
||||
reject(new Error('auth.already_logged'));
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ export const loginWithSC2 = async (code, isPinCodeOpen) => {
|
||||
|
||||
export const setUserDataWithPinCode = async data => {
|
||||
try {
|
||||
const result = getUserDataWithUsername(data.username);
|
||||
const result = await getUserDataWithUsername(data.username);
|
||||
const userData = result[0];
|
||||
|
||||
if (!data.password) {
|
||||
@ -234,7 +234,7 @@ export const updatePinCode = data =>
|
||||
export const verifyPinCode = async data => {
|
||||
const pinHash = await getPinCode();
|
||||
|
||||
const result = getUserDataWithUsername(data.username);
|
||||
const result = await getUserDataWithUsername(data.username);
|
||||
const userData = result[0];
|
||||
|
||||
// This is migration for new pin structure, it will remove v2.2
|
||||
@ -338,8 +338,8 @@ export const getUpdatedUserData = (userData, data) => {
|
||||
};
|
||||
};
|
||||
|
||||
const isLoggedInUser = username => {
|
||||
const result = getUserDataWithUsername(username);
|
||||
const isLoggedInUser = async username => {
|
||||
const result = await getUserDataWithUsername(username);
|
||||
if (result.length > 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ class ApplicationContainer extends Component {
|
||||
|
||||
const accountData = await switchAccount(targetAccountUsername);
|
||||
|
||||
const realmData = getUserDataWithUsername(targetAccountUsername);
|
||||
const realmData = await getUserDataWithUsername(targetAccountUsername);
|
||||
const _currentAccount = accountData;
|
||||
_currentAccount.username = accountData.name;
|
||||
[_currentAccount.local] = realmData;
|
||||
|
@ -207,21 +207,22 @@ class PinCodeContainer extends Component {
|
||||
verifyPinCode(pinData)
|
||||
.then(() => {
|
||||
this._savePinCode(pin);
|
||||
const realmData = getUserDataWithUsername(currentAccount.name);
|
||||
const _currentAccount = currentAccount;
|
||||
_currentAccount.username = _currentAccount.name;
|
||||
[_currentAccount.local] = realmData;
|
||||
dispatch(updateCurrentAccount({ ..._currentAccount }));
|
||||
dispatch(closePinCodeModal());
|
||||
if (callback) callback(pin, oldPinCode);
|
||||
if (navigateTo) {
|
||||
const navigateAction = NavigationActions.navigate({
|
||||
routeName: navigateTo,
|
||||
params: navigateParams,
|
||||
action: NavigationActions.navigate({ routeName: navigateTo }),
|
||||
});
|
||||
dispatch(navigateAction);
|
||||
}
|
||||
getUserDataWithUsername(currentAccount.name).then(realmData => {
|
||||
const _currentAccount = currentAccount;
|
||||
_currentAccount.username = _currentAccount.name;
|
||||
[_currentAccount.local] = realmData;
|
||||
dispatch(updateCurrentAccount({ ..._currentAccount }));
|
||||
dispatch(closePinCodeModal());
|
||||
if (callback) callback(pin, oldPinCode);
|
||||
if (navigateTo) {
|
||||
const navigateAction = NavigationActions.navigate({
|
||||
routeName: navigateTo,
|
||||
params: navigateParams,
|
||||
action: NavigationActions.navigate({ routeName: navigateTo }),
|
||||
});
|
||||
dispatch(navigateAction);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
Alert.alert(
|
||||
@ -246,7 +247,7 @@ class PinCodeContainer extends Component {
|
||||
const { intl, currentAccount, applicationPinCode } = this.props;
|
||||
const { isExistUser, pinCode } = this.state;
|
||||
|
||||
const realmData = getUserDataWithUsername(currentAccount.name);
|
||||
const realmData = await getUserDataWithUsername(currentAccount.name);
|
||||
const userData = realmData[0];
|
||||
|
||||
// For exist users
|
||||
|
Loading…
Reference in New Issue
Block a user