Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27697] Add "progress" event to Ti.UI.WebView for Android (parity)

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2020-08-03T15:06:33.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsAndroid
Labelsandroid, event, parity, progress, webview
ReporterArjan
AssigneeGary Mathews
Created2019-12-09T14:45:07.000+0000
Updated2020-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

Comments

  1. Motiur Rahman 2019-12-23

    [~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.
  2. Samir Mohammed 2020-04-08

    FR Passed, waiting on Jenkins build
  3. Christopher Williams 2020-04-24

    merged to master for 9.1.0 target.
  4. Samir Mohammed 2020-07-30

    Reopening ticket, Console now shows [INFO]   undefined when tracking the progress event on SDK versions 9.1.0.v20200724110711, 9.2.0.v20200724112452 and 9.3.0.v20200724114100. *Test case:*
       var win = Ti.UI.createWindow();
       var webview = Ti.UI.createWebView({
           url: 'http://www.google.com'
       });
       webview.addEventListener('progress', function(e) {
         Ti.API.info(e.progress);
       });
       win.add(webview);
       win.open();
       
       
    Test Environment*
       MacOS Big Sur: 11.0 Beta
       Xcode: 12.0 Beta 
       Java Version: 1.8.0_242
       Android NDK: 21.3.6528147
       Node.js: 12.18.1
       ""NPM":"5.0.0","CLI":"8.1.0-master.5""
       API29 Pixel XL emulator
       
  5. Joshua Quick 2020-07-30

    [~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?
       webview.addEventListener('progress', function(e) {
       	Ti.API.info("WebView Progress: " + e.value);
       });
       
  6. Samir Mohammed 2020-08-03

    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.

JSON Source