diff options
author | 2017-12-14 16:49:50 +0100 | |
---|---|---|
committer | 2017-12-14 16:49:50 +0100 | |
commit | cea7a5cde78189d43fdd4d43d6a5cb12cd29e1c5 (patch) | |
tree | 81507268d5eef4e51da52dc7fa21152552327252 /src | |
parent | remove unecessary console logs (diff) | |
download | ferdium-app-cea7a5cde78189d43fdd4d43d6a5cb12cd29e1c5.tar.gz ferdium-app-cea7a5cde78189d43fdd4d43d6a5cb12cd29e1c5.tar.zst ferdium-app-cea7a5cde78189d43fdd4d43d6a5cb12cd29e1c5.zip |
feat(Service): Add option to completely disable message badges
Diffstat (limited to 'src')
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 52 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 9 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 4 | ||||
-rw-r--r-- | src/models/Service.js | 1 | ||||
-rw-r--r-- | src/styles/settings.scss | 23 |
5 files changed, 69 insertions, 20 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 36cefe87c..32f9d72f0 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -67,6 +67,18 @@ const messages = defineMessages({ | |||
67 | id: 'settings.service.form.isMutedInfo', | 67 | id: 'settings.service.form.isMutedInfo', |
68 | defaultMessage: '!!!When disabled, all notification sounds and audio playback are muted', | 68 | defaultMessage: '!!!When disabled, all notification sounds and audio playback are muted', |
69 | }, | 69 | }, |
70 | headlineNotifications: { | ||
71 | id: 'settings.service.form.headlineNotifications', | ||
72 | defaultMessage: '!!!Notifications', | ||
73 | }, | ||
74 | headlineBadges: { | ||
75 | id: 'settings.service.form.headlineBadges', | ||
76 | defaultMessage: '!!!Unread message dadges', | ||
77 | }, | ||
78 | headlineGeneral: { | ||
79 | id: 'settings.service.form.headlineGeneral', | ||
80 | defaultMessage: '!!!General', | ||
81 | }, | ||
70 | }); | 82 | }); |
71 | 83 | ||
72 | @observer | 84 | @observer |
@@ -231,20 +243,32 @@ export default class EditServiceForm extends Component { | |||
231 | </Tabs> | 243 | </Tabs> |
232 | )} | 244 | )} |
233 | <div className="settings__options"> | 245 | <div className="settings__options"> |
234 | <Toggle field={form.$('isNotificationEnabled')} /> | 246 | <div className="settings__settings-group"> |
235 | {recipe.hasIndirectMessages && ( | 247 | <h3>{intl.formatMessage(messages.headlineNotifications)}</h3> |
236 | <div> | 248 | <Toggle field={form.$('isNotificationEnabled')} /> |
237 | <Toggle field={form.$('isIndirectMessageBadgeEnabled')} /> | 249 | <Toggle field={form.$('isMuted')} /> |
238 | <p className="settings__help"> | 250 | <p className="settings__help"> |
239 | {intl.formatMessage(messages.indirectMessageInfo)} | 251 | {intl.formatMessage(messages.isMutedInfo)} |
240 | </p> | 252 | </p> |
241 | </div> | 253 | </div> |
242 | )} | 254 | |
243 | <Toggle field={form.$('isMuted')} /> | 255 | <div className="settings__settings-group"> |
244 | <p className="settings__help"> | 256 | <h3>{intl.formatMessage(messages.headlineBadges)}</h3> |
245 | {intl.formatMessage(messages.isMutedInfo)} | 257 | <Toggle field={form.$('isBadgeEnabled')} /> |
246 | </p> | 258 | {recipe.hasIndirectMessages && form.$('isBadgeEnabled').value && ( |
247 | <Toggle field={form.$('isEnabled')} /> | 259 | <div> |
260 | <Toggle field={form.$('isIndirectMessageBadgeEnabled')} /> | ||
261 | <p className="settings__help"> | ||
262 | {intl.formatMessage(messages.indirectMessageInfo)} | ||
263 | </p> | ||
264 | </div> | ||
265 | )} | ||
266 | </div> | ||
267 | |||
268 | <div className="settings__settings-group"> | ||
269 | <h3>{intl.formatMessage(messages.headlineGeneral)}</h3> | ||
270 | <Toggle field={form.$('isEnabled')} /> | ||
271 | </div> | ||
248 | </div> | 272 | </div> |
249 | {recipe.message && ( | 273 | {recipe.message && ( |
250 | <p className="settings__message"> | 274 | <p className="settings__message"> |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index 191ef447b..cdde292b0 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', |
@@ -88,6 +92,11 @@ export default class EditServiceScreen extends Component { | |||
88 | value: service.isNotificationEnabled, | 92 | value: service.isNotificationEnabled, |
89 | default: true, | 93 | default: true, |
90 | }, | 94 | }, |
95 | isBadgeEnabled: { | ||
96 | label: intl.formatMessage(messages.enableBadge), | ||
97 | value: service.isBadgeEnabled, | ||
98 | default: true, | ||
99 | }, | ||
91 | isMuted: { | 100 | isMuted: { |
92 | label: intl.formatMessage(messages.enableAudio), | 101 | label: intl.formatMessage(messages.enableAudio), |
93 | value: !service.isMuted, | 102 | value: !service.isMuted, |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 48b408e59..a6da0f61d 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -117,11 +117,15 @@ | |||
117 | "settings.service.form.name": "Name", | 117 | "settings.service.form.name": "Name", |
118 | "settings.service.form.enableService": "Enable service", | 118 | "settings.service.form.enableService": "Enable service", |
119 | "settings.service.form.enableNotification": "Enable notifications", | 119 | "settings.service.form.enableNotification": "Enable notifications", |
120 | "settings.service.form.enableBadge": "Show unread message badges", | ||
120 | "settings.service.form.team": "Team", | 121 | "settings.service.form.team": "Team", |
121 | "settings.service.form.customUrl": "Custom server", | 122 | "settings.service.form.customUrl": "Custom server", |
122 | "settings.service.form.indirectMessages": "Show message badge for all new messages", | 123 | "settings.service.form.indirectMessages": "Show message badge for all new messages", |
123 | "settings.service.form.enableAudio": "Enable audio", | 124 | "settings.service.form.enableAudio": "Enable audio", |
124 | "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted", | 125 | "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted", |
126 | "settings.service.form.headlineNotifications": "Notifications", | ||
127 | "settings.service.form.headlineBadges": "Unread message badges", | ||
128 | "settings.service.form.headlineGeneral": "General", | ||
125 | "settings.service.error.headline": "Error", | 129 | "settings.service.error.headline": "Error", |
126 | "settings.service.error.goBack": "Back to services", | 130 | "settings.service.error.goBack": "Back to services", |
127 | "settings.service.error.message": "Could not load service recipe.", | 131 | "settings.service.error.message": "Could not load service recipe.", |
diff --git a/src/models/Service.js b/src/models/Service.js index 958e4b11e..820cf4506 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -22,6 +22,7 @@ export default class Service { | |||
22 | @observable team = ''; | 22 | @observable team = ''; |
23 | @observable customUrl = ''; | 23 | @observable customUrl = ''; |
24 | @observable isNotificationEnabled = true; | 24 | @observable isNotificationEnabled = true; |
25 | @observable isBadgeEnabled = true; | ||
25 | @observable isIndirectMessageBadgeEnabled = true; | 26 | @observable isIndirectMessageBadgeEnabled = true; |
26 | @observable customIconUrl = ''; | 27 | @observable customIconUrl = ''; |
27 | @observable hasCrashed = false; | 28 | @observable hasCrashed = false; |
diff --git a/src/styles/settings.scss b/src/styles/settings.scss index 73cef0813..b29ed5468 100644 --- a/src/styles/settings.scss +++ b/src/styles/settings.scss | |||
@@ -151,8 +151,23 @@ | |||
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | .settings__options { | 154 | &__options { |
155 | margin-top: 30px; | 155 | margin-top: 20px; |
156 | } | ||
157 | |||
158 | &__settings-group { | ||
159 | margin-top: 10px; | ||
160 | |||
161 | h3 { | ||
162 | font-weight: bold; | ||
163 | margin: 25px 0 15px; | ||
164 | color: $theme-gray-light; | ||
165 | letter-spacing: -0.1px; | ||
166 | |||
167 | &:first-of-type { | ||
168 | margin-top: 0; | ||
169 | } | ||
170 | } | ||
156 | } | 171 | } |
157 | 172 | ||
158 | .settings__message { | 173 | .settings__message { |
@@ -173,10 +188,6 @@ | |||
173 | margin: -10px 0 20px 55px;; | 188 | margin: -10px 0 20px 55px;; |
174 | font-size: 12px; | 189 | font-size: 12px; |
175 | color: $theme-gray-light; | 190 | color: $theme-gray-light; |
176 | |||
177 | &:last-of-type { | ||
178 | margin-bottom: 30px; | ||
179 | } | ||
180 | } | 191 | } |
181 | 192 | ||
182 | .settings__controls { | 193 | .settings__controls { |