Defer showing window when appcontrol-reset is being done 70/225270/7
authorSurya Kumar <surya.kumar7@samsung.com>
Tue, 18 Feb 2020 13:33:05 +0000 (19:03 +0530)
committerSurya Kumar <surya.kumar7@samsung.com>
Thu, 27 Feb 2020 07:18:43 +0000 (12:48 +0530)
In Appcontrol-reload case, if window is shown before frame rendered,
expired content is visible for a considerable time. Avoid it by
showing the window only after frame has been rendered

Reference: https://review.tizen.org/gerrit/182918

Change-Id: Icd4877727488e40ffe65f5699c0d3a49dc35a208
Signed-off-by: Surya Kumar <surya.kumar7@samsung.com>
wrt_app/src/runtime.js
wrt_app/src/web_application.js

index 52c61ac4a8f91dd5f13fb0dfa812f52b8a30767f..60fe3aa19167f54a6b84dfe74c704e1f1b7b2edd 100755 (executable)
@@ -189,8 +189,7 @@ class Runtime {
                     if (reload && appControl.getOperation() == 'http://tizen.org/appcontrol/operation/main')
                         reload = false;
                     if (reload) {
-                        _this.webApplication.closeWindows();
-                        _this.webApplication.mainWindow.loadURL(src);
+                        _this.webApplication.handleAppControlReload(src);
                     } else {
                         _this.webApplication.sendAppControlEvent();
                     }
index 5cfafa0c1fd3de685bfd5f50c78ea97e06fcb9a1..78e2a0f7a77c83612d2b4af767deee02567a250c 100755 (executable)
@@ -31,7 +31,6 @@ class WebApplication {
         this.pendingID = 0;
         this.pendingCallbacks = new Map();
         this.windowList = [];
-        this.firstRendered = false;
         this.backgroundSupport = wrt.getBackgroundSupport();
         this.debugPort = 0;
         this.inspectorSrc = '';
@@ -53,7 +52,6 @@ class WebApplication {
         this.defaultBackgroundColor = (wrt.tv
             || (wrt.getPlatformType() === "product_wearable") ? '#000' : '#FFF');
         this.defaultTransparent = (wrt.tv ? true : false);
-        this.suspended = false;
         this.loadFinished = false;
         this.runningStatus = 'none';
         this.addonEmitter = null;
@@ -236,16 +234,8 @@ class WebApplication {
                 detached: true
             });
         }
+        this.initDisplayDelay(true);
         let self = this;
-        if (!wrt.showSplashScreen() && !wrt.tv) {
-            self.showTimer = setTimeout(() => {
-                if (!self.suspended) {
-                    console.log('FrameRendered not obtained from engine. To show window, timer fired');
-                    self.mainWindow.emit('ready-to-show');
-                }
-            }, 2000);
-        }
-
         this.mainWindow.once('ready-to-show', function() {
             console.log('mainWindow ready-to-show');
             if (self.showTimer)
@@ -279,6 +269,30 @@ class WebApplication {
             self.addonEmitter.emit('contentDidFinishLoad', self.mainWindow.id);
         });
     }
+    initDisplayDelay(firstLaunch) {
+        this.firstRendered = false;
+        this.suspended = false;
+        if (this.showTimer)
+            clearTimeout(this.showTimer);
+        let splashShown = firstLaunch && wrt.showSplashScreen();
+        if (!splashShown && !wrt.tv) {
+            let self = this;
+            self.showTimer = setTimeout(() => {
+                if (!self.suspended) {
+                    console.log('FrameRendered not obtained from engine. To show window, timer fired');
+                    self.mainWindow.emit('ready-to-show');
+                }
+            }, 2000);
+        }
+        if (!firstLaunch && !this.backgroundRunnable() && this.mainWindow)
+            this.mainWindow.setEnabled(true);
+    }
+    handleAppControlReload(src) {
+        console.log('WebApplication : handleAppControlReload');
+        this.closeWindows();
+        this.initDisplayDelay(false);
+        this.mainWindow.loadURL(src);
+    }
     suspendByStatus() {
         if (this.preloadStatus === 'readyToShow' ||
             this.preloadStatus === 'preload' ||