Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RN 0.40+ #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ public class MainApplication extends Application implements ReactApplication {
import * as CacheManager from 'react-native-http-cache';

// invoke API directly when in need
CacheManager.clear();
CacheManager.clearCache();

```

## API Documentation

#### clear()
#### clearCache()

Clear cache for all type.

Return a promise which indicate the clear state.

#### getSize()
#### getCacheSize()

Get cache size for all type.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void updateCacheSize(DiskStorageCache cache) throws NoSuchMethodExceptio

@ReactMethod
public void getImageCacheSize(Promise promise){
FileCache cache1 = ImagePipelineFactory.getInstance().getMainDiskStorageCache();
FileCache cache1 = ImagePipelineFactory.getInstance().getMainFileCache();
long size1 = cache1.getSize();
if (size1 < 0){
try {
Expand All @@ -77,7 +77,7 @@ public void getImageCacheSize(Promise promise){
}
size1 = cache1.getSize();
}
FileCache cache2 = ImagePipelineFactory.getInstance().getSmallImageDiskStorageCache();
FileCache cache2 = ImagePipelineFactory.getInstance().getSmallImageFileCache();
long size2 = cache2.getSize();
if (size2 < 0){
try {
Expand Down
8 changes: 8 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module "react-native-http-cache" {
export function clearHttpCache(): Promise<void>;
export function getHttpCacheSize(): Promise<number>;
export function clearImageCache(): Promise<void>;
export function getImageCacheSize(): Promise<number>;
export function getCacheSize(): Promise<number>;
export function clearCache(): Promise<void>;
}
4 changes: 2 additions & 2 deletions ios/RCTHttpCache/RCTHttpCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//

#import "RCTHttpCache.h"
//#import "RCTImageLoader.h"
#import "React/RCTImageLoader.h"
#import "RCTImageCache.h"
//#import "RCTBridge.h"
#import "React/RCTBridge.h"

@implementation RCTHttpCache

Expand Down