blob: 34fe37d4dffd91e0b5a1bcfa9079421f1507e277 (
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
|
import { observable } from 'mobx';
export { default as Component } from './Component';
const debug = require('debug')('Ferdi:feature:nightlyBuilds');
const defaultState = {
isModalVisible: false,
};
export const state = observable(defaultState);
export default function initialize() {
debug('Initialize nightlyBuilds feature');
function showModal() {
state.isModalVisible = true;
}
function toggleFeature() {
if (window.ferdi.stores.settings.app.nightly) {
window.ferdi.actions.settings.update({
type: 'app',
data: {
nightly: false,
},
});
window.ferdi.actions.user.update({
userData: {
nightly: false,
},
});
} else {
// We need to close the settings, otherwise the modal will be drawn under the settings window
window.ferdi.actions.ui.closeSettings();
showModal();
}
}
window.ferdi.features.nightlyBuilds = {
state,
showModal,
toggleFeature,
};
}
|