Skip to content

Commit

Permalink
v0.26.0: Misc improvements on top of the PR #47
Browse files Browse the repository at this point in the history
  • Loading branch information
birdofpreyru committed May 30, 2024
1 parent 00e3216 commit 75de613
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- boost (1.83.0)
- DoubleConversion (1.1.6)
- dr-pogodin-react-native-fs (2.25.1):
- dr-pogodin-react-native-fs (2.26.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1391,8 +1391,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
dr-pogodin-react-native-fs: 1b8692d91b0af367bcae2acd834c48b609c6fc36
dr-pogodin-react-native-static-server: d93f2556a2ac75007d784bb90d088385360df8d4
dr-pogodin-react-native-fs: 043d4daed4fb348baddccba7bc98dee7ea7a4b91
dr-pogodin-react-native-static-server: 064d84bba53f863504c6ea874549ea5a70405c42
FBLazyVector: 898d14d17bf19e2435cafd9ea2a1033efe445709
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
Expand Down
10 changes: 8 additions & 2 deletions example/ios/ReactNativeFsExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,10 @@
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down Expand Up @@ -670,7 +673,10 @@
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
8 changes: 4 additions & 4 deletions ios/ReactNativeFs.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace JS {

struct MkdirOptionsT {
std::optional<bool> NSURLIsExcludedFromBackupKey() const {
return _v[@"NSURLIsExcludedFromBackupKey"];
return [_v[@"NSURLIsExcludedFromBackupKey"] boolValue];
}
NSString *NSFileProtectionKey() const {
return _v[@"NSFileProtectionKey"];
Expand Down Expand Up @@ -81,15 +81,15 @@ namespace JS {
NSString *toUrl() const { return _v[@"toUrl"]; }

std::optional<bool> binaryStreamOnly() const {
return ((NSNumber*)_v[@"binaryStreamOnly"]).boolValue;
return [_v[@"binaryStreamOnly"] boolValue];
}

id<NSObject> files() const { return _v[@"files"]; }
id<NSObject> _Nullable headers() const { return _v[@"headers"]; }
id<NSObject> _Nullable fields() const { return _v[@"fields"]; }
NSString *method() const { return _v[@"method"]; }
bool hasBeginCallback() const { return _v[@"hasBeginCallback"]; }
bool hasProgressCallback() const { return _v[@"hasProgressCallback"]; }
bool hasBeginCallback() const { return [_v[@"hasBeginCallback"] boolValue]; }
bool hasProgressCallback() const { return [_v[@"hasProgressCallback"] boolValue]; }

NativeUploadFileOptionsT(NSDictionary *const v) : _v(v) {}
private:
Expand Down
9 changes: 3 additions & 6 deletions ios/ReactNativeFs.mm
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,9 @@ - (instancetype) init
params.toFile = options.toFile();
NSDictionary* headers = options.headers();
params.headers = headers;
NSNumber* background = [NSNumber numberWithBool:options.background()];
params.background = [background boolValue];
NSNumber* discretionary = [NSNumber numberWithBool:options.discretionary()];
params.discretionary = [discretionary boolValue];
NSNumber* cacheable = [NSNumber numberWithBool:options.cacheable()];
params.cacheable = [cacheable boolValue];
params.background = options.background();
params.discretionary = options.discretionary();
params.cacheable = options.cacheable();
NSNumber* progressInterval= [NSNumber numberWithDouble:options.progressInterval()];
params.progressInterval = progressInterval;
NSNumber* progressDivider = [NSNumber numberWithDouble:options.progressDivider()];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dr.pogodin/react-native-fs",
"version": "2.25.3",
"version": "2.26.0",
"description": "Native filesystem access for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function downloadFile(options: DownloadFileOptionsT): {
toFile: normalizeFilePath(options.toFile),
background: !!options.background,
backgroundTimeout: options.backgroundTimeout || 3600000, // 1 hour
cacheable: options.cacheable === undefined ? true : options.cacheable,
cacheable: options.cacheable ?? true,
connectionTimeout: options.connectionTimeout || 5000,
discretionary: !!options.discretionary,
headers: options.headers || {},
Expand Down

0 comments on commit 75de613

Please sign in to comment.