@@ -44,34 +44,6 @@ public Result doWork() {
4444 webView .addJavascriptInterface (new NotificationBridge (getApplicationContext (), latch ), "CHTNotificationBridge" );
4545 enableStorage (webView );
4646
47- webView .setWebViewClient (new WebViewClient () {
48- @ Override
49- public void onPageFinished (WebView view , String url ) {
50- String js = "(async function (){" +
51- " const api = window.CHTCore.AndroidApi;" +
52- " if (api && api.v1 && api.v1.taskNotifications) {" +
53- " const tasks = await api.v1.taskNotifications();" +
54- " CHTNotificationBridge.onJsResult(JSON.stringify(tasks));" +
55- " }" +
56- "})();" ;
57- view .evaluateJavascript (js , null );
58- }
59- });
60- webView .loadUrl (appUrl );
61- });
62- try {
63- boolean completed = latch .await (EXECUTION_TIMEOUT , TimeUnit .SECONDS );
64- if (completed ) {
65- Log .d (TAG , "notification worker ran successfully!" );
66- } else {
67- Log .d (TAG , "notification worker taking too long to complete" );
68- return Result .failure ();
69- }
70- } catch (InterruptedException e ) {
71- log (e , "error: notification worker interrupted" );
72- Thread .currentThread ().interrupt ();
73- return Result .failure ();
74- }
7547 webView .setWebViewClient (new WebViewClient () {
7648 @ Override
7749 public void onPageFinished (WebView view , String url ) {
0 commit comments