diff options
author | 2018-11-25 23:02:12 +0100 | |
---|---|---|
committer | 2018-11-25 23:02:12 +0100 | |
commit | 0d9c7ff6a638861d54f29bf91c82847cfa62a24c (patch) | |
tree | 1091fc0fe9b498e7b6fa69386ed2586d298d9269 /src/features/spellchecker | |
parent | Fix delayApp issues (diff) | |
download | ferdium-app-0d9c7ff6a638861d54f29bf91c82847cfa62a24c.tar.gz ferdium-app-0d9c7ff6a638861d54f29bf91c82847cfa62a24c.tar.zst ferdium-app-0d9c7ff6a638861d54f29bf91c82847cfa62a24c.zip |
Move spellchecker to premium
Diffstat (limited to 'src/features/spellchecker')
-rw-r--r-- | src/features/spellchecker/index.js | 54 | ||||
-rw-r--r-- | src/features/spellchecker/styles.js | 26 |
2 files changed, 80 insertions, 0 deletions
diff --git a/src/features/spellchecker/index.js b/src/features/spellchecker/index.js new file mode 100644 index 000000000..2627c9d17 --- /dev/null +++ b/src/features/spellchecker/index.js | |||
@@ -0,0 +1,54 @@ | |||
1 | import { autorun, reaction } from 'mobx'; | ||
2 | |||
3 | const debug = require('debug')('Franz:feature:spellchecker'); | ||
4 | |||
5 | const DEFAULT_IS_PREMIUM_FEATURE = true; | ||
6 | |||
7 | export const config = { | ||
8 | isPremiumFeature: DEFAULT_IS_PREMIUM_FEATURE, | ||
9 | }; | ||
10 | |||
11 | export default function init(stores) { | ||
12 | reaction( | ||
13 | () => stores.features.features.needToWaitToProceed, | ||
14 | (enabled, r) => { | ||
15 | if (enabled) { | ||
16 | debug('Initializing `spellchecker` feature'); | ||
17 | |||
18 | // Dispose the reaction to run this only once | ||
19 | r.dispose(); | ||
20 | |||
21 | const { isSpellcheckerPremiumFeature } = stores.features.features; | ||
22 | |||
23 | config.isPremiumFeature = isSpellcheckerPremiumFeature || DEFAULT_IS_PREMIUM_FEATURE; | ||
24 | |||
25 | // reaction( | ||
26 | // () => stores.settings.all.app.enableSpellchecking, | ||
27 | // (enabled, r) => { | ||
28 | // if (enabled) { | ||
29 | // // debug('Initializing `spellchecker` feature'); | ||
30 | |||
31 | // // // Dispose the reaction to run this only once | ||
32 | // // r.dispose(); | ||
33 | |||
34 | // // const { isSpellcheckerPremiumFeature } = stores.features.features; | ||
35 | |||
36 | // // config.isPremiumFeature = isSpellcheckerPremiumFeature || DEFAULT_IS_PREMIUM_FEATURE; | ||
37 | // } | ||
38 | // }, | ||
39 | // ); | ||
40 | |||
41 | autorun(() => { | ||
42 | if (!stores.user.data.isPremium && config.isPremiumFeature) { | ||
43 | debug('Override settings.spellcheckerEnabled flag to false'); | ||
44 | |||
45 | Object.assign(stores.settings.all.app, { | ||
46 | enableSpellchecker: false, | ||
47 | }); | ||
48 | } | ||
49 | }); | ||
50 | } | ||
51 | }, | ||
52 | ); | ||
53 | } | ||
54 | |||
diff --git a/src/features/spellchecker/styles.js b/src/features/spellchecker/styles.js new file mode 100644 index 000000000..097368d9a --- /dev/null +++ b/src/features/spellchecker/styles.js | |||
@@ -0,0 +1,26 @@ | |||
1 | export default (theme) => { | ||
2 | console.log(theme); | ||
3 | return ({ | ||
4 | container: { | ||
5 | background: theme.colorBackground, | ||
6 | position: 'absolute', | ||
7 | top: 0, | ||
8 | width: '100%', | ||
9 | display: 'flex', | ||
10 | 'flex-direction': 'column', | ||
11 | 'align-items': 'center', | ||
12 | 'justify-content': 'center', | ||
13 | 'z-index': 150, | ||
14 | }, | ||
15 | headline: { | ||
16 | color: theme.colorHeadline, | ||
17 | margin: [25, 0, 40], | ||
18 | 'max-width': 500, | ||
19 | 'text-align': 'center', | ||
20 | 'line-height': '1.3em', | ||
21 | }, | ||
22 | button: { | ||
23 | margin: [40, 0, 20], | ||
24 | }, | ||
25 | }); | ||
26 | }; | ||