Open rolloclarke opened 5 years ago
thanks for reporting :)
Upon some testing it seems that At least Android needs a little time. Around 100 ms before responding to an action so the system can process it.
Example from $media.permissions
// We need at least 100 ms to call the success with the result
// If not then it will be omitted since it will too fast
// for the system to process.
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
try {
JSONObject ret = new JSONObject();
ret.put("files", ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
ret.put("camera", ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED);
JasonHelper.next("success", action, ret, event, context);
} catch (Exception e) {
Log.d("Warning", e.getStackTrace()[0].getMethodName() + " : " + e.toString());
}
}
}, 100); // Millisecond 1000 = 1 sec
Describe the bug If an action triggers another action which is of type
$agent.request
and$return.success
is returned, the original action's success is never executed.So the yay success alert of
action1
is never executed:This is true of all agent actions not just
$agent.request
The problem is In
JasonAgentAction
the caller event object is ignored, and never passed through to theJasonAgentService
, and so all theJasonHelper.next(...)
calls are made with empty event objects.