From 035dc1bbb1951bfe99740009f8b999c65861d133 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Sat, 1 Dec 2018 14:34:39 +0100 Subject: Move default feature config to config.js --- src/features/delayApp/index.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/features/delayApp') 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'; import moment from 'moment'; import DelayAppComponent from './Component'; -const debug = require('debug')('Franz:feature:delayApp'); +import { DEFAULT_FEATURES_CONFIG } from '../../config'; -const DEFAULT_DELAY_DURATION = 10000; // 10 seconds -const DEFAULT_DELAY_OFFSET = 3600000; // 1 hour -const DEFAULT_VISIBILITY = false; +const debug = require('debug')('Franz:feature:delayApp'); export const config = { - delayOffset: DEFAULT_DELAY_OFFSET, - delayDuration: DEFAULT_DELAY_DURATION, + delayOffset: DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.delayOffset, + delayDuration: DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait, }; export const state = observable({ - isDelayAppScreenVisible: DEFAULT_VISIBILITY, + isDelayAppScreenVisible: DEFAULT_FEATURES_CONFIG.needToWaitToProceed, }); function setVisibility(value) { @@ -38,8 +36,8 @@ export default function init(stores) { let shownAfterLaunch = false; let timeLastDelay = moment(); - config.delayOffset = globalConfig.delayOffset !== undefined ? globalConfig.delayOffset : DEFAULT_DELAY_OFFSET; - config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_DELAY_DURATION; + config.delayOffset = globalConfig.delayOffset !== undefined ? globalConfig.delayOffset : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.delayOffset; + config.delayDuration = globalConfig.wait !== undefined ? globalConfig.wait : DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait; autorun(() => { const diff = moment().diff(timeLastDelay); @@ -55,7 +53,7 @@ export default function init(stores) { debug('Resetting app delay'); setVisibility(false); - }, DEFAULT_DELAY_DURATION + 1000); // timer needs to be able to hit 0 + }, DEFAULT_FEATURES_CONFIG.needToWaitToProceedConfig.wait + 1000); // timer needs to be able to hit 0 } }); } -- cgit v1.2.3-54-g00ecf