You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/10/30 22:22:52 UTC
[1/2] js commit: windows8 update device proxy
Updated Branches:
refs/heads/2.9.x e9c04b561 -> d138f5d6c
windows8 update device proxy
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/4648619e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/4648619e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/4648619e
Branch: refs/heads/2.9.x
Commit: 4648619edff5f52ba692141d78593f1324b17122
Parents: e9c04b5
Author: purplecabbage <pu...@gmail.com>
Authored: Wed Oct 30 14:17:08 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Wed Oct 30 14:17:08 2013 -0700
----------------------------------------------------------------------
lib/windows8/plugin/windows8/DeviceProxy.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4648619e/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index 7379f48..3c42bec 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -19,10 +19,9 @@
*
*/
+
var cordova = require('cordova');
var utils = require('cordova/utils');
-var FileError = require('cordova/plugin/FileError');
-
module.exports = {
@@ -30,6 +29,7 @@ module.exports = {
// deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
var deviceId;
+
var localSettings = Windows.Storage.ApplicationData.current.localSettings;
if (localSettings.values.deviceId) {
@@ -40,10 +40,14 @@ module.exports = {
}
setTimeout(function () {
- win({ platform: "windows8", version: "8", uuid: deviceId, cordova: CORDOVA_JS_BUILD_LABEL });
+ win({ platform: "windows8",
+ version: "8",
+ uuid: deviceId,
+ cordova: CORDOVA_JS_BUILD_LABEL,
+ model: window.clientInformation.platform });
}, 0);
}
};
-require("cordova/commandProxy").add("Device",module.exports);
+require("cordova/commandProxy").add("Device", module.exports);
[2/2] js commit: windows8 update filetransfer proxy
Posted by pu...@apache.org.
windows8 update filetransfer proxy
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d138f5d6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d138f5d6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d138f5d6
Branch: refs/heads/2.9.x
Commit: d138f5d6c77414c2c67df1fc76ae516b78599d6f
Parents: 4648619
Author: purplecabbage <pu...@gmail.com>
Authored: Wed Oct 30 14:22:33 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Wed Oct 30 14:22:33 2013 -0700
----------------------------------------------------------------------
lib/windows8/plugin/windows8/FileTransferProxy.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d138f5d6/lib/windows8/plugin/windows8/FileTransferProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/FileTransferProxy.js b/lib/windows8/plugin/windows8/FileTransferProxy.js
index 1ce79d0..17afe65 100644
--- a/lib/windows8/plugin/windows8/FileTransferProxy.js
+++ b/lib/windows8/plugin/windows8/FileTransferProxy.js
@@ -29,6 +29,7 @@ module.exports = {
upload:function(successCallback, error, options) {
var filePath = options[0];
var server = options[1];
+ var headers = options[8] || {};
var win = function (fileUploadResult) {
@@ -49,7 +50,7 @@ module.exports = {
var blob = MSApp.createBlobFromRandomAccessStream(storageFile.contentType, stream);
var formData = new FormData();
formData.append("source\";filename=\"" + storageFile.name + "\"", blob);
- WinJS.xhr({ type: "POST", url: server, data: formData }).then(function (response) {
+ WinJS.xhr({ type: "POST", url: server, data: formData, headers: headers }).then(function (response) {
var code = response.status;
storageFile.getBasicPropertiesAsync().done(function (basicProperties) {
@@ -73,6 +74,7 @@ module.exports = {
download:function(win, error, options) {
var source = options[0];
var target = options[1];
+ var headers = options[4] || {};
if (target === null || typeof target === undefined) {
@@ -96,6 +98,12 @@ module.exports = {
storageFolder.createFileAsync(fileName, Windows.Storage.CreationCollisionOption.generateUniqueName).then(function (storageFile) {
var uri = Windows.Foundation.Uri(source);
var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();
+
+ for (var header in headers) {
+ downloader.setRequestHeader(header, headers[header]);
+ }
+
+
download = downloader.createDownload(uri, storageFile);
download.startAsync().then(function () {
win(new FileEntry(storageFile.name, storageFile.path));