Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev-v2.25'
Browse files Browse the repository at this point in the history
  • Loading branch information
birdofpreyru committed May 30, 2024
2 parents 0f2038b + 75de613 commit b45a9c2
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.12.2
v20.14.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1248,8 +1248,8 @@ The type of options argument of [downloadFile()].
Defaults _false_.

- `discretionary` — **boolean** — Optional. Allow the OS to control
the timing and speed of the download to improve perceived performance
(iOS only).
the timing and speed of the download to improve perceived performance. This setting may prevent downloading with mobile internet or when the battery is low. Only works when `background` is activated
(iOS only, defaults to _false_).
- `cacheable` — **boolean** — Optional. Whether the download can be
stored in the shared NSURLCache (iOS only, defaults to _true_).

Expand Down
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
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lodash": "^4.17.21",
"react": "18.3.1",
"react-native": "0.74.1",
"react-native-windows": "0.74.5"
"react-native-windows": "0.74.7"
},
"devDependencies": {
"@babel/core": "^7.24.6",
Expand Down
20 changes: 10 additions & 10 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 All @@ -40,18 +40,18 @@ namespace JS {
double jobId() const { return [_v[@"jobId"] doubleValue]; }
NSString *fromUrl() const { return _v[@"fromUrl"]; }
NSString *toFile() const { return _v[@"toFile"]; }
bool background() const { return _v[@"background"]; }
bool background() const { return [_v[@"background"] boolValue]; }
double backgroundTimeout() const { return [_v[@"backgroundTimeout"] doubleValue]; }
bool cacheable() const { return _v[@"cacheable"]; }
bool cacheable() const { return [_v[@"cacheable"] boolValue]; }
double connectionTimeout() const { return [_v[@"connectionTimeout"] doubleValue]; }
bool discretionary() const { return _v[@"discretionary"]; }
bool discretionary() const { return [_v[@"discretionary"] boolValue]; }
id<NSObject> headers() const { return _v[@"headers"]; }
double progressDivider() const { return [_v[@"progressDivider"] doubleValue]; }
double progressInterval() const { return [_v[@"progressInterval"] doubleValue]; }
double readTimeout() const { return [_v[@"readTimeout"] doubleValue]; }
bool hasBeginCallback() const { return _v[@"hasBeginCallback"]; }
bool hasProgressCallback() const { return _v[@"hasProgressCallback"]; }
bool hasResumableCallback() const { return _v[@"hasResumableCallback"]; }
bool hasBeginCallback() const { return [_v[@"hasBeginCallback"] boolValue]; }
bool hasProgressCallback() const { return [_v[@"hasProgressCallback"] boolValue]; }
bool hasResumableCallback() const { return [_v[@"hasResumableCallback"] boolValue]; }

NativeDownloadFileOptionsT(NSDictionary *const v) : _v(v) {}
private:
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 ? [cacheable boolValue] : YES;
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
4 changes: 2 additions & 2 deletions 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.2",
"version": "2.26.0",
"description": "Native filesystem access for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -62,7 +62,7 @@
"react": "18.3.1",
"react-native": "0.74.1",
"react-native-builder-bob": "^0.23.2",
"react-native-windows": "0.74.5",
"react-native-windows": "0.74.7",
"typescript": "^5.4.5"
},
"resolutions": {
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,
cacheable: options.cacheable ?? true,
connectionTimeout: options.connectionTimeout || 5000,
discretionary: !!options.discretionary,
headers: options.headers || {},
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ __metadata:
metro-config: ^0.80.9
react: 18.3.1
react-native: 0.74.1
react-native-windows: 0.74.5
react-native-windows: 0.74.7
languageName: unknown
linkType: soft

Expand All @@ -1866,7 +1866,7 @@ __metadata:
react: 18.3.1
react-native: 0.74.1
react-native-builder-bob: ^0.23.2
react-native-windows: 0.74.5
react-native-windows: 0.74.7
typescript: ^5.4.5
peerDependencies:
react: "*"
Expand Down Expand Up @@ -9347,9 +9347,9 @@ __metadata:
languageName: node
linkType: hard

"react-native-windows@npm:0.74.5":
version: 0.74.5
resolution: "react-native-windows@npm:0.74.5"
"react-native-windows@npm:0.74.7":
version: 0.74.7
resolution: "react-native-windows@npm:0.74.7"
dependencies:
"@babel/runtime": ^7.0.0
"@jest/create-cache-key-function": ^29.6.3
Expand Down Expand Up @@ -9396,7 +9396,7 @@ __metadata:
"@types/react": ^18.2.6
react: 18.2.0
react-native: ^0.74.0
checksum: be0a75d2e425f24495c6815706a98b51ffca0a31e02ebe46917ff347168cabc3b80f3e64b7337a3c045051708ee6dd2ae55135c92534142b5e9cf741b270591d
checksum: aa2810b0763b8b08847e1ed46080a8e01881e0e921e94c1a822fa82b2ed90c3c21f43c3eff65331f2d8e49afdfee102a70578cb8b741cfd290a0bf2f49d09994
languageName: node
linkType: hard

Expand Down

0 comments on commit b45a9c2

Please sign in to comment.