cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lorinb...@apache.org
Subject [11/33] js commit: [BlackBerry10] Start the process of moving out the core plugins, beginning with Device.
Date Tue, 14 May 2013 18:32:53 GMT
[BlackBerry10] Start the process of moving out the core plugins, beginning with Device.

Reviewed by Jeffrey Heifetz <jheifetz@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/d5ec1d29
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d5ec1d29
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d5ec1d29

Branch: refs/heads/master
Commit: d5ec1d2974444fbddd3aff5b0f44ad558d06ecdc
Parents: d4fa7d3
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Mon Mar 18 20:52:55 2013 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Fri May 3 09:49:38 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/plugin/blackberry10/device.js  |   41 -------------
 lib/blackberry10/plugin/blackberry10/manager.js |   14 ++---
 lib/scripts/bootstrap-blackberry10.js           |    8 ++-
 test/blackberry10/test.device.js                |   48 ---------------
 test/blackberry10/test.manager.js               |   56 ------------------
 5 files changed, 10 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d5ec1d29/lib/blackberry10/plugin/blackberry10/device.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/device.js b/lib/blackberry10/plugin/blackberry10/device.js
deleted file mode 100644
index 8898e09..0000000
--- a/lib/blackberry10/plugin/blackberry10/device.js
+++ /dev/null
@@ -1,41 +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 channel = require('cordova/channel'),
-    cordova = require('cordova');
-
-// Tell cordova channel to wait on the CordovaInfoReady event
-channel.waitForInitialization('onCordovaInfoReady');
-
-module.exports = {
-    getDeviceInfo : function(args, win, fail){
-        win({
-            platform: "BlackBerry",
-            version: blackberry.system.softwareVersion,
-            model: "Dev Alpha",
-            name: "Dev Alpha", // deprecated: please use device.model
-            uuid: blackberry.identity.uuid,
-            cordova: CORDOVA_JS_BUILD_LABEL
-        });
-
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned"
};
-    }
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d5ec1d29/lib/blackberry10/plugin/blackberry10/manager.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/manager.js b/lib/blackberry10/plugin/blackberry10/manager.js
index 8307c74..76476be 100644
--- a/lib/blackberry10/plugin/blackberry10/manager.js
+++ b/lib/blackberry10/plugin/blackberry10/manager.js
@@ -23,7 +23,6 @@ var cordova = require('cordova'),
     plugins = {
         'NetworkStatus' : require('cordova/plugin/blackberry10/network'),
         'Accelerometer' : require('cordova/plugin/blackberry10/accelerometer'),
-        'Device' : require('cordova/plugin/blackberry10/device'),
         'Battery' : require('cordova/plugin/blackberry10/battery'),
         'Compass' : require('cordova/plugin/blackberry10/magnetometer'),
         'Camera' : require('cordova/plugin/blackberry10/camera'),
@@ -43,15 +42,12 @@ module.exports = {
     exec: function (win, fail, clazz, action, args) {
         var result = {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message"
: "Class " + clazz + " cannot be found"};
 
-        if (plugins[clazz]) {
-            if (plugins[clazz][action]) {
-                result = plugins[clazz][action](args, win, fail);
-            }
-            else {
-                result = { "status" : cordova.callbackStatus.INVALID_ACTION, "message" :
"Action not found: " + action };
-            }
+        if (plugins[clazz] && plugins[clazz][action]) {
+            result = plugins[clazz][action](args, win, fail);
+        }
+        else {
+            result = webworks.exec(win, fail, clazz, action, args);
         }
-
         return result;
     },
     resume: function () {},

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d5ec1d29/lib/scripts/bootstrap-blackberry10.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-blackberry10.js b/lib/scripts/bootstrap-blackberry10.js
index 8c97e46..153d2c9 100644
--- a/lib/scripts/bootstrap-blackberry10.js
+++ b/lib/scripts/bootstrap-blackberry10.js
@@ -55,8 +55,10 @@
                 fireWebworksReadyEvent();
             });
         },
-        function (e) {
-            console.log(e);
+        function () {
+            console.log('Unable to load plugins.json');
+            webworksReady = true;
+            fireWebworksReadyEvent();
         }
     );
 
@@ -106,7 +108,7 @@
                 throw data;
             }
 
-            return data;
+            return { status: 0 };
         };
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d5ec1d29/test/blackberry10/test.device.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.device.js b/test/blackberry10/test.device.js
deleted file mode 100644
index 66f3813..0000000
--- a/test/blackberry10/test.device.js
+++ /dev/null
@@ -1,48 +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.
- *
-*/
-
-describe("blackberry10 device", function () {
-    var device = require('cordova/plugin/blackberry10/device');
-    
-    it("calls the win callback with the device info", function () {
-        global.blackberry = {
-            system: {
-                softwareVersion: "NaN"
-            },
-            identity: {
-                uuid: 1
-            }
-        };
-
-        var info;
-
-        //HACK: I know this is a sync call ;)
-        device.getDeviceInfo({}, function (i) { info = i; });
-
-        expect(info.platform).toBe("BlackBerry");
-        expect(info.version).toBe("NaN");
-        expect(info.name).toBe("Dev Alpha");
-        expect(info.uuid).toBe(1);
-        expect(info.cordova).toBeDefined();
-        
-        delete global.blackberry;
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d5ec1d29/test/blackberry10/test.manager.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.manager.js b/test/blackberry10/test.manager.js
deleted file mode 100644
index 5899fd3..0000000
--- a/test/blackberry10/test.manager.js
+++ /dev/null
@@ -1,56 +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.
- *
-*/
-
-describe("blackberry10 manager", function () {
-    var manager = require('cordova/plugin/blackberry10/manager');
-
-    it("calls the plugin", function () {
-        var device = require('cordova/plugin/blackberry10/device'),
-            win = jasmine.createSpy('win'),
-            fail = jasmine.createSpy('fail'),
-            args = {};
-
-        spyOn(device, "getDeviceInfo");
-
-        manager.exec(win, fail, "Device", "getDeviceInfo", args);
-        expect(device.getDeviceInfo).toHaveBeenCalledWith(args, win, fail);
-    });
-
-    it("returns the result of the plugin", function () {
-        var camera = require('cordova/plugin/blackberry10/camera');
-        spyOn(camera, "takePicture").andReturn("duckface");
-        expect(manager.exec(null, null, "Camera", "takePicture")).toBe("duckface");
-    });
-
-    it("returns class not found when no plugin", function () {
-        expect(manager.exec(null, null, "Ruby", "method_missing")).toEqual({
-           status: cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION,
-           message: "Class Ruby cannot be found"
-        });
-    });
-
-    it("returns invalid action when no action", function () {
-        expect(manager.exec(null, null, "Camera", "makePonies")).toEqual({
-            status: cordova.callbackStatus.INVALID_ACTION,
-            message: "Action not found: makePonies"
-        });
-    });
-});


Mime
View raw message