@@ -3,9 +3,9 @@ import lazy from '@nativescript/core/utils/lazy';
3
3
import { isEnabledProperty } from '@nativescript/core/ui/core/view' ;
4
4
import {
5
5
CacheMode ,
6
- NotaTraceCategory ,
7
6
UnsupportedSDKError ,
8
7
WebViewExtBase ,
8
+ WebViewTraceCategory ,
9
9
allowsInlineMediaPlaybackProperty ,
10
10
builtInZoomControlsProperty ,
11
11
cacheModeProperty ,
@@ -121,22 +121,22 @@ function initializeWebViewClient(): void {
121
121
}
122
122
Trace . write (
123
123
`WebViewClientClass.shouldOverrideUrlLoading("${ url } ") - method:${ httpMethod } isRedirect:${ isRedirect } hasGesture:${ hasGesture } isForMainFrame:${ isForMainFrame } headers:${ requestHeaders } ` ,
124
- NotaTraceCategory ,
124
+ WebViewTraceCategory ,
125
125
Trace . messageType . info
126
126
) ;
127
127
}
128
128
129
129
if ( url . startsWith ( owner . interceptScheme ) ) {
130
130
if ( Trace . isEnabled ( ) ) {
131
- Trace . write ( `WebViewClientClass.shouldOverrideUrlLoading("${ url } ") - "${ owner . interceptScheme } " - cancel` , NotaTraceCategory , Trace . messageType . info ) ;
131
+ Trace . write ( `WebViewClientClass.shouldOverrideUrlLoading("${ url } ") - "${ owner . interceptScheme } " - cancel` , WebViewTraceCategory , Trace . messageType . info ) ;
132
132
}
133
133
return true ;
134
134
}
135
135
136
136
const shouldOverrideUrlLoading = owner . _onShouldOverrideUrlLoading ( url , httpMethod ) ;
137
137
if ( shouldOverrideUrlLoading === true ) {
138
138
if ( Trace . isEnabled ( ) ) {
139
- Trace . write ( `WebViewClientClass.shouldOverrideUrlLoading("${ url } ") - cancel loading url` , NotaTraceCategory , Trace . messageType . info ) ;
139
+ Trace . write ( `WebViewClientClass.shouldOverrideUrlLoading("${ url } ") - cancel loading url` , WebViewTraceCategory , Trace . messageType . info ) ;
140
140
}
141
141
return true ;
142
142
}
@@ -161,7 +161,7 @@ function initializeWebViewClient(): void {
161
161
162
162
if ( typeof url !== 'string' ) {
163
163
if ( Trace . isEnabled ( ) ) {
164
- Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - is not a string` , NotaTraceCategory , Trace . messageType . info ) ;
164
+ Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - is not a string` , WebViewTraceCategory , Trace . messageType . info ) ;
165
165
}
166
166
return super . shouldInterceptRequest ( view , request as android . webkit . WebResourceRequest ) ;
167
167
}
@@ -173,14 +173,14 @@ function initializeWebViewClient(): void {
173
173
const filepath = owner . getRegisteredLocalResource ( url ) ;
174
174
if ( ! filepath ) {
175
175
if ( Trace . isEnabled ( ) ) {
176
- Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - no matching file` , NotaTraceCategory , Trace . messageType . info ) ;
176
+ Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - no matching file` , WebViewTraceCategory , Trace . messageType . info ) ;
177
177
}
178
178
return super . shouldInterceptRequest ( view , request as android . webkit . WebResourceRequest ) ;
179
179
}
180
180
181
181
if ( ! File . exists ( filepath ) ) {
182
182
if ( Trace . isEnabled ( ) ) {
183
- Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - file: "${ filepath } " doesn't exists` , NotaTraceCategory , Trace . messageType . info ) ;
183
+ Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - file: "${ filepath } " doesn't exists` , WebViewTraceCategory , Trace . messageType . info ) ;
184
184
}
185
185
return super . shouldInterceptRequest ( view , request as android . webkit . WebResourceRequest ) ;
186
186
}
@@ -194,7 +194,7 @@ function initializeWebViewClient(): void {
194
194
const encoding = extToBinaryEncoding . has ( ext ) || mimeType === 'application/octet-stream' ? 'binary' : 'UTF-8' ;
195
195
196
196
if ( Trace . isEnabled ( ) ) {
197
- Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - file: "${ filepath } " mimeType:${ mimeType } encoding:${ encoding } ` , NotaTraceCategory , Trace . messageType . info ) ;
197
+ Trace . write ( `WebViewClientClass.shouldInterceptRequest("${ url } ") - file: "${ filepath } " mimeType:${ mimeType } encoding:${ encoding } ` , WebViewTraceCategory , Trace . messageType . info ) ;
198
198
}
199
199
const response = new android . webkit . WebResourceResponse ( mimeType , encoding , stream ) ;
200
200
if ( sdkVersion ( ) < 21 || ! response . getResponseHeaders ) {
@@ -222,7 +222,7 @@ function initializeWebViewClient(): void {
222
222
}
223
223
224
224
if ( Trace . isEnabled ( ) ) {
225
- Trace . write ( `WebViewClientClass.onPageStarted("${ view } ", "${ url } ", "${ favicon } ")` , NotaTraceCategory , Trace . messageType . info ) ;
225
+ Trace . write ( `WebViewClientClass.onPageStarted("${ view } ", "${ url } ", "${ favicon } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
226
226
}
227
227
owner . _onLoadStarted ( url ) ;
228
228
}
@@ -238,7 +238,7 @@ function initializeWebViewClient(): void {
238
238
}
239
239
240
240
if ( Trace . isEnabled ( ) ) {
241
- Trace . write ( `WebViewClientClass.onPageFinished("${ view } ", ${ url } ")` , NotaTraceCategory , Trace . messageType . info ) ;
241
+ Trace . write ( `WebViewClientClass.onPageFinished("${ view } ", ${ url } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
242
242
}
243
243
owner . _onLoadFinished ( url ) . catch ( ( ) => void 0 ) ;
244
244
}
@@ -269,7 +269,7 @@ function initializeWebViewClient(): void {
269
269
}
270
270
271
271
if ( Trace . isEnabled ( ) ) {
272
- Trace . write ( `WebViewClientClass.onReceivedErrorAPI23(${ error . getErrorCode ( ) } , ${ error . getDescription ( ) } , ${ url } )` , NotaTraceCategory , Trace . messageType . info ) ;
272
+ Trace . write ( `WebViewClientClass.onReceivedErrorAPI23(${ error . getErrorCode ( ) } , ${ error . getDescription ( ) } , ${ url } )` , WebViewTraceCategory , Trace . messageType . info ) ;
273
273
}
274
274
275
275
owner . _onLoadFinished ( url , `${ error . getDescription ( ) } (${ error . getErrorCode ( ) } )` ) . catch ( ( ) => void 0 ) ;
@@ -286,7 +286,7 @@ function initializeWebViewClient(): void {
286
286
}
287
287
288
288
if ( Trace . isEnabled ( ) ) {
289
- Trace . write ( `WebViewClientClass.onReceivedErrorBeforeAPI23(${ errorCode } , "${ description } ", "${ failingUrl } ")` , NotaTraceCategory , Trace . messageType . info ) ;
289
+ Trace . write ( `WebViewClientClass.onReceivedErrorBeforeAPI23(${ errorCode } , "${ description } ", "${ failingUrl } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
290
290
}
291
291
owner . _onLoadFinished ( failingUrl , `${ description } (${ errorCode } )` ) . catch ( ( ) => void 0 ) ;
292
292
}
@@ -527,7 +527,7 @@ function initializeWebViewClient(): void {
527
527
return ;
528
528
} catch ( err ) {
529
529
if ( Trace . isEnabled ( ) ) {
530
- Trace . write ( `WebViewExtClientImpl.emitEventToNativeScript("${ eventName } ") - couldn't parse data: ${ data } err: ${ err } ` , NotaTraceCategory , Trace . messageType . info ) ;
530
+ Trace . write ( `WebViewExtClientImpl.emitEventToNativeScript("${ eventName } ") - couldn't parse data: ${ data } err: ${ err } ` , WebViewTraceCategory , Trace . messageType . info ) ;
531
531
}
532
532
}
533
533
@@ -633,11 +633,11 @@ export class AWebView extends WebViewExtBase {
633
633
}
634
634
635
635
if ( Trace . isEnabled ( ) ) {
636
- Trace . write ( `WebViewExt<android>._loadUrl("${ src } ")` , NotaTraceCategory , Trace . messageType . info ) ;
636
+ Trace . write ( `WebViewExt<android>._loadUrl("${ src } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
637
637
}
638
638
nativeView . loadUrl ( src ) ;
639
639
if ( Trace . isEnabled ( ) ) {
640
- Trace . write ( `WebViewExt<android>._loadUrl("${ src } ") - end` , NotaTraceCategory , Trace . messageType . info ) ;
640
+ Trace . write ( `WebViewExt<android>._loadUrl("${ src } ") - end` , WebViewTraceCategory , Trace . messageType . info ) ;
641
641
}
642
642
}
643
643
@@ -649,7 +649,7 @@ export class AWebView extends WebViewExtBase {
649
649
650
650
const baseUrl = `file:///${ knownFolders . currentApp ( ) . path } /` ;
651
651
if ( Trace . isEnabled ( ) ) {
652
- Trace . write ( `WebViewExt<android>._loadData("${ src } ") -> baseUrl: "${ baseUrl } "` , NotaTraceCategory , Trace . messageType . info ) ;
652
+ Trace . write ( `WebViewExt<android>._loadData("${ src } ") -> baseUrl: "${ baseUrl } "` , WebViewTraceCategory , Trace . messageType . info ) ;
653
653
}
654
654
nativeView . loadDataWithBaseURL ( baseUrl , src , 'text/html' , 'utf-8' , null ! ) ;
655
655
}
@@ -706,22 +706,22 @@ export class AWebView extends WebViewExtBase {
706
706
const filepath = this . resolveLocalResourceFilePath ( path ) ;
707
707
if ( ! filepath ) {
708
708
if ( Trace . isEnabled ( ) ) {
709
- Trace . write ( `WebViewExt<android>.registerLocalResource("${ resourceName } ", "${ path } ") -> file doesn't exist` , NotaTraceCategory , Trace . messageType . error ) ;
709
+ Trace . write ( `WebViewExt<android>.registerLocalResource("${ resourceName } ", "${ path } ") -> file doesn't exist` , WebViewTraceCategory , Trace . messageType . error ) ;
710
710
}
711
711
712
712
return ;
713
713
}
714
714
715
715
if ( Trace . isEnabled ( ) ) {
716
- Trace . write ( `WebViewExt<android>.registerLocalResource("${ resourceName } ", "${ path } ") -> file: "${ filepath } "` , NotaTraceCategory , Trace . messageType . info ) ;
716
+ Trace . write ( `WebViewExt<android>.registerLocalResource("${ resourceName } ", "${ path } ") -> file: "${ filepath } "` , WebViewTraceCategory , Trace . messageType . info ) ;
717
717
}
718
718
719
719
this . localResourceMap . set ( resourceName , filepath ) ;
720
720
}
721
721
722
722
public unregisterLocalResource ( resourceName : string ) {
723
723
if ( Trace . isEnabled ( ) ) {
724
- Trace . write ( `WebViewExt<android>.unregisterLocalResource("${ resourceName } ")` , NotaTraceCategory , Trace . messageType . info ) ;
724
+ Trace . write ( `WebViewExt<android>.unregisterLocalResource("${ resourceName } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
725
725
}
726
726
resourceName = this . fixLocalResourceName ( resourceName ) ;
727
727
@@ -734,7 +734,7 @@ export class AWebView extends WebViewExtBase {
734
734
const result = this . localResourceMap . get ( resourceName ) ;
735
735
736
736
if ( Trace . isEnabled ( ) ) {
737
- Trace . write ( `WebViewExt<android>.getRegisteredLocalResource("${ resourceName } ") => "${ result } "` , NotaTraceCategory , Trace . messageType . info ) ;
737
+ Trace . write ( `WebViewExt<android>.getRegisteredLocalResource("${ resourceName } ") => "${ result } "` , WebViewTraceCategory , Trace . messageType . info ) ;
738
738
}
739
739
740
740
return result ;
@@ -748,7 +748,7 @@ export class AWebView extends WebViewExtBase {
748
748
*/
749
749
// public async ensureFetchSupport() {
750
750
// if (Trace.isEnabled()) {
751
- // Trace.write("WebViewExt<android>.ensureFetchSupport() - Override 'Fetch API' to support x-local.", NotaTraceCategory , Trace.messageType.info);
751
+ // Trace.write("WebViewExt<android>.ensureFetchSupport() - Override 'Fetch API' to support x-local.", WebViewTraceCategory , Trace.messageType.info);
752
752
// }
753
753
754
754
// // The polyfill is not loaded if fetch already exists, start by null'ing it.
@@ -768,7 +768,7 @@ export class AWebView extends WebViewExtBase {
768
768
public async executeJavaScript < T > ( scriptCode : string ) : Promise < T > {
769
769
if ( sdkVersion ( ) < 19 ) {
770
770
if ( Trace . isEnabled ( ) ) {
771
- Trace . write ( `WebViewExt<android>.executeJavaScript() -> SDK:${ sdkVersion ( ) } not supported` , NotaTraceCategory , Trace . messageType . error ) ;
771
+ Trace . write ( `WebViewExt<android>.executeJavaScript() -> SDK:${ sdkVersion ( ) } not supported` , WebViewTraceCategory , Trace . messageType . error ) ;
772
772
}
773
773
return Promise . reject ( new UnsupportedSDKError ( 19 ) ) ;
774
774
}
@@ -777,7 +777,7 @@ export class AWebView extends WebViewExtBase {
777
777
const androidWebView = this . nativeViewProtected ;
778
778
if ( ! androidWebView ) {
779
779
if ( Trace . isEnabled ( ) ) {
780
- Trace . write ( 'WebViewExt<android>.executeJavaScript() -> no nativeView?' , NotaTraceCategory , Trace . messageType . error ) ;
780
+ Trace . write ( 'WebViewExt<android>.executeJavaScript() -> no nativeView?' , WebViewTraceCategory , Trace . messageType . error ) ;
781
781
}
782
782
reject ( new Error ( 'Native Android not initialized, cannot call executeJavaScript' ) ) ;
783
783
@@ -822,7 +822,7 @@ export class AWebView extends WebViewExtBase {
822
822
public zoomBy ( zoomFactor : number ) {
823
823
if ( sdkVersion ( ) < 21 ) {
824
824
if ( Trace . isEnabled ( ) ) {
825
- Trace . write ( 'WebViewExt<android>.zoomBy - not supported on this SDK' , NotaTraceCategory , Trace . messageType . info ) ;
825
+ Trace . write ( 'WebViewExt<android>.zoomBy - not supported on this SDK' , WebViewTraceCategory , Trace . messageType . info ) ;
826
826
}
827
827
828
828
return ;
0 commit comments