You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/05/14 20:33:00 UTC

[18/33] js commit: [BlackBerry10] Removed Notication API implementation

[BlackBerry10] Removed Notication API implementation

- now exists as core plugin in template
- clobbered navigation.notification.vibrate()

Reviewed by Bryan Higgins <bh...@blackberry.com>
Tested by Tracy Li <tl...@blackberry.com>


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/b205fd1d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/b205fd1d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/b205fd1d

Branch: refs/heads/master
Commit: b205fd1da28aa4619731c6fcd5a85be05c9ab120
Parents: 64b5b08
Author: jkeshavarzi <jk...@blackberry.com>
Authored: Mon Apr 8 15:22:44 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri May 3 09:49:39 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/exec.js                           |    1 -
 .../plugin/blackberry10/notification.js            |   52 ---------------
 lib/blackberry10/plugin/blackberry10/platform.js   |   11 +++
 lib/blackberry10/plugin/blackberry10/vibrate.js    |   31 +++++++++
 4 files changed, 42 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b205fd1d/lib/blackberry10/exec.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/exec.js b/lib/blackberry10/exec.js
index 80fa69e..ad9c673 100644
--- a/lib/blackberry10/exec.js
+++ b/lib/blackberry10/exec.js
@@ -24,7 +24,6 @@ var cordova = require('cordova'),
         'Accelerometer' : require('cordova/plugin/blackberry10/accelerometer'),
         'Compass' : require('cordova/plugin/blackberry10/magnetometer'),
         'Capture' : require('cordova/plugin/blackberry10/capture'),
-        'Notification' : require('cordova/plugin/blackberry10/notification'),
         'Media': require('cordova/plugin/blackberry10/media'),
         'FileTransfer': require('cordova/plugin/blackberry10/fileTransfer')
     };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b205fd1d/lib/blackberry10/plugin/blackberry10/notification.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/notification.js b/lib/blackberry10/plugin/blackberry10/notification.js
deleted file mode 100644
index 9de87b8..0000000
--- a/lib/blackberry10/plugin/blackberry10/notification.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * 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 = {
-    alert: function (args, win, fail) {
-        if (args.length !== 3) {
-            return {"status" : 9, "message" : "Notification action - alert arguments not found"};
-        }
-
-        //Unpack and map the args
-        var msg = args[0],
-            title = args[1],
-            btnLabel = args[2];
-
-        blackberry.ui.dialog.customAskAsync.apply(this, [ msg, [ btnLabel ], win, { "title" : title } ]);
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
-    },
-    confirm: function (args, win, fail) {
-        if (args.length !== 3) {
-            return {"status" : 9, "message" : "Notification action - confirm arguments not found"};
-        }
-
-        //Unpack and map the args
-        var msg = args[0],
-            title = args[1],
-            btnLabel = args[2],
-            btnLabels = btnLabel.split(",");
-
-        blackberry.ui.dialog.customAskAsync.apply(this, [msg, btnLabels, win, {"title" : title} ]);
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
-    }
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b205fd1d/lib/blackberry10/plugin/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/platform.js b/lib/blackberry10/plugin/blackberry10/platform.js
index 9678434..b283554 100644
--- a/lib/blackberry10/plugin/blackberry10/platform.js
+++ b/lib/blackberry10/plugin/blackberry10/platform.js
@@ -46,6 +46,17 @@ module.exports = {
     clobbers: {
         requestFileSystem: {
             path: "cordova/plugin/blackberry10/requestFileSystem"
+        },
+        navigator: {
+            children: {
+                notification: {
+                    children: {
+                        vibrate: {
+                            path: 'cordova/plugin/blackberry10/vibrate'
+                        }
+                    }
+                }
+            }
         }
     },
     merges: {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b205fd1d/lib/blackberry10/plugin/blackberry10/vibrate.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/vibrate.js b/lib/blackberry10/plugin/blackberry10/vibrate.js
new file mode 100644
index 0000000..ba05294
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/vibrate.js
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+module.exports = function (time) {
+    var proto = Object.getPrototypeOf(navigator);
+
+    if (proto && proto.vibrate) {
+        proto.vibrate(time);
+    } else if (proto && proto.webkitVibrate) {
+        //Older OS contain webkit prefix
+        proto.webkitVibrate(time);
+    }
+};