[VD] Fix load early url issue 34/292434/4
authorDongHyun Song <dh81.song@samsung.com>
Mon, 8 May 2023 05:16:48 +0000 (14:16 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Tue, 9 May 2023 02:37:21 +0000 (11:37 +0900)
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 <dh81.song@samsung.com>
wrt_app/src/runtime.ts
wrt_app/src/web_application.ts

index 86cdb580738c0a353c1922e9234a44f50391ddbb..44bd5a35813c54c9932ee13f39fa8d2833f749ee 100644 (file)
@@ -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);
       }
     });
 
index 7765005f09e9474764fbaee573d77261cba4e96d..977f93ef1fb4e5dab1dfcefb80c3c142d98ba9ee 100644 (file)
@@ -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 =