[DeviceHome] Move to error.html if tau library isn't loaded 44/264844/1
authorYoungsoo Choi <kenshin.choi@samsung.com>
Fri, 1 Oct 2021 04:00:12 +0000 (21:00 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Fri, 1 Oct 2021 04:00:12 +0000 (21:00 -0700)
If tau library isn't loaded porperly, this moves current page to error.html.

Change-Id: I06d43d2f2c32138e75b43e199dd9bf474fa35a1c
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
device_home/client/client.html
device_home/client/css/style.css
device_home/client/error.html [new file with mode: 0755]
device_home/client/js/client.js

index 34e5a63..c2c03c2 100755 (executable)
        <script src="client/js/clipping-storage.js" type="module"></script>
        <script src="client/js/app.js" type="module"></script>
        <script src="client/js/myApps.js" type="module"></script>
+       <script>
+               if (typeof tau === 'undefined') {
+                       location.replace('client/error.html');
+               }
+       </script>
 </head>
 
 <body>
 </body>
 
 </html>
-
index c9c1750..f1d7d0a 100755 (executable)
     display: inline;
 }
 
+.error-body {
+    background-color: #F2F2F2;
+    color: #505050;
+}
+
+.error-msg {
+    text-align: left;
+    line-height: 23px;
+    color: #505050;
+    display: block;
+    margin-top: 100px;
+    margin-left: 20px;
+    padding-bottom: 20px;
+}
+
 body {
     /*disable-pull-to-refresh-effect*/
     overscroll-behavior: contain;
diff --git a/device_home/client/error.html b/device_home/client/error.html
new file mode 100755 (executable)
index 0000000..2de403f
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+       <meta charset="UTF-8">
+       <meta name="viewport" content="width=device-width, user-scalable=no">
+       <title>My Device App</title>
+       <link rel="stylesheet" href="css/style.css" />
+       <script src="js/client.js"></script>
+</head>
+
+<body class="error-body">
+       <div class="error-page">
+               <h2 style="margin-left:10px">
+                       Error
+               </h2>
+               <div>
+                       <h4 class="error-msg">
+                               Service is not available due to network issue
+                       </h4>
+               </div>
+       </div>
+</body>
+
+</html>
index 3e1a6a1..c7f8fc2 100755 (executable)
@@ -3,15 +3,14 @@
         * Back key event handler
         */
        window.addEventListener("tizenhwkey", function (ev) {
-               var activePopup = null,
-                       page = null,
-                       pageid = "";
+               let page = null;
+               let pageId = '';
 
                if (ev.keyName === "back") {
                        page = document.getElementsByClassName("ui-page")[0];
-                       pageid = page ? page.id : "";
+                       pageId = page ? page.id : "";
 
-                       if (pageid === "main" ) {
+                       if (pageId === "main" || ev.target.id === "error-page") {
                                try {
                                        /**
                                         * Exit application