[VD] Don't show app if preload app is not ready 30/319530/1 accepted/tizen/unified/20241031.084343 accepted/tizen/unified/20241101.174128 accepted/tizen/unified/x/20241218.032603 submit/tizen/20241029.160027
authorzhaosy <shiyusy.zhao@samsung.com>
Fri, 25 Oct 2024 05:26:36 +0000 (13:26 +0800)
committerzhaosy <shiyusy.zhao@samsung.com>
Fri, 25 Oct 2024 05:26:36 +0000 (13:26 +0800)
For ConnectTime app, when there is a video calling coming,
they will preload app, and when user connect the call,
they launch app, if the interval too short between perload and launch,
js still is not running when app is showing, but WRT has sent tizenvisibilitychange.
So app can't receive tizenvisibilitychange event.

Thus, if preload app is not ready, shouldn't show app.

Change-Id: I3838a1acf9e7f59d4d339e92c4417d13b1c6e363
Signed-off-by: zhaosy <shiyusy.zhao@samsung.com>
wrt_app/common/web_application_delegate.ts
wrt_app/src/tv/web_application_tv.ts
wrt_app/src/web_application.ts

index a51da49b4d5788bd7b9a550d2c2f235db9ed5782..1ac4626d247b43c389afbbf526fc3704084840b2 100644 (file)
@@ -46,4 +46,5 @@ export class WebApplicationDelegate {
   profileName() { return 'common' }
   certificateError(error: string) { return false; }
   setInitValue(appControl: any) { }
+  preloadReady() { return true; }
 }
index c28497c4774a556e75999cb72c27141c80cd8f1c..e1f0d0aa1227353593bf6de2882d6beb1074c531 100644 (file)
@@ -27,6 +27,7 @@ export class WebApplicationDelegateTV extends WebApplicationDelegate {
   isAlwaysReload: boolean = false;
   initBundleValue: string = 'none';
   preloadStatus: string = 'none';
+  isPreloadReady: boolean = true;
   runningStatus: string = 'none';
   launchMode: string = 'none';
   needDispatchTizenVisibilityChange: boolean = false;
@@ -41,6 +42,7 @@ export class WebApplicationDelegateTV extends WebApplicationDelegate {
     console.log(`launch mode is ${this.launchMode}`);
     if (options.launchMode === 'backgroundAtStartup') {
       this.preloadStatus = 'preload';
+      this.isPreloadReady = false;
     } else {
       this.preloadStatus = 'none';
     }
@@ -218,7 +220,7 @@ Then you can get profile log from the initial loading.`;
       this.webApplication.sendAppControlEvent();
       return false;
     } else if ((this.launchMode === 'runningAsForeground') || (resumeWithAppControl === 'Yes')) {
-      this.webApplication.resume();
+      this.webApplication.show();
       this.webApplication.sendAppControlEvent();
       return false;
     } else {
@@ -281,4 +283,15 @@ Then you can get profile log from the initial loading.`;
   focus(webContents: any) {
     this.tv.focus(webContents);
   }
+
+  preloadReady() {
+    if (this.isPreloadReady)
+      return true;
+
+    if (!this.webApplication.readyToShow)
+      return false;
+
+    this.isPreloadReady = true;
+    return true;
+  }
 }
index ec44056eccfb6d9b700323e98e4969302b4d7bd5..e853e581fc3096c6dfaef823bbc4fb59a70cfbee 100644 (file)
@@ -45,6 +45,7 @@ export class WebApplication {
   splashShown: boolean = false;
   reload: boolean = false;
   earlyLoadedUrl: string = '';
+  readyToShow: boolean = false;
 
   constructor(options: RuntimeOption) {
     if (wrt.tv) {
@@ -230,6 +231,7 @@ export class WebApplication {
         return;
 
       console.log('mainWindow ready-to-show');
+      this.readyToShow = true;
       if (this.showTimer)
         clearTimeout(this.showTimer);
 
@@ -431,6 +433,11 @@ export class WebApplication {
   }
 
   show() {
+    if (!this.profileDelegate.preloadReady()) {
+      console.log('preload is not ready');
+      return;
+    }
+
     if (this.profileDelegate.isBackgroundLaunch()) {
       console.log('show() will be skipped by background launch');
       return;