New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-25259] Android: Use ContentProvider to obtain image preview #9419
Conversation
1bde670
to
f7c4ca3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
Generated by 🚫 dangerJS |
TiIntentWrapper previewIntent = new TiIntentWrapper(intent); | ||
String mimeType = image.getMimeType(); | ||
Uri imageUri = TiFileProvider.createUriFrom(f.getNativeFile()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getNativeFile()
method can return null
if:
- The photo came from the cloud.
- The image was loaded from a blob. (Can test with
View.toImage()
.)
Calling getNativeFile()
will crash with a NullPointerException
for the above case too unless my code changes from PR #9223 gets merged in. (Required fixes to TitaniumBlob
and TiBlob
.)
Ideally, we should store the image to a temp file if it's in pure blob form before previewing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this a separate bug-fix/PR if you want, because it looks like the issue I mentioned was always there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this should be a separate issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I just wrote up a ticket with a reproducible case here...
https://jira.appcelerator.org/browse/TIMOB-25619
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
FR Passed. No Studio Ver: 5.0.0.201712081732 |
@garymathews , Can you please add tests. |
4f72408
to
03c64da
Compare
TiFileProvider
to obtain theUri
for the image preview for compatibility with Android 7.0+TEST CASE
NOTE: Also test this on KitKat (4.4) and below devices, there could be a separate issue writing to external storage. But I do not have a device with 4.4 to verify this.
JIRA Ticket