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

syan #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

syan #30

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
47 changes: 24 additions & 23 deletions android/src/main/java/cn/reactnative/httpcache/HttpCacheModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,30 @@ private void updateCacheSize(DiskStorageCache cache) throws NoSuchMethodExceptio

@ReactMethod
public void getImageCacheSize(Promise promise){
FileCache cache1 = ImagePipelineFactory.getInstance().getMainDiskStorageCache();
long size1 = cache1.getSize();
if (size1 < 0){
try {
updateCacheSize((DiskStorageCache)cache1);
} catch (Exception e){
promise.reject(e);
return;
}
size1 = cache1.getSize();
}
FileCache cache2 = ImagePipelineFactory.getInstance().getSmallImageDiskStorageCache();
long size2 = cache2.getSize();
if (size2 < 0){
try {
updateCacheSize((DiskStorageCache)cache2);
} catch (Exception e){
promise.reject(e);
return;
}
size2 = cache2.getSize();
}
promise.resolve(((double)(size1+size2)));
// FileCache cache1 = ImagePipelineFactory.getInstance().getMainDiskStorageCache();
// long size1 = cache1.getSize();
// if (size1 < 0){
// try {
// updateCacheSize((DiskStorageCache)cache1);
// } catch (Exception e){
// promise.reject(e);
// return;
// }
// size1 = cache1.getSize();
// }
// FileCache cache2 = ImagePipelineFactory.getInstance().getSmallImageDiskStorageCache();
// long size2 = cache2.getSize();
// if (size2 < 0){
// try {
// updateCacheSize((DiskStorageCache)cache2);
// } catch (Exception e){
// promise.reject(e);
// return;
// }
// size2 = cache2.getSize();
// }
// promise.resolve(((double)(size1+size2)));
promise.resolve(0);
}

@ReactMethod
Expand Down
13 changes: 3 additions & 10 deletions ios/RCTHttpCache.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@
9157833B1C33994800F5D8F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../react-native/React/**",
"$(SRCROOT)/../../react-native/Libraries/**",
);
HEADER_SEARCH_PATHS = "";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -226,11 +222,7 @@
9157833C1C33994800F5D8F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../react-native/React/**",
"$(SRCROOT)/../../react-native/Libraries/**",
);
HEADER_SEARCH_PATHS = "";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -256,6 +248,7 @@
9157833C1C33994800F5D8F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RCTHttpCache.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/RCTHttpCache/RCTHttpCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 erica. All rights reserved.
//

#import "RCTBridgeModule.h"
#import <React/RCTBridgeModule.h>

@interface RCTHttpCache : NSObject<RCTBridgeModule>

Expand Down
4 changes: 1 addition & 3 deletions ios/RCTHttpCache/RCTHttpCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
//

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

@implementation RCTHttpCache

Expand Down