@@ -6,6 +6,7 @@ import { defineMessages, intlShape } from 'react-intl';
66import AppStore from '../../stores/AppStore' ;
77import SettingsStore from '../../stores/SettingsStore' ;
88import UserStore from '../../stores/UserStore' ;
9+ import TodosStore from '../../features/todos/store' ;
910import Form from '../../lib/Form' ;
1011import { APP_LOCALES , SPELLCHECKER_LOCALES } from '../../i18n/languages' ;
1112import { DEFAULT_APP_SETTINGS } from '../../config' ;
@@ -17,6 +18,7 @@ import EditSettingsForm from '../../components/settings/settings/EditSettingsFor
1718import ErrorBoundary from '../../components/util/ErrorBoundary' ;
1819
1920import globalMessages from '../../i18n/globalMessages' ;
21+ import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos' ;
2022
2123const messages = defineMessages ( {
2224 autoLaunchOnStart : {
@@ -67,6 +69,10 @@ const messages = defineMessages({
6769 id : 'settings.app.form.beta' ,
6870 defaultMessage : '!!!Include beta versions' ,
6971 } ,
72+ enableTodos : {
73+ id : 'settings.app.form.enableTodos' ,
74+ defaultMessage : '!!!Enable Franz Todos' ,
75+ } ,
7076} ) ;
7177
7278export default @inject ( 'stores' , 'actions' ) @observer class EditSettingsScreen extends Component {
@@ -75,7 +81,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
7581 } ;
7682
7783 onSubmit ( settingsData ) {
78- const { app, settings, user } = this . props . actions ;
84+ const { todos } = this . props . stores ;
85+ const {
86+ app,
87+ settings,
88+ user,
89+ todos : todosActions ,
90+ } = this . props . actions ;
7991
8092 app . launchOnStartup ( {
8193 enable : settingsData . autoLaunchOnStart ,
@@ -105,10 +117,16 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
105117 locale : settingsData . locale ,
106118 } ,
107119 } ) ;
120+
121+ if ( todos . isFeatureActive ) {
122+ todosActions . toggleTodosFeatureVisibility ( ) ;
123+ }
108124 }
109125
110126 prepareForm ( ) {
111- const { app, settings, user } = this . props . stores ;
127+ const {
128+ app, settings, user, todos,
129+ } = this . props . stores ;
112130 const { intl } = this . context ;
113131
114132 const locales = getSelectOptions ( {
@@ -192,16 +210,28 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
192210 } ,
193211 } ;
194212
213+ if ( todos . isFeatureActive ) {
214+ config . fields . enableTodos = {
215+ label : intl . formatMessage ( messages . enableTodos ) ,
216+ value : todos . settings . isFeatureEnabledByUser ,
217+ default : DEFAULT_IS_FEATURE_ENABLED_BY_USER ,
218+ } ;
219+ }
220+
195221 return new Form ( config ) ;
196222 }
197223
198224 render ( ) {
225+ const {
226+ app,
227+ todos,
228+ } = this . props . stores ;
199229 const {
200230 updateStatus,
201231 cacheSize,
202232 updateStatusTypes,
203233 isClearingAllCache,
204- } = this . props . stores . app ;
234+ } = app ;
205235 const {
206236 checkForUpdates,
207237 installUpdate,
@@ -224,6 +254,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
224254 isClearingAllCache = { isClearingAllCache }
225255 onClearAllCache = { clearAllCache }
226256 isSpellcheckerIncludedInCurrentPlan = { spellcheckerConfig . isIncludedInCurrentPlan }
257+ isTodosEnabled = { todos . isFeatureActive }
227258 />
228259 </ ErrorBoundary >
229260 ) ;
@@ -235,6 +266,7 @@ EditSettingsScreen.wrappedComponent.propTypes = {
235266 app : PropTypes . instanceOf ( AppStore ) . isRequired ,
236267 user : PropTypes . instanceOf ( UserStore ) . isRequired ,
237268 settings : PropTypes . instanceOf ( SettingsStore ) . isRequired ,
269+ todos : PropTypes . instanceOf ( TodosStore ) . isRequired ,
238270 } ) . isRequired ,
239271 actions : PropTypes . shape ( {
240272 app : PropTypes . shape ( {
@@ -249,5 +281,8 @@ EditSettingsScreen.wrappedComponent.propTypes = {
249281 user : PropTypes . shape ( {
250282 update : PropTypes . func . isRequired ,
251283 } ) . isRequired ,
284+ todos : PropTypes . shape ( {
285+ toggleTodosFeatureVisibility : PropTypes . func . isRequired ,
286+ } ) . isRequired ,
252287 } ) . isRequired ,
253288} ;
0 commit comments