From 0b08e1e7e6a07acd21af71fd27f4c4acfa34dbba Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 16 Oct 2019 15:16:26 +0200 Subject: Add trialStatusBar & polishing --- src/features/trialStatusBar/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/features/trialStatusBar/index.js (limited to 'src/features/trialStatusBar/index.js') diff --git a/src/features/trialStatusBar/index.js b/src/features/trialStatusBar/index.js new file mode 100644 index 000000000..ec84cdfd7 --- /dev/null +++ b/src/features/trialStatusBar/index.js @@ -0,0 +1,30 @@ +import { reaction } from 'mobx'; +import TrialStatusBarStore from './store'; + +const debug = require('debug')('Franz:feature:trialStatusBar'); + +export const GA_CATEGORY_TRIAL_STATUS_BAR = 'trialStatusBar'; + +export const trialStatusBarStore = new TrialStatusBarStore(); + +export default function initTrialStatusBar(stores, actions) { + stores.trialStatusBar = trialStatusBarStore; + const { features } = stores; + + // Toggle trialStatusBar feature + reaction( + () => features.features.isTrialStatusBarEnabled, + (isEnabled) => { + if (isEnabled) { + debug('Initializing `trialStatusBar` feature'); + trialStatusBarStore.start(stores, actions); + } else if (trialStatusBarStore.isFeatureActive) { + debug('Disabling `trialStatusBar` feature'); + trialStatusBarStore.stop(); + } + }, + { + fireImmediately: true, + }, + ); +} -- cgit v1.2.3-70-g09d2