-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-19621]: tiImage() complete callback is not fired on Android #7280
Conversation
if (TiApplication.isUIThread()) { | ||
return handleToImage(); | ||
|
||
if (callback != null) { |
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 logic of this if statement is flawed b/c it doesn't take into account TiApplication.isUIThread() clause. Also, you should return the TiBlob, not null even when there's a callback present.
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.
Thanks for pointing out. In case callback exists then the rendering should happen in a background thread but the method should return a 'non-null' blob immediately ? The documentation seems misleading about return value.
Code reviewed. Please address comments |
…PR review changes
else { | ||
// Create a non-null empty blob to return. | ||
blob = TiBlob.blobFromImage(Bitmap.createBitmap(1, 1, Config.ARGB_8888)); | ||
Runnable renderRunnable = new Runnable() { |
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.
you can use TiMessenger.sendBlockingMainMessage here and pass an Object as argument.
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.
Calling TiMessenger.sendBlockingMainMessage() is performing the msg synchronously while blocking on the main thread. This makes the method execution synchronous. But according to doc and iOS implementation - if a callback is passed the method is supposed to execute asynchronously. So Im using a Runnable to render and send the result through callback.
Am I missing anything here ?
Code reviewed and functionally tested. Request accepted |
[TIMOB-19621]: tiImage() complete callback is not fired on Android
JIRA: https://jira.appcelerator.org/browse/TIMOB-19621
The java proxy method was not accepting params. So even though callback is provided in js, the result is retuned synchronously. Added the method params and handing accordingly.