diff options
Diffstat (limited to 'src/features/nightlyBuilds/index.ts')
-rw-r--r-- | src/features/nightlyBuilds/index.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/features/nightlyBuilds/index.ts b/src/features/nightlyBuilds/index.ts new file mode 100644 index 000000000..14afbaf1b --- /dev/null +++ b/src/features/nightlyBuilds/index.ts | |||
@@ -0,0 +1,41 @@ | |||
1 | import { state as ModalState } from './store'; | ||
2 | |||
3 | export { default as Component } from './Component'; | ||
4 | |||
5 | const debug = require('debug')('Ferdi:feature:nightlyBuilds'); | ||
6 | |||
7 | const state = ModalState; | ||
8 | |||
9 | export default function initialize() { | ||
10 | debug('Initialize nightlyBuilds feature'); | ||
11 | |||
12 | function showModal() { | ||
13 | state.isModalVisible = true; | ||
14 | } | ||
15 | |||
16 | function toggleFeature() { | ||
17 | if (window['ferdi'].stores.settings.app.nightly) { | ||
18 | window['ferdi'].actions.settings.update({ | ||
19 | type: 'app', | ||
20 | data: { | ||
21 | nightly: false, | ||
22 | }, | ||
23 | }); | ||
24 | window['ferdi'].actions.user.update({ | ||
25 | userData: { | ||
26 | nightly: false, | ||
27 | }, | ||
28 | }); | ||
29 | } else { | ||
30 | // We need to close the settings, otherwise the modal will be drawn under the settings window | ||
31 | window['ferdi'].actions.ui.closeSettings(); | ||
32 | showModal(); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | window['ferdi'].features.nightlyBuilds = { | ||
37 | state, | ||
38 | showModal, | ||
39 | toggleFeature, | ||
40 | }; | ||
41 | } | ||