Skip to content

Commit

Permalink
rebuild gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
pbernasconi committed Jun 10, 2014
1 parent 0749ab5 commit 3523bed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion dist/ng-cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ angular.module('ngCordova.plugins.deviceMotion', [])
q.resolve(result);
}, function(err) {
q.reject(err);
}, options);
});

return q.promise;
},
Expand Down Expand Up @@ -420,6 +420,13 @@ angular.module('ngCordova.plugins.file', [])
var q = $q.defer();
var fileTransfer = new FileTransfer();
var uri = encodeURI(source);

fileTransfer.onprogress = function(progressEvent) {
if (progressEvent.lengthComputable) {
var perc = Math.floor(progressEvent.loaded / progressEvent.total * 100);
q.notify(perc);
}
};

fileTransfer.download(
uri,
Expand All @@ -431,12 +438,21 @@ angular.module('ngCordova.plugins.file', [])
q.reject(error);
},
trustAllHosts, options);

return q.promise;
},

uploadFile: function (server, filePath, options) {
var q = $q.defer();
var fileTransfer = new FileTransfer();
var uri = encodeURI(server);

fileTransfer.onprogress = function(progressEvent) {
if (progressEvent.lengthComputable) {
var perc = Math.floor(progressEvent.loaded / progressEvent.total * 100);
q.notify(perc);
}
};

fileTransfer.upload(
filePath,
Expand All @@ -448,6 +464,8 @@ angular.module('ngCordova.plugins.file', [])
q.reject(error);
},
options)

return q.promise
}

};
Expand Down
Loading

0 comments on commit 3523bed

Please sign in to comment.