clear image cache on logout (#3168)

This commit is contained in:
Ashish Kumar 2019-10-07 14:35:04 +05:30 committed by Vivek Maskara
parent db6ffddc13
commit 55edc34dee

View file

@ -9,6 +9,8 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipeline;
import org.wikipedia.login.LoginResult;
import javax.inject.Inject;
@ -142,6 +144,15 @@ public class SessionManager {
.map(a -> accountManager.removeAccount(a, null, null).getResult()))
.doOnComplete(() -> {
currentAccount = null;
clearImageCache();
});
}
/**
* Clear all images cache held by Fresco
*/
private void clearImageCache(){
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.clearCaches();
}
}