From bce3026799e7f61f8897f6a88b515fcb10478c16 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 8 May 2023 14:16:48 +0900 Subject: [PATCH] [VD] Fix load early url issue If the app has app-control option in config.xml, app can jump the URL defined in the option. Then it will not be a default src. In this case, the app has to be able to jump to defined URL again. FYI) This early-load URL feature is enabled to TV profile. Change-Id: Iedf48ad48a5b1fb73f6e84d812c2820304e53480 Signed-off-by: DongHyun Song --- wrt_app/src/runtime.ts | 3 ++- wrt_app/src/web_application.ts | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wrt_app/src/runtime.ts b/wrt_app/src/runtime.ts index 86cdb580..44bd5a35 100644 --- a/wrt_app/src/runtime.ts +++ b/wrt_app/src/runtime.ts @@ -83,6 +83,7 @@ class Runtime { if (this.skipCreateTizenWebAppOnce) { this.skipCreateTizenWebAppOnce = false; console.log('Already WebApplication instance created'); + this.webApplication?.loadUrl(appControl); return; } console.log('Tizen Web App launch'); @@ -137,7 +138,7 @@ class Runtime { this.webApplication = new WebApplication(options); this.skipCreateTizenWebAppOnce = true; } - this.webApplication.loadHostedAppUrl(url); + this.webApplication.loadUrlEarly(url); } }); diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index 7765005f..977f93ef 100644 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -44,6 +44,7 @@ export class WebApplication { profileDelegate: WebApplicationDelegate; splashShown: boolean = false; reload: boolean = false; + earlyLoadedUrl: string = ''; constructor(options: RuntimeOption) { if (wrt.tv) { @@ -310,8 +311,17 @@ export class WebApplication { } } + loadUrlEarly(url: string) { + console.log(`early load : ${url}`); + this.earlyLoadedUrl = url; + this.mainWindow.loadURL(url); + } + loadUrl(appControl: NativeWRTjs.AppControl) { this.contentSrc = appControl.getLoadInfo().getSrc(); + if (this.earlyLoadedUrl === this.contentSrc) + return; + this.launchInspectorIfNeeded(appControl); this.mainWindow.loadURL(this.contentSrc); this.prelaunch(this.contentSrc); @@ -394,11 +404,6 @@ export class WebApplication { wrt.executeJS(this.mainWindow.webContents, kAppControlEventScript); } - loadHostedAppUrl(url: string) { - console.log(`hostedapp url : ${url}`); - this.mainWindow.loadURL(url); - } - private activateIMEWebHelperClient() { console.log('webApplication : activateIMEWebHelperClient'); const kImeActivateFunctionCallScript = -- 2.34.1