Skip to content

Commit 33d1f60

Browse files
committed
fix: rename trace category
1 parent 9321876 commit 33d1f60

File tree

3 files changed

+51
-51
lines changed

3 files changed

+51
-51
lines changed

src/webview/index.android.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import lazy from '@nativescript/core/utils/lazy';
33
import { isEnabledProperty } from '@nativescript/core/ui/core/view';
44
import {
55
CacheMode,
6-
NotaTraceCategory,
76
UnsupportedSDKError,
87
WebViewExtBase,
8+
WebViewTraceCategory,
99
allowsInlineMediaPlaybackProperty,
1010
builtInZoomControlsProperty,
1111
cacheModeProperty,
@@ -121,22 +121,22 @@ function initializeWebViewClient(): void {
121121
}
122122
Trace.write(
123123
`WebViewClientClass.shouldOverrideUrlLoading("${url}") - method:${httpMethod} isRedirect:${isRedirect} hasGesture:${hasGesture} isForMainFrame:${isForMainFrame} headers:${requestHeaders}`,
124-
NotaTraceCategory,
124+
WebViewTraceCategory,
125125
Trace.messageType.info
126126
);
127127
}
128128

129129
if (url.startsWith(owner.interceptScheme)) {
130130
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);
132132
}
133133
return true;
134134
}
135135

136136
const shouldOverrideUrlLoading = owner._onShouldOverrideUrlLoading(url, httpMethod);
137137
if (shouldOverrideUrlLoading === true) {
138138
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);
140140
}
141141
return true;
142142
}
@@ -161,7 +161,7 @@ function initializeWebViewClient(): void {
161161

162162
if (typeof url !== 'string') {
163163
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);
165165
}
166166
return super.shouldInterceptRequest(view, request as android.webkit.WebResourceRequest);
167167
}
@@ -173,14 +173,14 @@ function initializeWebViewClient(): void {
173173
const filepath = owner.getRegisteredLocalResource(url);
174174
if (!filepath) {
175175
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);
177177
}
178178
return super.shouldInterceptRequest(view, request as android.webkit.WebResourceRequest);
179179
}
180180

181181
if (!File.exists(filepath)) {
182182
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);
184184
}
185185
return super.shouldInterceptRequest(view, request as android.webkit.WebResourceRequest);
186186
}
@@ -194,7 +194,7 @@ function initializeWebViewClient(): void {
194194
const encoding = extToBinaryEncoding.has(ext) || mimeType === 'application/octet-stream' ? 'binary' : 'UTF-8';
195195

196196
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);
198198
}
199199
const response = new android.webkit.WebResourceResponse(mimeType, encoding, stream);
200200
if (sdkVersion() < 21 || !response.getResponseHeaders) {
@@ -222,7 +222,7 @@ function initializeWebViewClient(): void {
222222
}
223223

224224
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);
226226
}
227227
owner._onLoadStarted(url);
228228
}
@@ -238,7 +238,7 @@ function initializeWebViewClient(): void {
238238
}
239239

240240
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);
242242
}
243243
owner._onLoadFinished(url).catch(() => void 0);
244244
}
@@ -269,7 +269,7 @@ function initializeWebViewClient(): void {
269269
}
270270

271271
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);
273273
}
274274

275275
owner._onLoadFinished(url, `${error.getDescription()}(${error.getErrorCode()})`).catch(() => void 0);
@@ -286,7 +286,7 @@ function initializeWebViewClient(): void {
286286
}
287287

288288
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);
290290
}
291291
owner._onLoadFinished(failingUrl, `${description}(${errorCode})`).catch(() => void 0);
292292
}
@@ -527,7 +527,7 @@ function initializeWebViewClient(): void {
527527
return;
528528
} catch (err) {
529529
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);
531531
}
532532
}
533533

@@ -633,11 +633,11 @@ export class AWebView extends WebViewExtBase {
633633
}
634634

635635
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);
637637
}
638638
nativeView.loadUrl(src);
639639
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);
641641
}
642642
}
643643

@@ -649,7 +649,7 @@ export class AWebView extends WebViewExtBase {
649649

650650
const baseUrl = `file:///${knownFolders.currentApp().path}/`;
651651
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);
653653
}
654654
nativeView.loadDataWithBaseURL(baseUrl, src, 'text/html', 'utf-8', null!);
655655
}
@@ -706,22 +706,22 @@ export class AWebView extends WebViewExtBase {
706706
const filepath = this.resolveLocalResourceFilePath(path);
707707
if (!filepath) {
708708
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);
710710
}
711711

712712
return;
713713
}
714714

715715
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);
717717
}
718718

719719
this.localResourceMap.set(resourceName, filepath);
720720
}
721721

722722
public unregisterLocalResource(resourceName: string) {
723723
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);
725725
}
726726
resourceName = this.fixLocalResourceName(resourceName);
727727

@@ -734,7 +734,7 @@ export class AWebView extends WebViewExtBase {
734734
const result = this.localResourceMap.get(resourceName);
735735

736736
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);
738738
}
739739

740740
return result;
@@ -748,7 +748,7 @@ export class AWebView extends WebViewExtBase {
748748
*/
749749
// public async ensureFetchSupport() {
750750
// 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);
752752
// }
753753

754754
// // The polyfill is not loaded if fetch already exists, start by null'ing it.
@@ -768,7 +768,7 @@ export class AWebView extends WebViewExtBase {
768768
public async executeJavaScript<T>(scriptCode: string): Promise<T> {
769769
if (sdkVersion() < 19) {
770770
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);
772772
}
773773
return Promise.reject(new UnsupportedSDKError(19));
774774
}
@@ -777,7 +777,7 @@ export class AWebView extends WebViewExtBase {
777777
const androidWebView = this.nativeViewProtected;
778778
if (!androidWebView) {
779779
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);
781781
}
782782
reject(new Error('Native Android not initialized, cannot call executeJavaScript'));
783783

@@ -822,7 +822,7 @@ export class AWebView extends WebViewExtBase {
822822
public zoomBy(zoomFactor: number) {
823823
if (sdkVersion() < 21) {
824824
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);
826826
}
827827

828828
return;

0 commit comments

Comments
 (0)