From a04d424112ef4d740c4d2fc2ee0dd30cfe88f944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20Strzez=CC=87ek?= Date: Tue, 29 Nov 2016 19:08:07 +0100 Subject: [PATCH 1/9] Use existing NSURLSessionTaskDelegate method --- Downloader.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Downloader.m b/Downloader.m index 6aa0e96..311fd5b 100644 --- a/Downloader.m +++ b/Downloader.m @@ -84,7 +84,7 @@ return _params.completeCallback(_statusCode, _bytesWritten); } -- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionTask *)downloadTask didCompleteWithError:(NSError *)error +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { return _params.errorCallback(error); } From a639f49c7395f17d0835d418eb538aa71fb6226c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20Strzez=CC=87ek?= Date: Wed, 30 Nov 2016 13:52:39 +0100 Subject: [PATCH 2/9] Return error only if exists. --- Downloader.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Downloader.m b/Downloader.m index 311fd5b..e85219f 100644 --- a/Downloader.m +++ b/Downloader.m @@ -86,7 +86,7 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { - return _params.errorCallback(error); + return error ? _params.errorCallback(error) : nil; } From d904520e0c4b9a3dd10acb8cab84f070ac9ab091 Mon Sep 17 00:00:00 2001 From: Nathan Bolender Date: Tue, 13 Dec 2016 22:31:37 -0500 Subject: [PATCH 3/9] Added a state check for NSURLSessionDownloadTask in stopDownload:. This prevents trying to call the error callback after a success callback has already been called in downloadTask:didFinishDownloadingToURL:. --- Downloader.m | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Downloader.m b/Downloader.m index c18425c..ddfb39d 100644 --- a/Downloader.m +++ b/Downloader.m @@ -107,15 +107,17 @@ - (void)stopDownload { - [_task cancel]; + if (_task.state == NSURLSessionTaskStateRunning) { + [_task cancel]; - NSError *error = [NSError errorWithDomain:@"RNFS" - code:@"Aborted" - userInfo:@{ - NSLocalizedDescriptionKey: @"Download has been aborted" - }]; + NSError *error = [NSError errorWithDomain:@"RNFS" + code:@"Aborted" + userInfo:@{ + NSLocalizedDescriptionKey: @"Download has been aborted" + }]; - return _params.errorCallback(error); + return _params.errorCallback(error); + } } @end From 18ca86e3f56e1a0ee4528411ab74264dd9b48abc Mon Sep 17 00:00:00 2001 From: Arno Fortelny Date: Thu, 29 Dec 2016 16:58:13 -0500 Subject: [PATCH 4/9] Fix ctime/utime attributes on .stat() This fixes the .stat() results so that ctime/utime come through as expected. Looks like it was just an oversight. Fixes #222. --- FS.common.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FS.common.js b/FS.common.js index 3cf9493..d4e4ea1 100644 --- a/FS.common.js +++ b/FS.common.js @@ -43,6 +43,8 @@ type StatResult = { path: string; // The absolute path to the item size: string; // Size in bytes mode: number; // UNIX file mode + ctime: number; // Created date + utime: number; // Updated date isFile: () => boolean; // Is the file just a file? isDirectory: () => boolean; // Is the file a directory? }; From fe2374bff3a7ed692f8e92faafc9ca218f47e0b1 Mon Sep 17 00:00:00 2001 From: Jeff Hanson Date: Tue, 10 Jan 2017 08:09:17 -0800 Subject: [PATCH 5/9] add support for react-native v0.40.0 (#229) --- IntegrationTests/AppDelegate.m | 2 +- .../IntegrationTestsTests/IntegrationTestsTests.m | 2 +- RNFSManager.h | 4 ++-- RNFSManager.m | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/IntegrationTests/AppDelegate.m b/IntegrationTests/AppDelegate.m index e5466b2..309120e 100644 --- a/IntegrationTests/AppDelegate.m +++ b/IntegrationTests/AppDelegate.m @@ -9,7 +9,7 @@ #import "AppDelegate.h" -#import "RCTRootView.h" +#import @implementation AppDelegate diff --git a/IntegrationTests/IntegrationTestsTests/IntegrationTestsTests.m b/IntegrationTests/IntegrationTestsTests/IntegrationTestsTests.m index 1087484..add2705 100644 --- a/IntegrationTests/IntegrationTestsTests/IntegrationTestsTests.m +++ b/IntegrationTests/IntegrationTestsTests/IntegrationTestsTests.m @@ -12,7 +12,7 @@ #import -#import "RCTAssert.h" +#import @interface IntegrationTestsTests : XCTestCase diff --git a/RNFSManager.h b/RNFSManager.h index c801aae..11ac97a 100644 --- a/RNFSManager.h +++ b/RNFSManager.h @@ -6,8 +6,8 @@ // Copyright (c) 2015 Johannes Lumpe. All rights reserved. // -#import "RCTBridgeModule.h" -#import "RCTLog.h" +#import +#import @interface RNFSManager : NSObject diff --git a/RNFSManager.m b/RNFSManager.m index 95c282d..4e14560 100644 --- a/RNFSManager.m +++ b/RNFSManager.m @@ -7,11 +7,11 @@ // #import "RNFSManager.h" -#import "RCTBridge.h" +#import #import "NSArray+Map.h" #import "Downloader.h" #import "Uploader.h" -#import "RCTEventDispatcher.h" +#import #import @interface RNFSManager() From affdca0c411d77c982835914363f93e499d15a37 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 10 Jan 2017 16:19:00 +0000 Subject: [PATCH 6/9] Update devDependencies for React Native 0.40.0 See discussion in #234 --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 99c91ea..1ab8524 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ }, "devDependencies": { "flow-bin": "0.27.0", - "react": "^15.2.1", - "react-native": "^0.30.0" + "react": "^15.4.2", + "react-native": "^0.40.0" } } + From 62e1301207335c02c27de983da410e5b52b242ff Mon Sep 17 00:00:00 2001 From: Johannes Lumpe Date: Tue, 10 Jan 2017 12:38:34 -0500 Subject: [PATCH 7/9] bump to 2.0.1-rc.3 --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 1ab8524..b115ce9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-fs", - "version": "2.0.1-rc.2", + "version": "2.0.1-rc.3", "description": "Native filesystem access for react-native", "main": "FS.common.js", "scripts": { @@ -33,4 +33,3 @@ "react-native": "^0.40.0" } } - From 6232d4e392d5b52cca0792fdfe5903b7fb6b1c5c Mon Sep 17 00:00:00 2001 From: Johannes Lumpe Date: Tue, 10 Jan 2017 12:41:13 -0500 Subject: [PATCH 8/9] pre-release v2.1.0-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b115ce9..c12ab51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-fs", - "version": "2.0.1-rc.3", + "version": "v2.1.0-rc.1", "description": "Native filesystem access for react-native", "main": "FS.common.js", "scripts": { From 22027abd90c01b68ce632010ea77bfd890a3e560 Mon Sep 17 00:00:00 2001 From: Ilkin Baskan Date: Wed, 11 Jan 2017 22:37:32 +0200 Subject: [PATCH 9/9] Update README.md update readme npm install instructions acording to #223 breaking changes. new users should be informed. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ec61c2b..4b4ba2b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ First you need to install react-native-fs: npm install react-native-fs --save ``` +**Note:** If your react-native version is < 0.40 install with this tag instead: + +``` +npm install react-native-fs@2.0.1-rc.2 --save +``` + ### Adding automatically with react-native link At the command line, in your project folder, type: