From 6fca8e5c4102ab921dd8530b130544d8758e79d8 Mon Sep 17 00:00:00 2001
From: Markin Igor <markin.io210@gmail.com>
Date: Tue, 30 Jul 2019 11:09:06 +0500
Subject: [PATCH] Add reveal timer cancellation.

---
 lib/src/app.dart | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/src/app.dart b/lib/src/app.dart
index 7764940..3839e62 100644
--- a/lib/src/app.dart
+++ b/lib/src/app.dart
@@ -141,10 +141,11 @@ class _MainAppState extends State<MainApp> {
     });
 
 
-    initUniLinks();
-
     // Show buttons after timeout
     revealButtons(3);
+
+
+    initUniLinks();
   }
 
   @override
@@ -163,8 +164,20 @@ class _MainAppState extends State<MainApp> {
     });
   }
 
+  hideButtons() {
+    if (_revealTimer != null && _revealTimer.isActive) {
+      _revealTimer.cancel();
+    }
+
+
+    setState(() {
+      _buttonsHidden = true;
+    });
+  }
+
+  Timer _revealTimer;
   revealButtons(delay) {
-    Timer(
+    _revealTimer = Timer(
         Duration(seconds: delay),
             () {
           setState(() {
@@ -209,9 +222,7 @@ class _MainAppState extends State<MainApp> {
     }
 
     // Hide buttons so they wont blink after we close or finish oauth
-    setState(() {
-      _buttonsHidden = true;
-    });
+    hideButtons();
 
     setScreen(Screen.OAuth);
 
-- 
GitLab