You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by thehuijb <gi...@git.apache.org> on 2015/04/07 01:29:47 UTC

[GitHub] cordova-plugin-camera pull request: solves CB-8804 https://github....

GitHub user thehuijb opened a pull request:

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

    solves CB-8804 https://github.com/apache/cordova-plugin-camera#android-quirks

    added action checkForSavedResult to be called from javascript in ondeviceready.
    
    this pull request is an attempt to fix:
    
    Android Quirks
    
    Android uses intents to launch the camera activity on the device to capture images, and on phones with low memory, the Cordova activity may be killed. In this scenario, the image may not appear when the Cordova activity is restored.


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

    $ git pull https://github.com/thehuijb/cordova-plugin-camera feature/checkForSavedResult

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

    https://github.com/apache/cordova-plugin-camera/pull/83.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 #83
    
----
commit 36006517feac4b9e48b59e9d79a1fda9fdafe0cb
Author: Serge Huijben <s....@gmail.com>
Date:   2015-04-02T06:40:49Z

    add action checkForSavedResult,
    add mechanism to save an ActivityResult coming in after MainActivity was killed

commit c755ca399909805466ab40f2e2d27c5555c2355d
Author: Serge Huijben <s....@gmail.com>
Date:   2015-04-02T06:45:05Z

    add method checkForSavedResult to Camera.js

commit 6dc23cc0e9a7d080d571fb4b5251e42a98423257
Author: Serge Huijben <s....@gmail.com>
Date:   2015-04-02T09:26:08Z

    correct spelling of callback and return no-result

----


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#issuecomment-94953716
  
    alright, rebased to master, should be only my changes now.
    sorry about that, it still git's me sometimes


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#discussion_r28956355
  
    --- Diff: src/android/CameraLauncher.java ---
    @@ -163,7 +167,15 @@ else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) {
                 PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
                 r.setKeepCallback(true);
                 callbackContext.sendPluginResult(r);
    -            
    +
    +            return true;
    +        } else if (action.equals("checkForSavedResult")) {
    +            this.imageUri = Uri.fromFile(createCaptureFile(JPEG));
    --- End diff --
    
    right , should also do this when savedResultCode > 0


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#issuecomment-103346345
  
    @agrieve could you please have another look?


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#discussion_r28881896
  
    --- Diff: src/android/CameraLauncher.java ---
    @@ -163,7 +167,15 @@ else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) {
                 PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
                 r.setKeepCallback(true);
                 callbackContext.sendPluginResult(r);
    -            
    +
    +            return true;
    +        } else if (action.equals("checkForSavedResult")) {
    +            this.imageUri = Uri.fromFile(createCaptureFile(JPEG));
    +            if (savedRequestCode > 0) {
    +                onActivityResult(savedRequestCode, savedResultCode, savedIntent);
    +            } else {
    +                callbackContext.success("no-result");
    --- End diff --
    
    Would be much nicer if returned result was false when coerced to a boolean (so that they can do if (result)). So maybe return empty string or null.


---
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: solves CB-8804 https://github....

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

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


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#issuecomment-96914735
  
    Implemented changes based on @agrieve's input, could you have another look?


---
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: solves CB-8804 https://github....

Posted by Serge Huijben <s....@gmail.com>.
Any chance this PR https://github.com/apache/cordova-plugin-camera/pull/83 <https://github.com/apache/cordova-plugin-camera/pull/83> could get merged in?

regards Serge
a.k.a: thehuijb

[GitHub] cordova-plugin-camera pull request: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#discussion_r28882407
  
    --- Diff: www/Camera.js ---
    @@ -72,4 +72,8 @@ cameraExport.cleanup = function(successCallback, errorCallback) {
         exec(successCallback, errorCallback, "Camera", "cleanup", []);
     };
     
    +cameraExport.checkForSavedResult = function(successCallback, errorCallback) {
    --- End diff --
    
    Please update the plugin README.md with docs on this new API


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#issuecomment-94649473
  
    Anyone had a chance to look at this yet?
    I would appreciate any comments that help improve this PR


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#issuecomment-94831626
  
    just went to have a look but the diff has changes that you didn't make in it. Can you try rebasing?


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#discussion_r28881787
  
    --- Diff: src/android/CameraLauncher.java ---
    @@ -163,7 +167,15 @@ else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) {
                 PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
                 r.setKeepCallback(true);
                 callbackContext.sendPluginResult(r);
    -            
    +
    +            return true;
    +        } else if (action.equals("checkForSavedResult")) {
    +            this.imageUri = Uri.fromFile(createCaptureFile(JPEG));
    --- End diff --
    
    should you do this only when savedRequestCode > 0?


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#issuecomment-104157604
  
    forget about it


---
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: solves CB-8804 https://github....

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

    https://github.com/apache/cordova-plugin-camera/pull/83#discussion_r28882307
  
    --- Diff: src/android/CameraLauncher.java ---
    @@ -632,73 +645,79 @@ else if (destType == FILE_URI || destType == NATIVE_URI) {
          */
         public void onActivityResult(int requestCode, int resultCode, Intent intent) {
     
    -        // Get src and dest types from request code for a Camera Activity
    -        int srcType = (requestCode / 16) - 1;
    -        int destType = (requestCode % 16) - 1;
    -
    -        // If Camera Crop
    -        if (requestCode >= CROP_CAMERA) {
    -            if (resultCode == Activity.RESULT_OK) {
    +        if (this.imageUri == null && this.getPictureFromGallery == false) {
    --- End diff --
    
    Would it be more appropriate to check if `callbackContext == null`? An app can be evicted even when getting a picture from the gallery.


---
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