[TIMOB-27697] Add "progress" event to Ti.UI.WebView for Android (parity)
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-03T15:06:33.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | Android |
Labels | android, event, parity, progress, webview |
Reporter | Arjan |
Assignee | Gary Mathews |
Created | 2019-12-09T14:45:07.000+0000 |
Updated | 2020-08-03T15:06:39.000+0000 |
Description
For some reason the progress event in Ti.UI.WebView is only available for iOS, so I did an attempt to add it (disclaimer: I am not a java programmer)
Adding this function to TiWebChromeClient.java seems to fix it;
public void onProgressChanged(WebView view, int progress)
{
WebViewProxy proxy = (WebViewProxy) tiWebView.getProxy();
if (proxy != null) {
KrollDict data = new KrollDict();
data.put("progress", progress);
proxy.fireEvent("progress", data);
}
}
I tested it on SDK 8.3.0 and 9.0.0. Both tests successful.
EDIT: created a PR: https://github.com/appcelerator/titanium_mobile/pull/11383
[~arif] Thanks for your ticket and PR. I have escalated this to our engineering team. This needs to pass Product approval and then engineering will decide when to include this into our SDK. We appreciate your help.
FR Passed, waiting on Jenkins build
merged to master for 9.1.0 target.
Reopening ticket, Console now shows
[INFO] undefined
when tracking the progress event on SDK versions9.1.0.v20200724110711
,9.2.0.v20200724112452
and9.3.0.v20200724114100
. *Test case:*Test Environment*
[~smohammed], the event does not have a "progress" property. That's why it returns undefined. https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-event-progress I think you mean to do this?
Ah yeah sorry my bad testing with the code above everything looks good on 9.1.0.v20200724110711, 9.2.0.v20200724112452 and 9.3.0.v20200724114100, thanks.