aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/delayApp/index.js
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-09-05 16:39:53 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-09-05 16:39:53 +0200
commitad2a3f3f87252711a9f3cc13916acf0fdff2949e (patch)
tree21f43223a2166033f2e309784f5c8fd9a7b1de33 /src/features/delayApp/index.js
parentRemove news item on CTA clicks (diff)
downloadferdium-app-ad2a3f3f87252711a9f3cc13916acf0fdff2949e.tar.gz
ferdium-app-ad2a3f3f87252711a9f3cc13916acf0fdff2949e.tar.zst
ferdium-app-ad2a3f3f87252711a9f3cc13916acf0fdff2949e.zip
Fix delay app ux in combination with announcements
Diffstat (limited to 'src/features/delayApp/index.js')
-rw-r--r--src/features/delayApp/index.js10
1 files changed, 7 insertions, 3 deletions
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) {
44 config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; 44 config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait;
45 45
46 autorun(() => { 46 autorun(() => {
47 if (stores.services.allDisplayed.length === 0) { 47 const { isAnnouncementShown } = stores.announcements;
48 debug('seas', stores.services.all.length); 48 if (stores.services.allDisplayed.length === 0 || isAnnouncementShown) {
49 shownAfterLaunch = true; 49 shownAfterLaunch = true;
50 setVisibility(false);
50 return; 51 return;
51 } 52 }
52 53
53 const diff = moment().diff(timeLastDelay); 54 const diff = moment().diff(timeLastDelay);
54 if ((stores.app.isFocused && diff >= config.delayOffset) || !shownAfterLaunch) { 55 const itsTimeToWait = diff >= config.delayOffset;
56 if (!isAnnouncementShown && ((stores.app.isFocused && itsTimeToWait) || !shownAfterLaunch)) {
55 debug(`App will be delayed for ${config.delayDuration / 1000}s`); 57 debug(`App will be delayed for ${config.delayDuration / 1000}s`);
56 58
57 setVisibility(true); 59 setVisibility(true);
@@ -66,6 +68,8 @@ export default function init(stores) {
66 68
67 setVisibility(false); 69 setVisibility(false);
68 }, config.delayDuration + 1000); // timer needs to be able to hit 0 70 }, config.delayDuration + 1000); // timer needs to be able to hit 0
71 } else {
72 setVisibility(false);
69 } 73 }
70 }); 74 });
71 } else { 75 } else {