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 2014/03/14 06:59:08 UTC
[1/3] git commit: CB-1291 Windows8 Adding contact picker apis
Repository: cordova-plugin-contacts
Updated Branches:
refs/heads/master 431eeea9f -> 92ebe1aaf
CB-1291 Windows8 Adding contact picker apis
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/04b96dc9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/04b96dc9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/04b96dc9
Branch: refs/heads/master
Commit: 04b96dc9426cc0c2504f0a36ba9acacb4ce52e6a
Parents: 431eeea
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Mar 12 17:33:53 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 12 17:33:53 2014 -0700
----------------------------------------------------------------------
plugin.xml | 7 ++++++-
src/windows8/ContactProxy.js | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/04b96dc9/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index bf2aeb8..acfc080 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -187,6 +187,11 @@
<js-module src="src/firefoxos/ContactsProxy.js" name="ContactsProxy">
<runs />
</js-module>
- </platform>
+ </platform>
+
+ <!-- wp8 -->
+ <js-module src="src/windows8/ContactProxy.js" name="ContactProxy">
+ <merges target="" />
+ </js-module>
</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/04b96dc9/src/windows8/ContactProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/ContactProxy.js b/src/windows8/ContactProxy.js
new file mode 100644
index 0000000..888047a
--- /dev/null
+++ b/src/windows8/ContactProxy.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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];
+ },
+
+ save:function(win,fail,args){
+ var contact = args[0];
+ }
+
+
+}
+
+require("cordova/windows8/commandProxy").add("Contacts",module.exports);
\ No newline at end of file
[3/3] git commit: Merge pull request #1 from
purplecabbage/CB-1291-Windows8
Posted by pu...@apache.org.
Merge pull request #1 from purplecabbage/CB-1291-Windows8
Cb 1291 windows8
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/92ebe1aa
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/92ebe1aa
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/92ebe1aa
Branch: refs/heads/master
Commit: 92ebe1aaf95de85d95b319fba11570605eea4706
Parents: 431eeea b1ec0bc
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Mar 13 22:58:26 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Mar 13 22:58:26 2014 -0700
----------------------------------------------------------------------
plugin.xml | 7 ++-
src/windows8/ContactProxy.js | 94 +++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[2/3] git commit: CB-1291 Windows8 added some contact conversion,
console.error on save because it is not supported
Posted by pu...@apache.org.
CB-1291 Windows8 added some contact conversion, console.error on save because it is not supported
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/b1ec0bc4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/b1ec0bc4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/b1ec0bc4
Branch: refs/heads/master
Commit: b1ec0bc49ca291c559d8a9b583ee8b192c21ca75
Parents: 04b96dc
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Mar 13 22:56:54 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Mar 13 22:56:54 2014 -0700
----------------------------------------------------------------------
src/windows8/ContactProxy.js | 61 +++++++++++++++++++++++++++++++++++++--
1 file changed, 59 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/b1ec0bc4/src/windows8/ContactProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/ContactProxy.js b/src/windows8/ContactProxy.js
index 888047a..db54a09 100644
--- a/src/windows8/ContactProxy.js
+++ b/src/windows8/ContactProxy.js
@@ -1,3 +1,4 @@
+// cordova.define("org.apache.cordova.contacts.ContactProxy", function (require, exports, module) {
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -25,13 +26,69 @@ module.exports = {
search:function(win,fail,args){
var fields = args[0];
var options = args[1];
+
+ var filter = options.filter;
+ var multiple = options.multiple;
+
+ var picker = new Windows.ApplicationModel.Contacts.ContactPicker();
+ picker.selectionMode = Windows.ApplicationModel.Contacts.ContactSelectionMode.contacts;
+ picker.pickSingleContactAsync().done(function (res) {
+
+ var contact = {
+ id:"",
+ name: { formatted: res.name }, // ContactName
+ displayName: res.name, // DOMString
+ nickname: res.name, // DOMString
+ phoneNumbers: res.phoneNumbers, // ContactField[]
+ addresses: res.locations, // ContactAddress[]
+ emails: [], // ContactField
+ ims: res.instantMessages, // ContactField[]
+ organizations: [], // ContactOrganization[]
+ birthday: null, // Date
+ note: "", // DOMString
+ photos: [], // ContactField[]
+ categories: [], // ContactField[]
+ urls: [] // ContactField[]
+ };
+
+ if (contact.phoneNumbers && contact.phoneNumbers.length) {
+ contact.phoneNumbers[0].pref = true; // cordova contact field needs a 'prefered' property on a contact
+ }
+
+ if (contact.addresses && contact.addresses.length) {
+ contact.addresses[0].pref = true;
+ // convert addresses/locations to Cordova.ContactAddresses
+ // pref: Set to true if this ContactAddress contains the user's preferred value. (boolean)
+ // type: A string indicating what type of field this is, home for example. (DOMString)
+ // formatted: The full address formatted for display. (DOMString)
+ // streetAddress: The full street address. (DOMString)
+ // locality: The city or locality. (DOMString)
+ // region: The state or region. (DOMString)
+ // postalCode: The zip code or postal code. (DOMString)
+ // country: The country name. (DOMString)
+ }
+ // Maybe, seems the types are compatible -jm
+ // convert ims to ContactField
+ //if (contact.ims && contact.ims.length) {
+ // // MS ContactInstantMessageField has : displayText, launchUri, service, userName, category, type
+ // for (var n = 0; n < contact.ims.length; n++) {
+ // contact.ims[n] = new ContactField(contact.ims[n].type,contact.ims[n].value, false);
+ // }
+ // }
+ //}
+ win([contact]);
+ });
},
save:function(win,fail,args){
- var contact = args[0];
+ console.error && console.error("Windows 8 does not support creating/saving contacts");
+ fail && setTimeout(function(){
+ fail(new Error("Contact create/save not supported on Windows8"));
+ },0);
}
}
-require("cordova/windows8/commandProxy").add("Contacts",module.exports);
\ No newline at end of file
+require("cordova/windows8/commandProxy").add("Contacts",module.exports);
+