[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-02 Thread purplecabbage
Github user purplecabbage commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161393743
  
Just make sure your name is on your github profile, which it appears to be. 
:+1: 
We just needed the name at https://github.com/sencenan to also appear at 
https://people.apache.org/committer-index.html so we can cross reference.
Looks good, thanks.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-02 Thread sencenan
Github user sencenan commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161390659
  
How would I associate my full name with my github id? I also fixed the 
problem with Google Photos which touches the same area of code. Should I remove 
this pull request and submit a new one?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-02 Thread riknoll
Github user riknoll commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161447751
  
@sencenan Sure, go ahead and submit a new PR. Tag both JIRA's in the commit 
message (CB-10093 and CB-9960) if you don't mind.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-02 Thread sencenan
Github user sencenan closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-02 Thread sencenan
Github user sencenan commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161523938
  
Making a new one.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread sencenan
Github user sencenan commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#discussion_r46334032
  
--- Diff: src/android/FileHelper.java ---
@@ -79,30 +79,59 @@ public static String getRealPath(String uriString, 
CordovaInterface cordova) {
 @SuppressLint("NewApi")
 public static String getRealPathFromURI_API19(Context context, Uri 
uri) {
 String filePath = "";
+
 try {
-String wholeID = DocumentsContract.getDocumentId(uri);
+String id;
+
+if (DocumentsContract.isDocumentUri(context, uri)) {
+String wholeID = DocumentsContract.getDocumentId(uri);
 
-// Split at colon, use second item in the array
-String id = wholeID.indexOf(":") > -1 ? wholeID.split(":")[1] 
: wholeID.indexOf(";") > -1 ? wholeID
-.split(";")[1] : wholeID;
+// Split at colon, use second item in the array
+id = wholeID.indexOf(":") > -1
+? wholeID.split(":")[1]
+: wholeID.indexOf(";") > -1
+? wholeID.split(";")[1]
+: wholeID;
+} else {
+final String uriStr = uri.toString();
+
+if (
--- End diff --

Done.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread sencenan
Github user sencenan commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#discussion_r46334003
  
--- Diff: src/android/FileHelper.java ---
@@ -79,30 +79,59 @@ public static String getRealPath(String uriString, 
CordovaInterface cordova) {
 @SuppressLint("NewApi")
 public static String getRealPathFromURI_API19(Context context, Uri 
uri) {
 String filePath = "";
+
 try {
-String wholeID = DocumentsContract.getDocumentId(uri);
+String id;
+
+if (DocumentsContract.isDocumentUri(context, uri)) {
+String wholeID = DocumentsContract.getDocumentId(uri);
 
-// Split at colon, use second item in the array
-String id = wholeID.indexOf(":") > -1 ? wholeID.split(":")[1] 
: wholeID.indexOf(";") > -1 ? wholeID
-.split(";")[1] : wholeID;
+// Split at colon, use second item in the array
+id = wholeID.indexOf(":") > -1
+? wholeID.split(":")[1]
+: wholeID.indexOf(";") > -1
+? wholeID.split(";")[1]
+: wholeID;
+} else {
+final String uriStr = uri.toString();
+
+if (
+uriStr.startsWith(
+
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString()
+)
+) {
+id = uriStr.substring(uriStr.lastIndexOf("/") + 1);
+} else {
+throw new IllegalArgumentException(
+"Cannot get real path from uri: " + uriStr
+);
+}
+}
 
 String[] column = { MediaStore.Images.Media.DATA };
 
 // where id is equal to
 String sel = MediaStore.Images.Media._ID + "=?";
 
-Cursor cursor = 
context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
 column,
-sel, new String[] { id }, null);
+Cursor cursor = context.getContentResolver().query(
--- End diff --

Done. However the existing line's readability is dubious at best.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread sencenan
Github user sencenan commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161089732
  
ICLA signed and mailed to. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread infil00p
Github user infil00p commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161047893
  
LGTM! @riknoll I don't see anything than formatting changes done to the 
ContentResolver, and this actually might fix a bug for the Camera as well, 
which uses the same method.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread riknoll
Github user riknoll commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161046152
  
Thanks! I can reproduce this (I used Marshmallow, but same difference). I 
also believe this is indeed a distinct issue from CB-9960. @infil00p would you 
mind checking this out? I'm not sure I know enough about ContentResolvers to 
merge this one in.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread riknoll
Github user riknoll commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#discussion_r46312504
  
--- Diff: src/android/FileHelper.java ---
@@ -79,30 +79,59 @@ public static String getRealPath(String uriString, 
CordovaInterface cordova) {
 @SuppressLint("NewApi")
 public static String getRealPathFromURI_API19(Context context, Uri 
uri) {
 String filePath = "";
+
 try {
-String wholeID = DocumentsContract.getDocumentId(uri);
+String id;
+
+if (DocumentsContract.isDocumentUri(context, uri)) {
+String wholeID = DocumentsContract.getDocumentId(uri);
 
-// Split at colon, use second item in the array
-String id = wholeID.indexOf(":") > -1 ? wholeID.split(":")[1] 
: wholeID.indexOf(";") > -1 ? wholeID
-.split(";")[1] : wholeID;
+// Split at colon, use second item in the array
+id = wholeID.indexOf(":") > -1
+? wholeID.split(":")[1]
+: wholeID.indexOf(";") > -1
+? wholeID.split(";")[1]
+: wholeID;
+} else {
+final String uriStr = uri.toString();
+
+if (
--- End diff --

Nitpick: maybe collapse the `if` statement to a single line (matches the 
style of the file better). 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread riknoll
Github user riknoll commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#discussion_r46312808
  
--- Diff: src/android/FileHelper.java ---
@@ -79,30 +79,59 @@ public static String getRealPath(String uriString, 
CordovaInterface cordova) {
 @SuppressLint("NewApi")
 public static String getRealPathFromURI_API19(Context context, Uri 
uri) {
 String filePath = "";
+
 try {
-String wholeID = DocumentsContract.getDocumentId(uri);
+String id;
+
+if (DocumentsContract.isDocumentUri(context, uri)) {
+String wholeID = DocumentsContract.getDocumentId(uri);
 
-// Split at colon, use second item in the array
-String id = wholeID.indexOf(":") > -1 ? wholeID.split(":")[1] 
: wholeID.indexOf(";") > -1 ? wholeID
-.split(";")[1] : wholeID;
+// Split at colon, use second item in the array
+id = wholeID.indexOf(":") > -1
+? wholeID.split(":")[1]
+: wholeID.indexOf(";") > -1
+? wholeID.split(";")[1]
+: wholeID;
+} else {
+final String uriStr = uri.toString();
+
+if (
+uriStr.startsWith(
+
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString()
+)
+) {
+id = uriStr.substring(uriStr.lastIndexOf("/") + 1);
+} else {
+throw new IllegalArgumentException(
+"Cannot get real path from uri: " + uriStr
+);
+}
+}
 
 String[] column = { MediaStore.Images.Media.DATA };
 
 // where id is equal to
 String sel = MediaStore.Images.Media._ID + "=?";
 
-Cursor cursor = 
context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
 column,
-sel, new String[] { id }, null);
+Cursor cursor = context.getContentResolver().query(
--- End diff --

Nitpick: Can we preserve the formatting of this? I don't think you changed 
the code here.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread riknoll
Github user riknoll commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161049522
  
Thanks! LGTM as well; I just wanted to double check.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-12-01 Thread sencenan
Github user sencenan commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-161008858
  
Hi, I will get the CLA signed later today when i have some time.

For step to reproduce try this:

- device: android 5.1
- use cordova to launch photo picker
- open sidebar pick "gallary" <-- important bit. see screenshot: 
http://i.imgur.com/WaeMhZv.png
- pick image from there

expect: the image to be picked
actual: cordova failure callback called. logcat shows exception outlined 
in: https://issues.apache.org/jira/browse/CB-10093


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-11-30 Thread riknoll
Github user riknoll commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-160815988
  
Thanks for the PR!

Can you provide the exact camera options you are testing with so that I can 
try this out? And when you say the gallery app, which are you referring to? I 
haven't had a problem testing with the default gallery app, but there is a 
known issue with Google Photos (see CB-9960). I don't think that particular 
issue is what you are addressing here.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] cordova-plugin-camera pull request: [CB-10093][android] fix failur...

2015-11-30 Thread riknoll
Github user riknoll commented on the pull request:


https://github.com/apache/cordova-plugin-camera/pull/141#issuecomment-160816613
  
Also, I don't see your name [in the CLA 
list](https://people.apache.org/committer-index.html#unlistedclas). For this to 
be eligible to be merged in, you'll need to sign and submit an ICLA (there are 
instructions for that 
[here](http://cordova.apache.org/contribute/contribute_guidelines.html)).


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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