blob: 79a2172b44c28b32a1f08e323c1c3dc80253ee82 (
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({
isPremium: DEFAULT_FEATURES_CONFIG.isSpellcheckerPremiumFeature,
});
export default function init(stores) {
debug('Initializing `spellchecker` feature');
autorun(() => {
const { isSpellcheckerPremiumFeature } = stores.features.features;
config.isPremium = isSpellcheckerPremiumFeature !== undefined ? isSpellcheckerPremiumFeature : DEFAULT_FEATURES_CONFIG.isSpellcheckerPremiumFeature;
if (!stores.user.data.isPremium && config.isPremium && stores.settings.app.enableSpellchecking) {
debug('Override settings.spellcheckerEnabled flag to false');
Object.assign(stores.settings.app, {
enableSpellchecking: false,
});
}
});
}
|