cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [11/26] js commit: [Tizen, Tisen SDK 2.0 (Magnolia)]
Date Fri, 17 May 2013 17:53:29 GMT
[Tizen, Tisen SDK 2.0 (Magnolia)]

Adapt Camera to New SDK

Application Service manager was renamed ApplicationControl
Applyed related Changes
plus some cleaning, renaming ...


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

Branch: refs/heads/3.0.0
Commit: c139ba07796f015973be03956f6998f6820f95f1
Parents: cbb57b6
Author: pplaquette <pplaquette@apache.org>
Authored: Wed Apr 17 11:20:03 2013 +0200
Committer: pplaquette <pplaquette@apache.org>
Committed: Fri Apr 19 11:07:14 2013 +0200

----------------------------------------------------------------------
 lib/tizen/plugin/tizen/Camera.js |   75 ++++++++++++++++++++-------------
 1 files changed, 46 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c139ba07/lib/tizen/plugin/tizen/Camera.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Camera.js b/lib/tizen/plugin/tizen/Camera.js
index 0a21c19..f88b6fc 100644
--- a/lib/tizen/plugin/tizen/Camera.js
+++ b/lib/tizen/plugin/tizen/Camera.js
@@ -22,12 +22,13 @@
 /*global tizen:false */
 var Camera = require('cordova/plugin/CameraConstants');
 
-function makeReplyCallback(successCallback, errorCallback) {
+function cameraMakeReplyCallback(successCallback, errorCallback) {
     return {
         onsuccess: function(reply) {
             if (reply.length > 0) {
                 successCallback(reply[0].value);
-            } else {
+            }
+            else {
                 errorCallback('Picture selection aborted');
             }
         },
@@ -43,6 +44,7 @@ module.exports = {
             sourceType = args[2],
             encodingType = args[5],
             mediaType = args[6];
+
             // Not supported
             /*
             quality = args[0]
@@ -53,34 +55,49 @@ module.exports = {
             saveToPhotoAlbum = args[9]
             */
 
-        if (destinationType !== Camera.DestinationType.FILE_URI) {
-            errorCallback('DestinationType not supported');
-            return;
-        }
-        if (mediaType !== Camera.MediaType.PICTURE) {
-            errorCallback('MediaType not supported');
-            return;
-        }
+            if (destinationType !== Camera.DestinationType.FILE_URI) {
+                errorCallback('DestinationType not supported');
+                return;
+            }
 
-        var mimeType;
-        if (encodingType === Camera.EncodingType.JPEG) {
-            mimeType = 'image/jpeg';
-        } else if (encodingType === Camera.EncodingType.PNG) {
-            mimeType = 'image/png';
-        } else {
-            mimeType = 'image/*';
-        }
+            if (mediaType !== Camera.MediaType.PICTURE) {
+                errorCallback('MediaType not supported');
+                return;
+            }
 
-        var serviceId;
-        if (sourceType === Camera.PictureSourceType.CAMERA) {
-            serviceId = 'http://tizen.org/appsvc/operation/create_content';
-        } else {
-            serviceId = 'http://tizen.org/appsvc/operation/pick';
-        }
+            var mimeType;
+            if (encodingType === Camera.EncodingType.JPEG) {
+                mimeType = 'image/jpeg';
+            }
+            else if (encodingType === Camera.EncodingType.PNG) {
+                mimeType = 'image/png';
+            }
+            else {
+                mimeType = 'image/*';
+            }
+
+            var serviceId;
+            if (sourceType === Camera.PictureSourceType.CAMERA) {
+                serviceId = 'http://tizen.org/appcontrol/operation/create_content';
+            }
+            else {
+                serviceId = 'http://tizen.org/appcontrol/operation/pick';
+            }
 
-        var service = new tizen.ApplicationService(serviceId, null, mimeType, null);
-        tizen.application.launchService(service, null, null,
-                function(error) { errorCallback(error.message); },
-                makeReplyCallback(successCallback, errorCallback));
-    }
+            var serviceControl = new tizen.ApplicationControl(
+                                serviceId,
+                                null,
+                                mimeType,
+                                null);
+
+            tizen.application.launchAppControl(
+                    serviceControl,
+                    null,
+                    null,
+                    function(error) {
+                        errorCallback(error.message);
+                    },
+                    cameraMakeReplyCallback(successCallback, errorCallback)
+            );
+        }
 };


Mime
View raw message