Skip to content

Commit

Permalink
Clean up fresco cache clearing code
Browse files Browse the repository at this point in the history
Summary: I noticed we're doing too much manual work here, when Fresco has a nice handy shortcut for clearing all caches.

Reviewed By: kirwan

Differential Revision: D3791356

fbshipit-source-id: 4a55d0280e9483267741ae75383b50ca0b74c5c6
  • Loading branch information
foghina authored and Facebook Github Bot committed Aug 31, 2016
1 parent 8a8ac77 commit d3282e3
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
import android.content.Context;
import android.support.annotation.Nullable;

import com.facebook.cache.common.CacheKey;
import com.facebook.cache.disk.DiskCacheConfig;
import com.facebook.common.internal.AndroidPredicates;
import com.facebook.common.soloader.SoLoaderShim;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.core.ImagePipelineFactory;
import com.facebook.imagepipeline.listener.RequestListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
Expand Down Expand Up @@ -81,11 +78,7 @@ public String getName() {
@Override
public void clearSensitiveData() {
// Clear image cache.
ImagePipelineFactory imagePipelineFactory = Fresco.getImagePipelineFactory();
imagePipelineFactory.getBitmapMemoryCache().removeAll(AndroidPredicates.<CacheKey>True());
imagePipelineFactory.getEncodedMemoryCache().removeAll(AndroidPredicates.<CacheKey>True());
imagePipelineFactory.getMainFileCache().clearAll();
imagePipelineFactory.getSmallImageFileCache().clearAll();
Fresco.getImagePipeline().clearCaches();
}

private static ImagePipelineConfig getDefaultConfig(
Expand Down

0 comments on commit d3282e3

Please sign in to comment.