aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/delayApp/index.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-01-09 15:39:45 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-01-09 15:39:45 +0100
commit08c40f00de99f2e49f07106c241110f7afa71f6c (patch)
tree12e516faca9fb94cf5beee9cd4396f7d869c75de /src/features/delayApp/index.js
parentMerge branch 'feature/basicAuth' into develop (diff)
downloadferdium-app-08c40f00de99f2e49f07106c241110f7afa71f6c.tar.gz
ferdium-app-08c40f00de99f2e49f07106c241110f7afa71f6c.tar.zst
ferdium-app-08c40f00de99f2e49f07106c241110f7afa71f6c.zip
fix(App): Fix app delay for Premium Supporters
Diffstat (limited to 'src/features/delayApp/index.js')
-rw-r--r--src/features/delayApp/index.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js
index d7e8252f3..28aa50eb2 100644
--- a/src/features/delayApp/index.js
+++ b/src/features/delayApp/index.js
@@ -23,29 +23,23 @@ function setVisibility(value) {
23} 23}
24 24
25export default function init(stores) { 25export default function init(stores) {
26 reaction( 26 debug('Initializing `delayApp` feature');
27 () => stores.features.features.needToWaitToProceed,
28 (enabled, r) => {
29 if (enabled) {
30 debug('Initializing `delayApp` feature');
31 27
32 // Dispose the reaction to run this only once 28 let shownAfterLaunch = false;
33 r.dispose(); 29 let timeLastDelay = moment();
34 30
35 const { needToWaitToProceedConfig: globalConfig } = stores.features.features; 31 reaction(
32 () => stores.features.features.needToWaitToProceed && !stores.user.data.isPremium,
33 (isEnabled) => {
34 if (isEnabled) {
35 debug('Enabling `delayApp` feature');
36 36
37 let shownAfterLaunch = false; 37 const { needToWaitToProceedConfig: globalConfig } = stores.features.features;
38 let timeLastDelay = moment();
39 38
40 config.delayOffset = globalConfig.delayOffset !== undefined ? globalConfig.delayOffset : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.delayOffset; 39 config.delayOffset = globalConfig.delayOffset !== undefined ? globalConfig.delayOffset : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.delayOffset;
41 config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; 40 config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait;
42 41
43 autorun(() => { 42 autorun(() => {
44 if (stores.user.data.isPremium) {
45 debug('Skipping app delay as user is Premium Supporter');
46 return;
47 }
48
49 if (stores.services.all.length === 0) { 43 if (stores.services.all.length === 0) {
50 shownAfterLaunch = true; 44 shownAfterLaunch = true;
51 return; 45 return;
@@ -68,6 +62,8 @@ export default function init(stores) {
68 }, DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait + 1000); // timer needs to be able to hit 0 62 }, DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait + 1000); // timer needs to be able to hit 0
69 } 63 }
70 }); 64 });
65 } else {
66 setVisibility(false);
71 } 67 }
72 }, 68 },
73 ); 69 );