mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 13:53:23 +03:00
Merge pull request #1271 from esteemapp/migration-2
Migration/ Realm to AsyncStorage
This commit is contained in:
commit
d6b4a9e840
@ -73,8 +73,8 @@ class SideMenuContainer extends Component {
|
|||||||
const { dispatch, currentAccount, navigation } = this.props;
|
const { dispatch, currentAccount, navigation } = this.props;
|
||||||
|
|
||||||
if (anchor !== currentAccount.name) {
|
if (anchor !== currentAccount.name) {
|
||||||
switchAccount(anchor).then(accountData => {
|
switchAccount(anchor).then(async accountData => {
|
||||||
const realmData = getUserDataWithUsername(anchor);
|
const realmData = await getUserDataWithUsername(anchor);
|
||||||
const _currentAccount = accountData;
|
const _currentAccount = accountData;
|
||||||
|
|
||||||
_currentAccount.username = _currentAccount.name;
|
_currentAccount.username = _currentAccount.name;
|
||||||
|
1103
src/realm/realm.js
1103
src/realm/realm.js
File diff suppressed because it is too large
Load Diff
@ -438,43 +438,41 @@ class ApplicationContainer extends Component {
|
|||||||
_getUserDataFromRealm = async () => {
|
_getUserDataFromRealm = async () => {
|
||||||
const { dispatch, pinCode, isPinCodeOpen: _isPinCodeOpen } = this.props;
|
const { dispatch, pinCode, isPinCodeOpen: _isPinCodeOpen } = this.props;
|
||||||
let realmData = [];
|
let realmData = [];
|
||||||
let currentUsername;
|
|
||||||
|
|
||||||
await getAuthStatus().then(res => {
|
const res = await getAuthStatus();
|
||||||
({ currentUsername } = res);
|
const { currentUsername } = res;
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
getUserData().then(async userData => {
|
const userData = await getUserData();
|
||||||
if (userData.length > 0) {
|
|
||||||
realmData = userData;
|
if (userData.length > 0) {
|
||||||
userData.forEach((accountData, index) => {
|
realmData = userData;
|
||||||
if (
|
userData.forEach((accountData, index) => {
|
||||||
!accountData.accessToken &&
|
if (
|
||||||
!accountData.masterKey &&
|
!accountData.accessToken &&
|
||||||
!accountData.postingKey &&
|
!accountData.masterKey &&
|
||||||
!accountData.activeKey &&
|
!accountData.postingKey &&
|
||||||
!accountData.memoKey
|
!accountData.activeKey &&
|
||||||
) {
|
!accountData.memoKey
|
||||||
realmData.splice(index, 1);
|
) {
|
||||||
if (realmData.length === 0) {
|
realmData.splice(index, 1);
|
||||||
dispatch(login(false));
|
if (realmData.length === 0) {
|
||||||
dispatch(logoutDone());
|
dispatch(login(false));
|
||||||
removePinCode();
|
dispatch(logoutDone());
|
||||||
setAuthStatus({ isLoggedIn: false });
|
removePinCode();
|
||||||
setExistUser(false);
|
setAuthStatus({ isLoggedIn: false });
|
||||||
if (accountData.authType === AUTH_TYPE.STEEM_CONNECT) {
|
setExistUser(false);
|
||||||
removeSCAccount(accountData.username);
|
if (accountData.authType === AUTH_TYPE.STEEM_CONNECT) {
|
||||||
}
|
removeSCAccount(accountData.username);
|
||||||
}
|
|
||||||
removeUserData(accountData.username);
|
|
||||||
} else {
|
|
||||||
dispatch(addOtherAccount({ username: accountData.username }));
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
removeUserData(accountData.username);
|
||||||
|
} else {
|
||||||
|
dispatch(addOtherAccount({ username: accountData.username }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
if (realmData.length > 0) {
|
if (realmData.length > 0) {
|
||||||
const realmObject = realmData.filter(data => data.username === currentUsername);
|
const realmObject = realmData.filter(data => data.username === currentUsername);
|
||||||
|
Loading…
Reference in New Issue
Block a user