aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-01-08 10:34:00 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-01-08 10:34:00 +0100
commit91540e15eb2484a097587a38440b05897bb87638 (patch)
treedba412401da044ba203fcacb56018bfd7ed193eb /src/containers
parentSort languages by name (diff)
parentAdd color to service icons (diff)
downloadferdium-app-91540e15eb2484a097587a38440b05897bb87638.tar.gz
ferdium-app-91540e15eb2484a097587a38440b05897bb87638.tar.zst
ferdium-app-91540e15eb2484a097587a38440b05897bb87638.zip
Merge branch 'develop' into i18n
# Conflicts: # src/i18n/languages.js
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/settings/EditServiceScreen.js36
-rw-r--r--src/containers/settings/EditSettingsScreen.js17
-rw-r--r--src/containers/settings/ServicesScreen.js1
3 files changed, 52 insertions, 2 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index 191ef447b..c26195a1e 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -26,6 +26,10 @@ const messages = defineMessages({
26 id: 'settings.service.form.enableNotification', 26 id: 'settings.service.form.enableNotification',
27 defaultMessage: '!!!Enable Notifications', 27 defaultMessage: '!!!Enable Notifications',
28 }, 28 },
29 enableBadge: {
30 id: 'settings.service.form.enableBadge',
31 defaultMessage: '!!!Show unread message badges',
32 },
29 enableAudio: { 33 enableAudio: {
30 id: 'settings.service.form.enableAudio', 34 id: 'settings.service.form.enableAudio',
31 defaultMessage: '!!!Enable audio', 35 defaultMessage: '!!!Enable audio',
@@ -42,6 +46,10 @@ const messages = defineMessages({
42 id: 'settings.service.form.indirectMessages', 46 id: 'settings.service.form.indirectMessages',
43 defaultMessage: '!!!Show message badge for all new messages', 47 defaultMessage: '!!!Show message badge for all new messages',
44 }, 48 },
49 icon: {
50 id: 'settings.service.form.icon',
51 defaultMessage: '!!!Custom icon',
52 },
45}); 53});
46 54
47@inject('stores', 'actions') @observer 55@inject('stores', 'actions') @observer
@@ -88,11 +96,22 @@ export default class EditServiceScreen extends Component {
88 value: service.isNotificationEnabled, 96 value: service.isNotificationEnabled,
89 default: true, 97 default: true,
90 }, 98 },
99 isBadgeEnabled: {
100 label: intl.formatMessage(messages.enableBadge),
101 value: service.isBadgeEnabled,
102 default: true,
103 },
91 isMuted: { 104 isMuted: {
92 label: intl.formatMessage(messages.enableAudio), 105 label: intl.formatMessage(messages.enableAudio),
93 value: !service.isMuted, 106 value: !service.isMuted,
94 default: true, 107 default: true,
95 }, 108 },
109 customIcon: {
110 label: intl.formatMessage(messages.icon),
111 value: service.hasCustomUploadedIcon ? service.icon : false,
112 default: null,
113 type: 'file',
114 },
96 }, 115 },
97 }; 116 };
98 117
@@ -118,11 +137,22 @@ export default class EditServiceScreen extends Component {
118 }); 137 });
119 } 138 }
120 139
140 // More fine grained and use case specific validation rules
121 if (recipe.hasTeamId && recipe.hasCustomUrl) { 141 if (recipe.hasTeamId && recipe.hasCustomUrl) {
122 config.fields.team.validate = [oneRequired(['team', 'customUrl'])]; 142 config.fields.team.validate = [oneRequired(['team', 'customUrl'])];
123 config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])]; 143 config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])];
124 } 144 }
125 145
146 // If a service can be hosted and has a teamId or customUrl
147 if (recipe.hasHostedOption && (recipe.hasTeamId || recipe.hasCustomUrl)) {
148 if (config.fields.team) {
149 config.fields.team.validate = [];
150 }
151 if (config.fields.customUrl) {
152 config.fields.customUrl.validate = [url];
153 }
154 }
155
126 if (recipe.hasIndirectMessages) { 156 if (recipe.hasIndirectMessages) {
127 Object.assign(config.fields, { 157 Object.assign(config.fields, {
128 isIndirectMessageBadgeEnabled: { 158 isIndirectMessageBadgeEnabled: {
@@ -179,6 +209,12 @@ export default class EditServiceScreen extends Component {
179 return (<div>Loading...</div>); 209 return (<div>Loading...</div>);
180 } 210 }
181 211
212 if (!recipe) {
213 return (
214 <div>something went wrong</div>
215 );
216 }
217
182 const form = this.prepareForm(recipe, service); 218 const form = this.prepareForm(recipe, service);
183 219
184 return ( 220 return (
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 1a297f41f..1fa7ce8bc 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -193,8 +193,17 @@ export default class EditSettingsScreen extends Component {
193 } 193 }
194 194
195 render() { 195 render() {
196 const { updateStatus, updateStatusTypes } = this.props.stores.app; 196 const {
197 const { checkForUpdates, installUpdate } = this.props.actions.app; 197 updateStatus,
198 cacheSize,
199 updateStatusTypes,
200 isClearingAllCache,
201 } = this.props.stores.app;
202 const {
203 checkForUpdates,
204 installUpdate,
205 clearAllCache,
206 } = this.props.actions.app;
198 const form = this.prepareForm(); 207 const form = this.prepareForm();
199 208
200 return ( 209 return (
@@ -207,6 +216,9 @@ export default class EditSettingsScreen extends Component {
207 noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE} 216 noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE}
208 updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED} 217 updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED}
209 onSubmit={d => this.onSubmit(d)} 218 onSubmit={d => this.onSubmit(d)}
219 cacheSize={cacheSize}
220 isClearingAllCache={isClearingAllCache}
221 onClearAllCache={clearAllCache}
210 /> 222 />
211 ); 223 );
212 } 224 }
@@ -223,6 +235,7 @@ EditSettingsScreen.wrappedComponent.propTypes = {
223 launchOnStartup: PropTypes.func.isRequired, 235 launchOnStartup: PropTypes.func.isRequired,
224 checkForUpdates: PropTypes.func.isRequired, 236 checkForUpdates: PropTypes.func.isRequired,
225 installUpdate: PropTypes.func.isRequired, 237 installUpdate: PropTypes.func.isRequired,
238 clearAllCache: PropTypes.func.isRequired,
226 }).isRequired, 239 }).isRequired,
227 settings: PropTypes.shape({ 240 settings: PropTypes.shape({
228 update: PropTypes.func.isRequired, 241 update: PropTypes.func.isRequired,
diff --git a/src/containers/settings/ServicesScreen.js b/src/containers/settings/ServicesScreen.js
index 8cfe5efbf..12db1bcd3 100644
--- a/src/containers/settings/ServicesScreen.js
+++ b/src/containers/settings/ServicesScreen.js
@@ -53,6 +53,7 @@ export default class ServicesScreen extends Component {
53 goTo={router.push} 53 goTo={router.push}
54 servicesRequestFailed={services.allServicesRequest.wasExecuted && services.allServicesRequest.isError} 54 servicesRequestFailed={services.allServicesRequest.wasExecuted && services.allServicesRequest.isError}
55 retryServicesRequest={() => services.allServicesRequest.reload()} 55 retryServicesRequest={() => services.allServicesRequest.reload()}
56 searchNeedle={services.filterNeedle}
56 /> 57 />
57 ); 58 );
58 } 59 }