You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/10/06 23:13:46 UTC

[1/2] git commit: Write file in background

Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master 4a820172f -> 1e9587ca2


Write file in background


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/2153d329
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/2153d329
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/2153d329

Branch: refs/heads/master
Commit: 2153d329cc97f192f5415314c2b8767df796e260
Parents: d0af821
Author: Roi Avinoam <av...@gmail.com>
Authored: Fri Sep 5 16:53:28 2014 +0300
Committer: Roi Avinoam <av...@gmail.com>
Committed: Fri Sep 5 16:53:28 2014 +0300

----------------------------------------------------------------------
 src/ios/CDVFile.m | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2153d329/src/ios/CDVFile.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m
index 0975340..3d819b4 100644
--- a/src/ios/CDVFile.m
+++ b/src/ios/CDVFile.m
@@ -949,29 +949,30 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile";
  */
 - (void)write:(CDVInvokedUrlCommand*)command
 {
-    NSString* callbackId = command.callbackId;
-    NSArray* arguments = command.arguments;
+    [self.commandDelegate runInBackground:^ {
+        NSString* callbackId = command.callbackId;
+        NSArray* arguments = command.arguments;
 
-    // arguments
-    CDVFilesystemURL* localURI = [self fileSystemURLforArg:command.arguments[0]];
-    id argData = [arguments objectAtIndex:1];
-    unsigned long long pos = (unsigned long long)[[arguments objectAtIndex:2] longLongValue];
+        // arguments
+        CDVFilesystemURL* localURI = [self fileSystemURLforArg:command.arguments[0]];
+        id argData = [arguments objectAtIndex:1];
+        unsigned long long pos = (unsigned long long)[[arguments objectAtIndex:2] longLongValue];
 
-    NSObject<CDVFileSystem> *fs = [self filesystemForURL:localURI];
+        NSObject<CDVFileSystem> *fs = [self filesystemForURL:localURI];
 
 
-    [fs truncateFileAtURL:localURI atPosition:pos];
-    CDVPluginResult *result;
-    if ([argData isKindOfClass:[NSString class]]) {
-        NSData *encData = [argData dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
-        result = [fs writeToFileAtURL:localURI withData:encData append:YES];
-    } else if ([argData isKindOfClass:[NSData class]]) {
-        result = [fs writeToFileAtURL:localURI withData:argData append:YES];
-    } else {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid parameter type"];
-    }
-    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-
+        [fs truncateFileAtURL:localURI atPosition:pos];
+        CDVPluginResult *result;
+        if ([argData isKindOfClass:[NSString class]]) {
+            NSData *encData = [argData dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
+            result = [fs writeToFileAtURL:localURI withData:encData append:YES];
+        } else if ([argData isKindOfClass:[NSData class]]) {
+            result = [fs writeToFileAtURL:localURI withData:argData append:YES];
+        } else {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid parameter type"];
+        }
+        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+    }];
 }
 
 #pragma mark Methods for converting between URLs and paths


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] git commit: Merge branch 'master' of https://github.com/avinoamr/cordova-plugin-file

Posted by ia...@apache.org.
Merge branch 'master' of https://github.com/avinoamr/cordova-plugin-file


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/1e9587ca
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/1e9587ca
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/1e9587ca

Branch: refs/heads/master
Commit: 1e9587ca23e217eccb97f91f0433d166eedfcbdb
Parents: 4a82017 2153d32
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Oct 6 17:05:34 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Oct 6 17:05:34 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVFile.m | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/1e9587ca/src/ios/CDVFile.m
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org