incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [2/28] git commit: Restore 1.2 camera and capture functionality.
Date Tue, 03 Jan 2012 20:22:58 GMT
Restore 1.2 camera and capture functionality.

 - Move the camera, capture JS implementation from common
   WebWorks file to Playbook specific file.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/1bba38aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/1bba38aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/1bba38aa

Branch: refs/heads/master
Commit: 1bba38aaa136f794e217384c9ce0fd92fdb6d254
Parents: 27af4e9
Author: Drew Walters <deedubbu@gmail.com>
Authored: Thu Dec 15 10:47:50 2011 -0600
Committer: Fil Maj <filip.maj@nitobi.com>
Committed: Sat Dec 17 15:09:39 2011 -0800

----------------------------------------------------------------------
 javascript/playbook/playBookPluginManager.js |   59 ++++++++++++++++++-
 javascript/webWorksPluginManager.js          |   66 +--------------------
 2 files changed, 61 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/1bba38aa/javascript/playbook/playBookPluginManager.js
----------------------------------------------------------------------
diff --git a/javascript/playbook/playBookPluginManager.js b/javascript/playbook/playBookPluginManager.js
index 3b237a0..94c783b 100644
--- a/javascript/playbook/playBookPluginManager.js
+++ b/javascript/playbook/playBookPluginManager.js
@@ -16,6 +16,16 @@ phonegap.PluginManager = (function (webworksPluginManager) {
     var audioObjects = {},
         retInvalidAction = { "status" : PhoneGap.callbackStatus.INVALID_ACTION, "message"
: "Action not found" },
         retAsyncCall = { "status" : PhoneGap.callbackStatus.NO_RESULT, "message" : "WebWorks
Is On It" },
+        cameraAPI = {
+            execute: function (action, args, win, fail) {
+                switch (action) {
+                case 'takePicture':
+                    blackberry.media.camera.takePicture(win, fail, fail);
+                    return retAsyncCall;
+                }
+                return retInvalidAction;
+            }
+        },
         deviceAPI = {
             execute: function (webWorksResult, action, args, win, fail) {
                 if (action === 'getDeviceInfo') {
@@ -142,6 +152,52 @@ phonegap.PluginManager = (function (webworksPluginManager) {
                 return result;
             }
         },
+        mediaCaptureAPI = {
+            execute: function (action, args, win, fail) {
+                var limit = args[0],
+                    pictureFiles = [],
+                    captureMethod;
+
+                function captureCB(filePath) {
+                    var mediaFile;
+
+                    if (filePath) {
+                        mediaFile = new MediaFile();
+                        mediaFile.fullPath = filePath;
+                        pictureFiles.push(mediaFile);
+                    }
+
+                    if (limit > 0) {
+                        limit--;
+                        blackberry.media.camera[captureMethod](win, fail, fail);
+                        return;
+                    }
+
+                    win(pictureFiles);
+
+                    return retAsyncCall;
+                }
+
+                switch (action) {
+                    case 'getSupportedAudioModes':
+                    case 'getSupportedImageModes':
+                    case 'getSupportedVideoModes':
+                        return {"status": PhoneGap.callbackStatus.OK, "message": []};
+                    case 'captureImage':
+                        captureMethod = "takePicture";
+                        captureCB();
+                        break;
+                    case 'captureVideo':
+                        captureMethod = "takeVideo";
+                        captureCB();
+                        break;
+                    case 'captureAudio':
+                        return {"status": PhoneGap.callbackStatus.INVALID_ACTION, "message":
"captureAudio is not currently supported"};
+                }
+
+                return retAsyncCall;
+            }
+        },
 
         networkAPI = {
             execute: function (webWorksResult, action, args, win, fail) {
@@ -203,11 +259,12 @@ phonegap.PluginManager = (function (webworksPluginManager) {
             }
         },
 
-
         plugins = {
+            'Camera' : cameraAPI,
             'Device' : deviceAPI,
             'Logger' : loggerAPI,
             'Media' : mediaAPI,
+            'MediaCapture' : mediaCaptureAPI,
             'Network Status' : networkAPI,
             'Notification' : notificationAPI
         };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/1bba38aa/javascript/webWorksPluginManager.js
----------------------------------------------------------------------
diff --git a/javascript/webWorksPluginManager.js b/javascript/webWorksPluginManager.js
index 469cd30..cd41b27 100644
--- a/javascript/webWorksPluginManager.js
+++ b/javascript/webWorksPluginManager.js
@@ -14,69 +14,9 @@ if (!window.phonegap) { window.phonegap = {}; }
     "use strict";
     var retAsyncCall = { "status" : PhoneGap.callbackStatus.NO_RESULT, "message" : "WebWorks
Is On It" },
         retInvalidAction = { "status" : PhoneGap.callbackStatus.INVALID_ACTION, "message"
: "Action not found" },
-
-        cameraAPI = {
-            execute: function (action, args, win, fail) {
-                switch (action) {
-                case 'takePicture':
-                    blackberry.media.camera.takePicture(win, fail, fail);
-                    return retAsyncCall;
-                }
-                return retInvalidAction;
-            }
-        },
-
-        mediaCaptureAPI = {
-            execute: function (action, args, win, fail) {
-                var limit = args[0],
-                    pictureFiles = [],
-                    captureMethod;
-
-                function captureCB(filePath) {
-                    var mediaFile;
-
-                    if (filePath) {
-                        mediaFile = new MediaFile();
-                        mediaFile.fullPath = filePath;
-                        pictureFiles.push(mediaFile);
-                    }
-
-                    if (limit > 0) {
-                        limit--;
-                        blackberry.media.camera[captureMethod](win, fail, fail);
-                        return;
-                    }
-
-                    win(pictureFiles);
-
-                    return retAsyncCall;
-                }
-
-                switch (action) {
-                case 'getSupportedAudioModes':
-                case 'getSupportedImageModes':
-                case 'getSupportedVideoModes':
-                    return {"status": PhoneGap.callbackStatus.OK, "message": []};
-                case 'captureImage':
-                    captureMethod = "takePicture";
-                    captureCB();
-                    break;
-                case 'captureVideo':
-                    captureMethod = "takeVideo";
-                    captureCB();
-                    break;
-                case 'captureAudio':
-                    return {"status": PhoneGap.callbackStatus.INVALID_ACTION, "message":
"captureAudio is not currently supported"};
-                }
-
-                return retAsyncCall;
-            }
-        },
-
-        plugins = {
-            'Camera' : cameraAPI,
-            'MediaCapture' : mediaCaptureAPI
-        };
+        // Define JavaScript plugin implementations that are common across
+        // WebWorks platforms (phone/tablet).
+        plugins = {};
 
 	phonegap.WebWorksPluginManager = function () {
 	};


Mime
View raw message