Merge pull request #1271 from esteemapp/migration-2

Migration/ Realm to AsyncStorage
This commit is contained in:
Feruz M 2019-11-07 19:44:26 +02:00 committed by GitHub
commit d6b4a9e840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 584 additions and 583 deletions

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -438,13 +438,13 @@ 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) { if (userData.length > 0) {
realmData = userData; realmData = userData;
userData.forEach((accountData, index) => { userData.forEach((accountData, index) => {
@ -472,9 +472,7 @@ class ApplicationContainer extends Component {
} }
}); });
} }
});
} }
});
if (realmData.length > 0) { if (realmData.length > 0) {
const realmObject = realmData.filter(data => data.username === currentUsername); const realmObject = realmData.filter(data => data.username === currentUsername);