Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void restoreProfile() {
- if (!loginSubscription.isUnsubscribed()) {
- loginSubscription.unsubscribe();
- }
- loginSubscription = loginModel.restoreUserProfile()
- .subscribe(user -> {
- /new profile
- } else {
- if (!cleanDataSubscription.isUnsubscribed()) {
- cleanDataSubscription.unsubscribe();
- }
- cleanDataSubscription = loginModel.cleanCaсhedData()
- .subscribe(result -> {
- Log.d(TAG, "restoreProfile: clean Data");
- if (!restoreDataSubscription.isUnsubscribed()) {
- restoreDataSubscription.unsubscribe();
- }
- restoreDataSubscription = viewedDataModel.getLastBattles()
- .subscribe(r -> {
- Log.d(TAG, "restoreProfile: restore data");
- //write data
- }, throwable -> {
- Log.d(TAG, "restoreProfile: restore data error");
- });
- }, throwable -> {
- Log.w(TAG, "onLogoutClick: Failed to clear realm", throwable);
- });
- }
- }, throwable -> {
- view.showProfileRestoreError(throwable);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement