ripple-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject incubator-ripple git commit: Fixed RIPPLE-94 bugs in Console and Contacts APIs
Date Thu, 23 Jul 2015 05:05:33 GMT
Repository: incubator-ripple
Updated Branches:
  refs/heads/master ba38300b0 -> 39a027625


Fixed RIPPLE-94 bugs in Console and Contacts APIs

This commit fixes some problems with the Console plugin emulation as well
as the Contacts plugin emulation.  These bugs were discovered by running
the Mobile Spec test under emulation.


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

Branch: refs/heads/master
Commit: 39a027625248734496de46d46339533356a7a29a
Parents: ba38300
Author: Julian Horn <julian.c.horn@intel.com>
Authored: Tue Jul 21 16:58:40 2015 -0400
Committer: Julian Horn <julian.c.horn@intel.com>
Committed: Tue Jul 21 16:58:40 2015 -0400

----------------------------------------------------------------------
 lib/client/platform/cordova/2.0.0/bridge.js          |  1 +
 lib/client/platform/cordova/2.0.0/bridge/console.js  | 10 ++++++++++
 lib/client/platform/cordova/2.0.0/bridge/contacts.js | 13 ++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/39a02762/lib/client/platform/cordova/2.0.0/bridge.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/2.0.0/bridge.js b/lib/client/platform/cordova/2.0.0/bridge.js
index 9e49b78..0ed76fa 100644
--- a/lib/client/platform/cordova/2.0.0/bridge.js
+++ b/lib/client/platform/cordova/2.0.0/bridge.js
@@ -26,6 +26,7 @@ var _prompt = ripple('ui/plugins/exec-dialog'),
         "Compass": ripple('platform/cordova/2.0.0/bridge/compass'),
         "Camera": ripple('platform/cordova/2.0.0/bridge/camera'),
         "Capture": ripple('platform/cordova/2.0.0/bridge/capture'),
+        "Console": ripple('platform/cordova/2.0.0/bridge/console'),
         "Contacts": ripple('platform/cordova/2.0.0/bridge/contacts'),
         "Debug Console": ripple('platform/cordova/2.0.0/bridge/console'),
         "Device": ripple('platform/cordova/2.0.0/bridge/device'),

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/39a02762/lib/client/platform/cordova/2.0.0/bridge/console.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/2.0.0/bridge/console.js b/lib/client/platform/cordova/2.0.0/bridge/console.js
index 777bb82..8b8d2f0 100644
--- a/lib/client/platform/cordova/2.0.0/bridge/console.js
+++ b/lib/client/platform/cordova/2.0.0/bridge/console.js
@@ -22,5 +22,15 @@
 module.exports = {
     log: function (win, fail, args) {
         console.log(args[0]);
+    },
+    logLevel: function (win, fail, args) {
+        var message = args[1];
+        switch (args[0]) {
+            case 'ERROR': console.log("ERROR: " + message); break;
+            case 'WARN':  console.log("WARN: "  + message); break;
+            case 'INFO':  console.log("INFO: "  + message); break;
+            case 'DEBUG': console.log("DEBUG: " + message); break;
+            default:      console.log(message);             break;
+        }
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/39a02762/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 6424f0c..3fb7a64 100644
--- a/lib/client/platform/cordova/2.0.0/bridge/contacts.js
+++ b/lib/client/platform/cordova/2.0.0/bridge/contacts.js
@@ -141,6 +141,16 @@ _self = {
 
             if (index >= 0) {
                 utils.mixin(contact, contacts[index]);
+                // Note: setting the email[i].value to "" is supposed to delete that email
entry from the array
+                // according to the Mobile Spec test
+                var i = 0;
+                while (i < contact.emails.length) {
+                    if (!contact.emails[i].value) {
+                        contact.emails.splice(i, 1); // remove that array entry
+                    } else {
+                        i = i + 1;
+                    }
+                }
                 contact = contacts[index];
             } else {
                 contact = null;
@@ -167,7 +177,8 @@ _self = {
                 success();
             }
         } else {
-            error({code: 3, message: "could not find contact with id (" + id + ")"}); //
PENDING_OPERATION_ERROR
+            // Deleting a non-existent contact should return Contacts.UNKNOWN_ERROR according
to Mobile Spec test
+            error(0); // 0 === Contacts.UNKNOWN_ERROR
         }
     }
 };


Mime
View raw message