From ad2a3f3f87252711a9f3cc13916acf0fdff2949e Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Thu, 5 Sep 2019 16:39:53 +0200 Subject: Fix delay app ux in combination with announcements --- src/features/delayApp/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/features/delayApp') diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js index 627537de7..c0029873a 100644 --- a/src/features/delayApp/index.js +++ b/src/features/delayApp/index.js @@ -44,14 +44,16 @@ export default function init(stores) { config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; autorun(() => { - if (stores.services.allDisplayed.length === 0) { - debug('seas', stores.services.all.length); + const { isAnnouncementShown } = stores.announcements; + if (stores.services.allDisplayed.length === 0 || isAnnouncementShown) { shownAfterLaunch = true; + setVisibility(false); return; } const diff = moment().diff(timeLastDelay); - if ((stores.app.isFocused && diff >= config.delayOffset) || !shownAfterLaunch) { + const itsTimeToWait = diff >= config.delayOffset; + if (!isAnnouncementShown && ((stores.app.isFocused && itsTimeToWait) || !shownAfterLaunch)) { debug(`App will be delayed for ${config.delayDuration / 1000}s`); setVisibility(true); @@ -66,6 +68,8 @@ export default function init(stores) { setVisibility(false); }, config.delayDuration + 1000); // timer needs to be able to hit 0 + } else { + setVisibility(false); } }); } else { -- cgit v1.2.3-70-g09d2