Skip to content

Commit e2ba80c

Browse files
Fixed logout problem #3547 (#3649) (#3927)
* fixed logout problem fixed logout problem fixed logout problem fixed logout problem fixed logout problem * added error handling on logout Co-authored-by: gouri-panda <gouripanda4@gmail.com>
1 parent ece085d commit e2ba80c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

app/src/main/java/fr/free/nrw/commons/CommonsApplication.java

+13-11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.squareup.leakcanary.LeakCanary;
2121
import com.squareup.leakcanary.RefWatcher;
2222

23+
import io.reactivex.Completable;
2324
import org.acra.ACRA;
2425
import org.acra.annotation.AcraCore;
2526
import org.acra.annotation.AcraDialog;
@@ -267,17 +268,18 @@ public void clearApplicationData(Context context, LogoutListener logoutListener)
267268
}
268269

269270
sessionManager.logout()
270-
.subscribeOn(Schedulers.io())
271-
.observeOn(AndroidSchedulers.mainThread())
272-
.subscribe(() -> {
273-
Timber.d("All accounts have been removed");
274-
clearImageCache();
275-
//TODO: fix preference manager
276-
defaultPrefs.clearAll();
277-
defaultPrefs.putBoolean("firstrun", false);
278-
updateAllDatabases();
279-
logoutListener.onLogoutComplete();
280-
});
271+
.andThen(Completable.fromAction(() ->{
272+
Timber.d("All accounts have been removed");
273+
clearImageCache();
274+
//TODO: fix preference manager
275+
defaultPrefs.clearAll();
276+
defaultPrefs.putBoolean("firstrun", false);
277+
updateAllDatabases();
278+
}
279+
))
280+
.subscribeOn(Schedulers.io())
281+
.observeOn(AndroidSchedulers.mainThread())
282+
.subscribe(logoutListener::onLogoutComplete, Timber::e);
281283
}
282284

283285
/**

0 commit comments

Comments
 (0)