aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/layout/AppLayoutContainer.js29
-rw-r--r--src/containers/settings/EditServiceScreen.js15
-rw-r--r--src/containers/settings/EditSettingsScreen.js58
3 files changed, 82 insertions, 20 deletions
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index aa7f7952a..7c6ceccd6 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -7,7 +7,7 @@ import RecipesStore from '../../stores/RecipesStore';
7import ServicesStore from '../../stores/ServicesStore'; 7import ServicesStore from '../../stores/ServicesStore';
8import UIStore from '../../stores/UIStore'; 8import UIStore from '../../stores/UIStore';
9import NewsStore from '../../stores/NewsStore'; 9import NewsStore from '../../stores/NewsStore';
10import UserStore from '../../stores/UserStore'; 10import SettingsStore from '../../stores/SettingsStore';
11import RequestStore from '../../stores/RequestStore'; 11import RequestStore from '../../stores/RequestStore';
12import GlobalErrorStore from '../../stores/GlobalErrorStore'; 12import GlobalErrorStore from '../../stores/GlobalErrorStore';
13 13
@@ -29,8 +29,8 @@ export default class AppLayoutContainer extends Component {
29 services, 29 services,
30 ui, 30 ui,
31 news, 31 news,
32 settings,
32 globalError, 33 globalError,
33 user,
34 requests, 34 requests,
35 } = this.props.stores; 35 } = this.props.stores;
36 36
@@ -43,6 +43,7 @@ export default class AppLayoutContainer extends Component {
43 reorder, 43 reorder,
44 reload, 44 reload,
45 toggleNotifications, 45 toggleNotifications,
46 toggleAudio,
46 deleteService, 47 deleteService,
47 updateService, 48 updateService,
48 } = this.props.actions.service; 49 } = this.props.actions.service;
@@ -53,6 +54,7 @@ export default class AppLayoutContainer extends Component {
53 54
54 const { 55 const {
55 installUpdate, 56 installUpdate,
57 toggleMuteApp,
56 } = this.props.actions.app; 58 } = this.props.actions.app;
57 59
58 const { 60 const {
@@ -61,42 +63,44 @@ export default class AppLayoutContainer extends Component {
61 } = this.props.actions.ui; 63 } = this.props.actions.ui;
62 64
63 const { children } = this.props; 65 const { children } = this.props;
64 const allServices = services.enabled;
65 66
66 const isLoadingServices = services.allServicesRequest.isExecuting 67 const isLoadingServices = services.allServicesRequest.isExecuting
67 && services.allServicesRequest.isExecutingFirstTime; 68 && services.allServicesRequest.isExecutingFirstTime;
68 69
69 // const isLoadingRecipes = recipes.allRecipesRequest.isExecuting
70 // && recipes.allRecipesRequest.isExecutingFirstTime;
71
72 if (isLoadingServices) { 70 if (isLoadingServices) {
73 return ( 71 return (
74 <AppLoader /> 72 <AppLoader />
75 ); 73 );
76 } 74 }
77 75
76 const isMuted = settings.all.isAppMuted || app.isSystemMuted;
77
78 const sidebar = ( 78 const sidebar = (
79 <Sidebar 79 <Sidebar
80 services={allServices} 80 services={services.allDisplayed}
81 setActive={setActive} 81 setActive={setActive}
82 isAppMuted={isMuted}
82 openSettings={openSettings} 83 openSettings={openSettings}
83 closeSettings={closeSettings} 84 closeSettings={closeSettings}
84 reorder={reorder} 85 reorder={reorder}
85 reload={reload} 86 reload={reload}
86 toggleNotifications={toggleNotifications} 87 toggleNotifications={toggleNotifications}
88 toggleAudio={toggleAudio}
87 deleteService={deleteService} 89 deleteService={deleteService}
88 updateService={updateService} 90 updateService={updateService}
89 isPremiumUser={user.data.isPremium} 91 toggleMuteApp={toggleMuteApp}
90 /> 92 />
91 ); 93 );
92 94
93 const servicesContainer = ( 95 const servicesContainer = (
94 <Services 96 <Services
95 // settings={allSettings} 97 services={services.allDisplayed}
96 services={allServices}
97 handleIPCMessage={handleIPCMessage} 98 handleIPCMessage={handleIPCMessage}
98 setWebviewReference={setWebviewReference} 99 setWebviewReference={setWebviewReference}
99 openWindow={openWindow} 100 openWindow={openWindow}
101 reload={reload}
102 isAppMuted={isMuted}
103 update={updateService}
100 /> 104 />
101 ); 105 );
102 106
@@ -130,7 +134,7 @@ AppLayoutContainer.wrappedComponent.propTypes = {
130 app: PropTypes.instanceOf(AppStore).isRequired, 134 app: PropTypes.instanceOf(AppStore).isRequired,
131 ui: PropTypes.instanceOf(UIStore).isRequired, 135 ui: PropTypes.instanceOf(UIStore).isRequired,
132 news: PropTypes.instanceOf(NewsStore).isRequired, 136 news: PropTypes.instanceOf(NewsStore).isRequired,
133 user: PropTypes.instanceOf(UserStore).isRequired, 137 settings: PropTypes.instanceOf(SettingsStore).isRequired,
134 requests: PropTypes.instanceOf(RequestStore).isRequired, 138 requests: PropTypes.instanceOf(RequestStore).isRequired,
135 globalError: PropTypes.instanceOf(GlobalErrorStore).isRequired, 139 globalError: PropTypes.instanceOf(GlobalErrorStore).isRequired,
136 }).isRequired, 140 }).isRequired,
@@ -139,6 +143,7 @@ AppLayoutContainer.wrappedComponent.propTypes = {
139 setActive: PropTypes.func.isRequired, 143 setActive: PropTypes.func.isRequired,
140 reload: PropTypes.func.isRequired, 144 reload: PropTypes.func.isRequired,
141 toggleNotifications: PropTypes.func.isRequired, 145 toggleNotifications: PropTypes.func.isRequired,
146 toggleAudio: PropTypes.func.isRequired,
142 handleIPCMessage: PropTypes.func.isRequired, 147 handleIPCMessage: PropTypes.func.isRequired,
143 setWebviewReference: PropTypes.func.isRequired, 148 setWebviewReference: PropTypes.func.isRequired,
144 openWindow: PropTypes.func.isRequired, 149 openWindow: PropTypes.func.isRequired,
@@ -156,7 +161,7 @@ AppLayoutContainer.wrappedComponent.propTypes = {
156 }).isRequired, 161 }).isRequired,
157 app: PropTypes.shape({ 162 app: PropTypes.shape({
158 installUpdate: PropTypes.func.isRequired, 163 installUpdate: PropTypes.func.isRequired,
159 healthCheck: PropTypes.func.isRequired, 164 toggleMuteApp: PropTypes.func.isRequired,
160 }).isRequired, 165 }).isRequired,
161 requests: PropTypes.shape({ 166 requests: PropTypes.shape({
162 retryRequiredRequests: PropTypes.func.isRequired, 167 retryRequiredRequests: PropTypes.func.isRequired,
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index 6c614b941..191ef447b 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -9,7 +9,6 @@ import ServicesStore from '../../stores/ServicesStore';
9import Form from '../../lib/Form'; 9import Form from '../../lib/Form';
10import { gaPage } from '../../lib/analytics'; 10import { gaPage } from '../../lib/analytics';
11 11
12
13import ServiceError from '../../components/settings/services/ServiceError'; 12import ServiceError from '../../components/settings/services/ServiceError';
14import EditServiceForm from '../../components/settings/services/EditServiceForm'; 13import EditServiceForm from '../../components/settings/services/EditServiceForm';
15import { required, url, oneRequired } from '../../helpers/validation-helpers'; 14import { required, url, oneRequired } from '../../helpers/validation-helpers';
@@ -27,6 +26,10 @@ const messages = defineMessages({
27 id: 'settings.service.form.enableNotification', 26 id: 'settings.service.form.enableNotification',
28 defaultMessage: '!!!Enable Notifications', 27 defaultMessage: '!!!Enable Notifications',
29 }, 28 },
29 enableAudio: {
30 id: 'settings.service.form.enableAudio',
31 defaultMessage: '!!!Enable audio',
32 },
30 team: { 33 team: {
31 id: 'settings.service.form.team', 34 id: 'settings.service.form.team',
32 defaultMessage: '!!!Team', 35 defaultMessage: '!!!Team',
@@ -51,11 +54,14 @@ export default class EditServiceScreen extends Component {
51 gaPage('Settings/Service/Edit'); 54 gaPage('Settings/Service/Edit');
52 } 55 }
53 56
54 onSubmit(serviceData) { 57 onSubmit(data) {
55 const { action } = this.props.router.params; 58 const { action } = this.props.router.params;
56 const { recipes, services } = this.props.stores; 59 const { recipes, services } = this.props.stores;
57 const { createService, updateService } = this.props.actions.service; 60 const { createService, updateService } = this.props.actions.service;
58 61
62 const serviceData = data;
63 serviceData.isMuted = !serviceData.isMuted;
64
59 if (action === 'edit') { 65 if (action === 'edit') {
60 updateService({ serviceId: services.activeSettings.id, serviceData }); 66 updateService({ serviceId: services.activeSettings.id, serviceData });
61 } else { 67 } else {
@@ -82,6 +88,11 @@ export default class EditServiceScreen extends Component {
82 value: service.isNotificationEnabled, 88 value: service.isNotificationEnabled,
83 default: true, 89 default: true,
84 }, 90 },
91 isMuted: {
92 label: intl.formatMessage(messages.enableAudio),
93 value: !service.isMuted,
94 default: true,
95 },
85 }, 96 },
86 }; 97 };
87 98
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 6dc2175e1..62e255dab 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -7,7 +7,7 @@ import AppStore from '../../stores/AppStore';
7import SettingsStore from '../../stores/SettingsStore'; 7import SettingsStore from '../../stores/SettingsStore';
8import UserStore from '../../stores/UserStore'; 8import UserStore from '../../stores/UserStore';
9import Form from '../../lib/Form'; 9import Form from '../../lib/Form';
10import languages from '../../i18n/languages'; 10import { APP_LOCALES } from '../../i18n/languages';
11import { gaPage } from '../../lib/analytics'; 11import { gaPage } from '../../lib/analytics';
12import { DEFAULT_APP_SETTINGS } from '../../config'; 12import { DEFAULT_APP_SETTINGS } from '../../config';
13 13
@@ -39,6 +39,22 @@ const messages = defineMessages({
39 id: 'settings.app.form.language', 39 id: 'settings.app.form.language',
40 defaultMessage: '!!!Language', 40 defaultMessage: '!!!Language',
41 }, 41 },
42 showDisabledServices: {
43 id: 'settings.app.form.showDisabledServices',
44 defaultMessage: '!!!Display disabled services tabs',
45 },
46 enableSpellchecking: {
47 id: 'settings.app.form.enableSpellchecking',
48 defaultMessage: '!!!Enable spell checking',
49 },
50 spellcheckingLanguage: {
51 id: 'settings.app.form.spellcheckingLanguage',
52 defaultMessage: '!!!Language for spell checking',
53 },
54 // spellcheckingAutomaticDetection: {
55 // id: 'settings.app.form.spellcheckingAutomaticDetection',
56 // defaultMessage: '!!!Detect language automatically',
57 // },
42 beta: { 58 beta: {
43 id: 'settings.app.form.beta', 59 id: 'settings.app.form.beta',
44 defaultMessage: '!!!Include beta versions', 60 defaultMessage: '!!!Include beta versions',
@@ -68,6 +84,9 @@ export default class EditSettingsScreen extends Component {
68 runInBackground: settingsData.runInBackground, 84 runInBackground: settingsData.runInBackground,
69 enableSystemTray: settingsData.enableSystemTray, 85 enableSystemTray: settingsData.enableSystemTray,
70 minimizeToSystemTray: settingsData.minimizeToSystemTray, 86 minimizeToSystemTray: settingsData.minimizeToSystemTray,
87 showDisabledServices: settingsData.showDisabledServices,
88 enableSpellchecking: settingsData.enableSpellchecking,
89 // spellcheckingLanguage: settingsData.spellcheckingLanguage,
71 locale: settingsData.locale, 90 locale: settingsData.locale,
72 beta: settingsData.beta, 91 beta: settingsData.beta,
73 }, 92 },
@@ -84,14 +103,25 @@ export default class EditSettingsScreen extends Component {
84 const { app, settings, user } = this.props.stores; 103 const { app, settings, user } = this.props.stores;
85 const { intl } = this.context; 104 const { intl } = this.context;
86 105
87 const options = []; 106 const locales = [];
88 Object.keys(languages).forEach((key) => { 107 Object.keys(APP_LOCALES).forEach((key) => {
89 options.push({ 108 locales.push({
90 value: key, 109 value: key,
91 label: languages[key], 110 label: APP_LOCALES[key],
92 }); 111 });
93 }); 112 });
94 113
114 // const spellcheckerLocales = [{
115 // value: 'auto',
116 // label: intl.formatMessage(messages.spellcheckingAutomaticDetection),
117 // }];
118 // Object.keys(SPELLCHECKER_LOCALES).forEach((key) => {
119 // spellcheckerLocales.push({
120 // value: key,
121 // label: SPELLCHECKER_LOCALES[key],
122 // });
123 // });
124
95 const config = { 125 const config = {
96 fields: { 126 fields: {
97 autoLaunchOnStart: { 127 autoLaunchOnStart: {
@@ -119,10 +149,26 @@ export default class EditSettingsScreen extends Component {
119 value: settings.all.minimizeToSystemTray, 149 value: settings.all.minimizeToSystemTray,
120 default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, 150 default: DEFAULT_APP_SETTINGS.minimizeToSystemTray,
121 }, 151 },
152 showDisabledServices: {
153 label: intl.formatMessage(messages.showDisabledServices),
154 value: settings.all.showDisabledServices,
155 default: DEFAULT_APP_SETTINGS.showDisabledServices,
156 },
157 enableSpellchecking: {
158 label: intl.formatMessage(messages.enableSpellchecking),
159 value: settings.all.enableSpellchecking,
160 default: DEFAULT_APP_SETTINGS.enableSpellchecking,
161 },
162 // spellcheckingLanguage: {
163 // label: intl.formatMessage(messages.spellcheckingLanguage),
164 // value: settings.all.spellcheckingLanguage,
165 // options: spellcheckerLocales,
166 // default: DEFAULT_APP_SETTINGS.spellcheckingLanguage,
167 // },
122 locale: { 168 locale: {
123 label: intl.formatMessage(messages.language), 169 label: intl.formatMessage(messages.language),
124 value: app.locale, 170 value: app.locale,
125 options, 171 options: locales,
126 default: DEFAULT_APP_SETTINGS.locale, 172 default: DEFAULT_APP_SETTINGS.locale,
127 }, 173 },
128 beta: { 174 beta: {