From c72ec09fe023b5408a3a99bd25101874b25059d2 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Tue, 21 Mar 2017 15:40:18 +0200 Subject: [PATCH] FIX: WebView not showing in gallery app --- apps/app/gallery-app/content/web-view.xml | 2 +- .../ui/web-view/web-view-common.ts | 19 +++++++------------ .../ui/web-view/web-view.android.ts | 12 ------------ tns-core-modules/ui/web-view/web-view.ios.ts | 11 ----------- 4 files changed, 8 insertions(+), 36 deletions(-) diff --git a/apps/app/gallery-app/content/web-view.xml b/apps/app/gallery-app/content/web-view.xml index f3f8a88d5..58f8f7090 100644 --- a/apps/app/gallery-app/content/web-view.xml +++ b/apps/app/gallery-app/content/web-view.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/tns-core-modules/ui/web-view/web-view-common.ts b/tns-core-modules/ui/web-view/web-view-common.ts index 78f6f5e2e..a610597be 100644 --- a/tns-core-modules/ui/web-view/web-view-common.ts +++ b/tns-core-modules/ui/web-view/web-view-common.ts @@ -21,15 +21,9 @@ export abstract class WebViewBase extends View implements WebViewDefinition { "other" ]; - public _suspendLoading: boolean; - public src: string; public _onLoadFinished(url: string, error?: string) { - - this._suspendLoading = true; - this._suspendLoading = false; - let args = { eventName: WebViewBase.loadFinishedEvent, object: this, @@ -53,8 +47,6 @@ export abstract class WebViewBase extends View implements WebViewDefinition { this.notify(args); } - abstract _loadUrl(url: string): void; - abstract _loadFileOrResource(path: string, content: string): void; abstract _loadHttp(src: string): void; @@ -81,10 +73,6 @@ export abstract class WebViewBase extends View implements WebViewDefinition { return ""; } set [srcProperty.native](src: string) { - if (this._suspendLoading) { - return; - } - this.stopLoading(); if (isFileOrResourcePath(src)) { @@ -103,6 +91,13 @@ export abstract class WebViewBase extends View implements WebViewDefinition { this._loadData(src); } } + + get url() : string { + throw new Error("Property url of WebView is deprecated. Use src istead"); + } + set url(value:string){ + throw new Error("Property url of WebView is deprecated. Use src istead") + } } srcProperty.register(WebViewBase); diff --git a/tns-core-modules/ui/web-view/web-view.android.ts b/tns-core-modules/ui/web-view/web-view.android.ts index 670d9289f..e320d6472 100644 --- a/tns-core-modules/ui/web-view/web-view.android.ts +++ b/tns-core-modules/ui/web-view/web-view.android.ts @@ -112,18 +112,6 @@ export class WebView extends WebViewBase { super._resetNativeView(); } - public _loadUrl(url: string) { - if (!this._android) { - return; - } - - if (traceEnabled()) { - traceWrite("WebView._loadUrl(" + url + ")", traceCategories.Debug); - } - this._android.stopLoading(); - this._android.loadUrl(url); - } - public _loadFileOrResource(path: string, content: string) { if (!this._android) { return; diff --git a/tns-core-modules/ui/web-view/web-view.ios.ts b/tns-core-modules/ui/web-view/web-view.ios.ts index e7a2ed4d8..7472a210c 100644 --- a/tns-core-modules/ui/web-view/web-view.ios.ts +++ b/tns-core-modules/ui/web-view/web-view.ios.ts @@ -109,17 +109,6 @@ export class WebView extends WebViewBase { this._ios.stopLoading(); } - public _loadUrl(url: string) { - if (traceEnabled()) { - traceWrite("WebView._loadUrl(" + url + ")", traceCategories.Debug); - } - - if (this._ios.loading) { - this._ios.stopLoading(); - } - this._ios.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(url))); - } - public _loadFileOrResource(path: string, content: string) { var baseURL = NSURL.fileURLWithPath(NSString.stringWithString(path).stringByDeletingLastPathComponent); this._ios.loadHTMLStringBaseURL(content, baseURL);