mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-01 09:23:16 +08:00
Clean up fresco cache clearing code
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
This commit is contained in:
committed by
Facebook Github Bot
parent
8a8ac771b1
commit
d3282e3bb1
@@ -14,14 +14,11 @@ import java.util.HashSet;
|
||||
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;
|
||||
@@ -81,11 +78,7 @@ public class FrescoModule extends ReactContextBaseJavaModule implements
|
||||
@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(
|
||||
|
||||
Reference in New Issue
Block a user