You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by br...@apache.org on 2013/07/05 21:00:41 UTC

git commit: RIPPLE-26 Fixing Contacts API for correct functioning with cordova versions later than 2.2.0

Updated Branches:
  refs/heads/next ad17f9798 -> 9195afc73


RIPPLE-26 Fixing Contacts API for correct functioning with cordova versions later than 2.2.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/9195afc7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/9195afc7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/9195afc7

Branch: refs/heads/next
Commit: 9195afc73535d2fbb348ef0bce1c88cfac7694c6
Parents: ad17f97
Author: Ilya Buziuk <ib...@exadel.com>
Authored: Tue Jun 18 14:17:04 2013 +0300
Committer: Brent Lintner <br...@gmail.com>
Committed: Fri Jul 5 14:51:02 2013 -0400

----------------------------------------------------------------------
 lib/client/platform/cordova/2.0.0/bridge/contacts.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/9195afc7/lib/client/platform/cordova/2.0.0/bridge/contacts.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/2.0.0/bridge/contacts.js b/lib/client/platform/cordova/2.0.0/bridge/contacts.js
index 16fd76b..6424f0c 100644
--- a/lib/client/platform/cordova/2.0.0/bridge/contacts.js
+++ b/lib/client/platform/cordova/2.0.0/bridge/contacts.js
@@ -20,6 +20,7 @@
  */
 var db = ripple('db'),
     utils = ripple('utils'),
+    emulatorBridge = ripple('emulatorBridge'),
     _self;
 
 function _default() {
@@ -45,13 +46,13 @@ function _default() {
         "emails": [{type: "work", value: "mark@tinyhippos.com", pref: false}]
     }].map(function (obj) {
         obj.id = Math.uuid(undefined, 16);
-        return navigator.contacts.create(obj);
+        return emulatorBridge.window().navigator.contacts.create(obj);
     });
 }
 
 function _get() {
     var contacts = db.retrieveObject("cordova-contacts");
-    if (!contacts) {
+    if (!contacts) {
         contacts = _default();
         _save(contacts);
     }
@@ -85,7 +86,7 @@ _self = {
         var fields = args[0],
             options = args[1],
             foundContacts = [],
-            tempContact = navigator.contacts.create(),
+            tempContact = emulatorBridge.window().navigator.contacts.create(),
             contacts = _get();
 
         options = options || {};
@@ -99,7 +100,7 @@ _self = {
 
         if (fields.length > 0) {
             contacts.forEach(function (contact) {
-                var newContact = navigator.contacts.create(contact);
+                var newContact = emulatorBridge.window().navigator.contacts.create(contact);
 
                 if (options && (!_filtered(contact, options))) {
                     return;