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 2012/11/06 01:38:29 UTC
[25/25] js commit: fix whitespace & push basic contacts module
fix whitespace & push basic contacts module
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/d4cd5363
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/d4cd5363
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/d4cd5363
Branch: refs/heads/master
Commit: d4cd5363183c321c98568c16f185941d56983382
Parents: 40ef529
Author: mingfeng <mi...@gmail.com>
Authored: Wed Oct 17 12:10:02 2012 +0800
Committer: mingfeng <mi...@gmail.com>
Committed: Wed Oct 17 12:10:02 2012 +0800
----------------------------------------------------------------------
lib/windows8/platform.js | 4 +-
lib/windows8/plugin/windows8/ContactsProxy.js | 49 ++++++++++++++++++++
lib/windows8/plugin/windows8/DeviceProxy.js | 2 +-
lib/windows8/plugin/windows8/FileProxy.js | 8 ++--
4 files changed, 57 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/d4cd5363/lib/windows8/platform.js
----------------------------------------------------------------------
diff --git a/lib/windows8/platform.js b/lib/windows8/platform.js
index 47adbdc..82b0a57 100644
--- a/lib/windows8/platform.js
+++ b/lib/windows8/platform.js
@@ -33,17 +33,19 @@ require('cordova/plugin/windows8/AccelerometerProxy');
require('cordova/plugin/windows8/CameraProxy');
require('cordova/plugin/windows8/CaptureProxy');
require('cordova/plugin/windows8/CompassProxy');
+require('cordova/plugin/windows8/ContactsProxy');
require('cordova/plugin/windows8/FileProxy');
require('cordova/plugin/windows8/FileTransferProxy');
require('cordova/plugin/windows8/MediaProxy');
require('cordova/plugin/windows8/NotificationProxy');
+
module.exports = {
id: "windows8",
initialize:function() {
var app = WinJS.Application;
-
+
app.addEventListener("checkpoint", checkpointHandler);
function checkpointHandler(eventArgs) {
cordova.fireDocumentEvent('pause');
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/d4cd5363/lib/windows8/plugin/windows8/ContactsProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/ContactsProxy.js b/lib/windows8/plugin/windows8/ContactsProxy.js
new file mode 100644
index 0000000..41a1f32
--- /dev/null
+++ b/lib/windows8/plugin/windows8/ContactsProxy.js
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova');
+
+module.exports = {
+ search: function (win, fail, args) {
+ var fields = args[0];
+ var options = args[1];
+ var picker = Windows.ApplicationModel.Contacts.ContactPicker();
+ picker.commitButtonText = "Select";
+ picker.selectionMode = Windows.ApplicationModel.Contacts.ContactSelectionMode.contacts;
+
+ picker.desiredFields.push.apply(picker.desiredFields, fields);
+
+ if (options.multiple) {
+ picker.pickMultipleContactsAsync().then(function (contacts) {
+ win(contacts);
+ })
+ } else {
+ picker.pickSingleContactAsync().then(function (contact) {
+ var result = new Array();
+ result.push(contact);
+ win(result);
+ })
+ }
+ }
+
+};
+
+require("cordova/commandProxy").add("Contacts",module.exports);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/d4cd5363/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index faf9869..9d06c9c 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -28,7 +28,7 @@ module.exports = {
console.log("NativeProxy::getDeviceInfo");
var hostNames = Windows.Networking.Connectivity.NetworkInformation.getHostNames();
-
+
var name = "unknown";
hostNames.some(function (nm) {
if (nm.displayName.indexOf(".local") > -1) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/d4cd5363/lib/windows8/plugin/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/FileProxy.js b/lib/windows8/plugin/windows8/FileProxy.js
index 7d4c105..99c6c95 100644
--- a/lib/windows8/plugin/windows8/FileProxy.js
+++ b/lib/windows8/plugin/windows8/FileProxy.js
@@ -276,7 +276,7 @@ module.exports = {
fail(FileError.INVALID_MODIFICATION_ERR);
}
}
- // check sub-folders.
+ // check sub-folders.
}).then(function (folderList) {
if (folderList) {
if (folderList.length === 0) {
@@ -288,7 +288,7 @@ module.exports = {
fail(FileError.INVALID_MODIFICATION_ERR);
}
}
-
+
});
};
removeEntry();
@@ -319,11 +319,11 @@ module.exports = {
Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
function (storageFolder) {
var fileListPromise = storageFolder.createFileQuery().getFilesAsync();
-
+
storageFolderTop = storageFolder;
return fileListPromise;
}
- // remove all the files directly under the folder.
+ // remove all the files directly under the folder.
).then(function (fileList) {
if (fileList !== null) {
for (var i = 0; i < fileList.length; i++) {