You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by purplecabbage <gi...@git.apache.org> on 2015/05/19 06:45:51 UTC

[GitHub] cordova-plugin-camera pull request: major refactor : readability

GitHub user purplecabbage opened a pull request:

    https://github.com/apache/cordova-plugin-camera/pull/96

    major refactor : readability

    aliased lots of the super long namespaces so we aren't fighting past with the 100 char line.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/purplecabbage/cordova-plugin-camera master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-camera/pull/96.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #96
    
----
commit 15f66bf5cd446fa4636a7132976140a7e5295712
Author: Jesse MacFadyen <pu...@gmail.com>
Date:   2015-05-19T04:38:34Z

    major refactor : readability

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: [windows] major refactor : rea...

Posted by muratsu <gi...@git.apache.org>.
Github user muratsu commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/96#discussion_r30757436
  
    --- Diff: src/windows/CameraProxy.js ---
    @@ -546,20 +575,31 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
         }
     
         // decide which max pixels should be supported by targetWidth or targetHeight.
    -    if (targetWidth >= 1280 || targetHeight >= 960) {
    -        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.large3M;
    -    } else if (targetWidth >= 1024 || targetHeight >= 768) {
    -        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga;
    -    } else if (targetWidth >= 800 || targetHeight >= 600) {
    -        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga;
    -    } else if (targetWidth >= 640 || targetHeight >= 480) {
    -        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.smallVga;
    -    } else if (targetWidth >= 320 || targetHeight >= 240) {
    -        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.verySmallQvga;
    -    } else {
    -        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.highestAvailable;
    +    var maxRes = null;
    +    var UIMaxRes = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution;
    +    switch (true) {
    +        case (targetWidth >= 1280 || targetHeight >= 960) :
    +            cameraCaptureUI.photoSettings.maxResolution = UIMaxRes.large3M;
    +            break;
    +        case (targetWidth >= 1024 || targetHeight >= 768) :
    +            maxRes = UIMaxRes.mediumXga;
    +            break;
    +        case    (targetWidth >= 800 || targetHeight >= 600) :
    +            maxRes = UIMaxRes.mediumXga;
    +            break;
    +        case  (targetWidth >= 640 || targetHeight >= 480) :
    +            maxRes = UIMaxRes.smallVga;
    +            break;
    +        case    (targetWidth >= 320 || targetHeight >= 240) :
    +            maxRes = UIMaxRes.verySmallQvga;
    +            break;
    +        default :
    +            maxRes = UIMaxRes.highestAvailable;
         }
     
    +    cameraCaptureUI.photoSettings.maxResolution = maxRes;
    +
    +
    --- End diff --
    
    nitpick: extra line


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: [windows] major refactor : rea...

Posted by muratsu <gi...@git.apache.org>.
Github user muratsu commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/96#issuecomment-104064883
  
    :shipit: looks awesome thanks for doing this!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: [windows] major refactor : rea...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-camera/pull/96


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: [windows] major refactor : rea...

Posted by muratsu <gi...@git.apache.org>.
Github user muratsu commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/96#discussion_r30757483
  
    --- Diff: src/windows/CameraProxy.js ---
    @@ -69,11 +83,13 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
             tempPhotoFileName = "camera_cordova_temp_return.jpg";
         }
     
    -    var storageFolder = Windows.Storage.ApplicationData.current.localFolder;
    +    var storageFolder = getAppData().localFolder;
         file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting)
    -        .then(function (storageFile) { return Windows.Storage.FileIO.readBufferAsync(storageFile); })
    +        .then(function (storageFile) {
    +            return fileIO.readBufferAsync(storageFile);
    +        })
             .then(function(buffer) {
    -            var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
    +            var strBase64 =encodeToBase64String(buffer);
    --- End diff --
    
    nitpick: no space after =


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: [windows] major refactor : rea...

Posted by muratsu <gi...@git.apache.org>.
Github user muratsu commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/96#discussion_r30757496
  
    --- Diff: src/windows/CameraProxy.js ---
    @@ -111,8 +127,8 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
     
     // Because of asynchronous method, so let the successCallback be called in it.
     function resizeImageBase64(successCallback, errorCallback, file, targetWidth, targetHeight) {
    -    Windows.Storage.FileIO.readBufferAsync(file).done( function(buffer) {
    -        var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
    +    fileIO.readBufferAsync(file).done( function(buffer) {
    +        var strBase64 =encodeToBase64String(buffer);
    --- End diff --
    
    nitpick: no space after =


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org