Remove delayed initialization 59/245759/1
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Thu, 15 Oct 2020 10:23:08 +0000 (12:23 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Thu, 15 Oct 2020 10:23:08 +0000 (12:23 +0200)
After updating the englightenment package the delayed initialization
is no longer required.

Change-Id: I69acdd5d55e7ad2893503f6e25cfcb9d076f863f

Oobe/Oobe.Common/Services/SoftKeyClientService.cs

index 3de7f2d6228c70916fbd3147374248cbd21e9f55..3928eccb1fe4c6ec73d7dc69204c382f8c9e0d44 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 using System;
-using System.Threading.Tasks;
 using Tizen.NUI;
 using Tizen.NUI.WindowSystem.Shell;
 
@@ -26,19 +25,14 @@ namespace Oobe.Common.Services
     /// </summary>
     public sealed class SoftKeyClientService
     {
-        private const int MaxInitializeAttempts = 10;
-        private const int IntitializeAttemptInterval = 3000;
-
         private static SoftKeyClientService instance;
 
         private TizenShell shell;
         private SoftkeyClient client;
-        private TaskCompletionSource<bool> initialized;
 
         private SoftKeyClientService()
         {
-            initialized = new TaskCompletionSource<bool>();
-            ScheduleInitialize();
+            Initialize();
         }
 
         /// <summary>
@@ -60,71 +54,27 @@ namespace Oobe.Common.Services
         /// <summary>
         /// Shows soft keys system-wide
         /// </summary>
-        public async Task Show()
+        public void Show()
         {
-            Tizen.Log.Warn("oobe", $"Show");
-            bool initDone = await initialized.Task;
-            if (initDone)
-            {
-                Tizen.Log.Warn("oobe", $"client.Show()");
-                client.Opacity = SoftkeyOpacityState.Opaque;
-                client.Show();
-            }
+            Tizen.Log.Warn("oobe", $"client.Show()");
+            client.Opacity = SoftkeyOpacityState.Opaque;
+            client.Show();
         }
 
         /// <summary>
         /// Hides soft keys system-wide
         /// </summary>
-        public async Task Hide()
+        public void Hide()
         {
-            Tizen.Log.Warn("oobe", $"Hide");
-            bool initDone = await initialized.Task;
-            if (initDone)
-            {
-                Tizen.Log.Warn("oobe", $"client.Hide()");
-                client.Opacity = SoftkeyOpacityState.Transparent;
-                client.Hide();
-            }
+            Tizen.Log.Warn("oobe", $"client.Hide()");
+            client.Opacity = SoftkeyOpacityState.Transparent;
+            client.Hide();
         }
 
         private void Initialize()
         {
             shell = new TizenShell();
             client = new SoftkeyClient(shell, Window.Instance);
-            initialized.SetResult(true);
-        }
-
-        private void ScheduleInitialize()
-        {
-            int attempt = 0;
-            Tizen.Log.Warn("oobe", $"ScheduleInitialize");
-
-            Timer timer = new Timer(IntitializeAttemptInterval);
-            timer.Tick += (sender, args) =>
-            {
-                attempt++;
-
-                if (attempt > MaxInitializeAttempts)
-                {
-                    Tizen.Log.Error("oobe", $"Max initialize attempts reached");
-                    initialized.SetResult(false);
-                    return false;
-                }
-
-                try
-                {
-                    Tizen.Log.Warn("oobe", $"Attempt to intialize: {attempt}");
-                    Initialize();
-                }
-                catch (Exception e)
-                {
-                    Tizen.Log.Warn("oobe", $"SoftKeyClientService.Initialize failed {e.Message}");
-                    return true;
-                }
-
-                return false;
-            };
-            timer.Start();
         }
     }
 }