blob: a07f9f63a258af7ab622c3cf7c4ec1490c50d2d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { autorun, observable } from 'mobx';
import { DEFAULT_FEATURES_CONFIG } from '../../config';
const debug = require('debug')('Franz:feature:spellchecker');
export const config = observable({
isIncludedInCurrentPlan: DEFAULT_FEATURES_CONFIG.isSpellcheckerIncludedInCurrentPlan,
});
export default function init(stores) {
debug('Initializing `spellchecker` feature');
autorun(() => {
const { isSpellcheckerIncludedInCurrentPlan } = stores.features.features;
config.isIncludedInCurrentPlan = isSpellcheckerIncludedInCurrentPlan !== undefined ? isSpellcheckerIncludedInCurrentPlan : DEFAULT_FEATURES_CONFIG.isSpellcheckerIncludedInCurrentPlan;
if (!stores.user.data.isPremium && config.isIncludedInCurrentPlan && stores.settings.app.enableSpellchecking) {
debug('Override settings.spellcheckerEnabled flag to false');
Object.assign(stores.settings.app, {
enableSpellchecking: false,
});
}
});
}
|