diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-01 14:34:39 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-01 14:34:39 +0100 |
commit | 035dc1bbb1951bfe99740009f8b999c65861d133 (patch) | |
tree | 4e987938d7a25c08ea64f2692d5ae9f0b8bd80fe /src/features/delayApp/index.js | |
parent | Show service dark mode option only for dark mode services (diff) | |
download | ferdium-app-035dc1bbb1951bfe99740009f8b999c65861d133.tar.gz ferdium-app-035dc1bbb1951bfe99740009f8b999c65861d133.tar.zst ferdium-app-035dc1bbb1951bfe99740009f8b999c65861d133.zip |
Move default feature config to config.js
Diffstat (limited to 'src/features/delayApp/index.js')
-rw-r--r-- | src/features/delayApp/index.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js index 334433df8..3fc0f2570 100644 --- a/src/features/delayApp/index.js +++ b/src/features/delayApp/index.js | |||
@@ -2,19 +2,17 @@ import { autorun, observable, reaction } from 'mobx'; | |||
2 | import moment from 'moment'; | 2 | import moment from 'moment'; |
3 | import DelayAppComponent from './Component'; | 3 | import DelayAppComponent from './Component'; |
4 | 4 | ||
5 | const debug = require('debug')('Franz:feature:delayApp'); | 5 | import { DEFAULT_FEATURES_CONFIG } from '../../config'; |
6 | 6 | ||
7 | const DEFAULT_DELAY_DURATION = 10000; // 10 seconds | 7 | const debug = require('debug')('Franz:feature:delayApp'); |
8 | const DEFAULT_DELAY_OFFSET = 3600000; // 1 hour | ||
9 | const DEFAULT_VISIBILITY = false; | ||
10 | 8 | ||
11 | export const config = { | 9 | export const config = { |
12 | delayOffset: DEFAULT_DELAY_OFFSET, | 10 | delayOffset: DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.delayOffset, |
13 | delayDuration: DEFAULT_DELAY_DURATION, | 11 | delayDuration: DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait, |
14 | }; | 12 | }; |
15 | 13 | ||
16 | export const state = observable({ | 14 | export const state = observable({ |
17 | isDelayAppScreenVisible: DEFAULT_VISIBILITY, | 15 | isDelayAppScreenVisible: DEFAULT_FEATURES_CONFIG.needToWaitToProceed, |
18 | }); | 16 | }); |
19 | 17 | ||
20 | function setVisibility(value) { | 18 | function setVisibility(value) { |
@@ -38,8 +36,8 @@ export default function init(stores) { | |||
38 | let shownAfterLaunch = false; | 36 | let shownAfterLaunch = false; |
39 | let timeLastDelay = moment(); | 37 | let timeLastDelay = moment(); |
40 | 38 | ||
41 | config.delayOffset = globalConfig.delayOffset !== undefined ? globalConfig.delayOffset : DEFAULT_DELAY_OFFSET; | 39 | config.delayOffset = globalConfig.delayOffset !== undefined ? globalConfig.delayOffset : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.delayOffset; |
42 | config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_DELAY_DURATION; | 40 | config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; |
43 | 41 | ||
44 | autorun(() => { | 42 | autorun(() => { |
45 | const diff = moment().diff(timeLastDelay); | 43 | const diff = moment().diff(timeLastDelay); |
@@ -55,7 +53,7 @@ export default function init(stores) { | |||
55 | debug('Resetting app delay'); | 53 | debug('Resetting app delay'); |
56 | 54 | ||
57 | setVisibility(false); | 55 | setVisibility(false); |
58 | }, DEFAULT_DELAY_DURATION + 1000); // timer needs to be able to hit 0 | 56 | }, DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait + 1000); // timer needs to be able to hit 0 |
59 | } | 57 | } |
60 | }); | 58 | }); |
61 | } | 59 | } |