blob: 2627c9d17d61c3908ed43130ffd9043e879aaa06 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import { autorun, reaction } from 'mobx';
const debug = require('debug')('Franz:feature:spellchecker');
const DEFAULT_IS_PREMIUM_FEATURE = true;
export const config = {
isPremiumFeature: DEFAULT_IS_PREMIUM_FEATURE,
};
export default function init(stores) {
reaction(
() => stores.features.features.needToWaitToProceed,
(enabled, r) => {
if (enabled) {
debug('Initializing `spellchecker` feature');
// Dispose the reaction to run this only once
r.dispose();
const { isSpellcheckerPremiumFeature } = stores.features.features;
config.isPremiumFeature = isSpellcheckerPremiumFeature || DEFAULT_IS_PREMIUM_FEATURE;
// reaction(
// () => stores.settings.all.app.enableSpellchecking,
// (enabled, r) => {
// if (enabled) {
// // debug('Initializing `spellchecker` feature');
// // // Dispose the reaction to run this only once
// // r.dispose();
// // const { isSpellcheckerPremiumFeature } = stores.features.features;
// // config.isPremiumFeature = isSpellcheckerPremiumFeature || DEFAULT_IS_PREMIUM_FEATURE;
// }
// },
// );
autorun(() => {
if (!stores.user.data.isPremium && config.isPremiumFeature) {
debug('Override settings.spellcheckerEnabled flag to false');
Object.assign(stores.settings.all.app, {
enableSpellchecker: false,
});
}
});
}
},
);
}
|