aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-11-09 16:28:03 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-11-09 16:28:03 +0100
commitb405ba11aa3c669a21831d016084e0c47bffdebc (patch)
tree24dbb9ca8ea83e0f2126e6e68c81a9e51eb49b91
parentMerge branch 'develop' of github.com:meetfranz/franz into develop (diff)
downloadferdium-app-b405ba11aa3c669a21831d016084e0c47bffdebc.tar.gz
ferdium-app-b405ba11aa3c669a21831d016084e0c47bffdebc.tar.zst
ferdium-app-b405ba11aa3c669a21831d016084e0c47bffdebc.zip
feat(Service): Add option to mute service
-rw-r--r--src/components/services/content/ServiceWebview.js6
-rw-r--r--src/components/settings/services/EditServiceForm.js12
-rw-r--r--src/components/settings/services/ServiceItem.js22
-rw-r--r--src/containers/settings/EditServiceScreen.js15
-rw-r--r--src/i18n/locales/en-US.json15
-rw-r--r--src/models/Service.js3
-rw-r--r--src/stores/ServicesStore.js2
-rw-r--r--src/styles/settings.scss2
8 files changed, 53 insertions, 24 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js
index cd59e0a8a..d7e0a4f38 100644
--- a/src/components/services/content/ServiceWebview.js
+++ b/src/components/services/content/ServiceWebview.js
@@ -82,21 +82,17 @@ export default class ServiceWebview extends Component {
82 )} 82 )}
83 <Webview 83 <Webview
84 ref={(element) => { this.webview = element; }} 84 ref={(element) => { this.webview = element; }}
85
86 autosize 85 autosize
87 src={service.url} 86 src={service.url}
88 preload="./webview/plugin.js" 87 preload="./webview/plugin.js"
89 partition={`persist:service-${service.id}`} 88 partition={`persist:service-${service.id}`}
90
91 onDidAttach={() => setWebviewReference({ 89 onDidAttach={() => setWebviewReference({
92 serviceId: service.id, 90 serviceId: service.id,
93 webview: this.webview.view, 91 webview: this.webview.view,
94 })} 92 })}
95
96 onUpdateTargetUrl={this.updateTargetUrl} 93 onUpdateTargetUrl={this.updateTargetUrl}
97
98 useragent={service.userAgent} 94 useragent={service.userAgent}
99 95 muted={service.isMuted}
100 disablewebsecurity 96 disablewebsecurity
101 allowpopups 97 allowpopups
102 /> 98 />
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js
index 9b359a78e..753781507 100644
--- a/src/components/settings/services/EditServiceForm.js
+++ b/src/components/settings/services/EditServiceForm.js
@@ -61,7 +61,11 @@ const messages = defineMessages({
61 }, 61 },
62 indirectMessageInfo: { 62 indirectMessageInfo: {
63 id: 'settings.service.form.indirectMessageInfo', 63 id: 'settings.service.form.indirectMessageInfo',
64 defaultMessage: '!!!You will be notified about all new messages in a channel, not just @username, @channel, @here, ...', // eslint-disable-line 64 defaultMessage: '!!!You will be notified about all new messages in a channel, not just @username, @channel, @here, ...',
65 },
66 isMutedInfo: {
67 id: 'settings.service.form.isMutedInfo',
68 defaultMessage: '!!!When disabled, all notification sounds and audio playback are muted',
65 }, 69 },
66}); 70});
67 71
@@ -231,11 +235,15 @@ export default class EditServiceForm extends Component {
231 {recipe.hasIndirectMessages && ( 235 {recipe.hasIndirectMessages && (
232 <div> 236 <div>
233 <Toggle field={form.$('isIndirectMessageBadgeEnabled')} /> 237 <Toggle field={form.$('isIndirectMessageBadgeEnabled')} />
234 <p className="settings__indirect-message-help"> 238 <p className="settings__help">
235 {intl.formatMessage(messages.indirectMessageInfo)} 239 {intl.formatMessage(messages.indirectMessageInfo)}
236 </p> 240 </p>
237 </div> 241 </div>
238 )} 242 )}
243 <Toggle field={form.$('isMuted')} />
244 <p className="settings__help">
245 {intl.formatMessage(messages.isMutedInfo)}
246 </p>
239 <Toggle field={form.$('isEnabled')} /> 247 <Toggle field={form.$('isEnabled')} />
240 </div> 248 </div>
241 {recipe.message && ( 249 {recipe.message && (
diff --git a/src/components/settings/services/ServiceItem.js b/src/components/settings/services/ServiceItem.js
index 20d8581d0..9743315b0 100644
--- a/src/components/settings/services/ServiceItem.js
+++ b/src/components/settings/services/ServiceItem.js
@@ -16,6 +16,10 @@ const messages = defineMessages({
16 id: 'settings.services.tooltip.notificationsDisabled', 16 id: 'settings.services.tooltip.notificationsDisabled',
17 defaultMessage: '!!!Notifications are disabled', 17 defaultMessage: '!!!Notifications are disabled',
18 }, 18 },
19 tooltipIsMuted: {
20 id: 'settings.services.tooltip.isMuted',
21 defaultMessage: '!!!All sounds are muted',
22 },
19}); 23});
20 24
21@observer 25@observer
@@ -66,6 +70,17 @@ export default class ServiceItem extends Component {
66 className="service-table__column-info" 70 className="service-table__column-info"
67 onClick={goToServiceForm} 71 onClick={goToServiceForm}
68 > 72 >
73 {service.isMuted && (
74 <span
75 className="mdi mdi-bell-off"
76 data-tip={intl.formatMessage(messages.tooltipIsMuted)}
77 />
78 )}
79 </td>
80 <td
81 className="service-table__column-info"
82 onClick={goToServiceForm}
83 >
69 {!service.isEnabled && ( 84 {!service.isEnabled && (
70 <span 85 <span
71 className="mdi mdi-power" 86 className="mdi mdi-power"
@@ -85,13 +100,6 @@ export default class ServiceItem extends Component {
85 )} 100 )}
86 <ReactTooltip place="top" type="dark" effect="solid" /> 101 <ReactTooltip place="top" type="dark" effect="solid" />
87 </td> 102 </td>
88 {/* <td className="service-table__column-action">
89 <input
90 type="checkbox"
91 onChange={toggleAction}
92 checked={service.isEnabled}
93 />
94 </td> */}
95 </tr> 103 </tr>
96 ); 104 );
97 } 105 }
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/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 0493b547f..e298728d1 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -106,11 +106,20 @@
106 "settings.service.form.customUrlPremiumInfo": "To add self hosted services, you need a Franz Premium Supporter Account.", 106 "settings.service.form.customUrlPremiumInfo": "To add self hosted services, you need a Franz Premium Supporter Account.",
107 "settings.service.form.customUrlUpgradeAccount": "Upgrade your account", 107 "settings.service.form.customUrlUpgradeAccount": "Upgrade your account",
108 "settings.service.form.indirectMessageInfo": "You will be notified about all new messages in a channel, not just @username, @channel, @here, ...", 108 "settings.service.form.indirectMessageInfo": "You will be notified about all new messages in a channel, not just @username, @channel, @here, ...",
109 "settings.service.form.name": "Name",
110 "settings.service.form.enableService": "Enable service",
111 "settings.service.form.enableNotification": "Enable notifications",
112 "settings.service.form.team": "Team",
113 "settings.service.form.customUrl": "Custom server",
114 "settings.service.form.indirectMessages": "Show message badge for all new messages",
115 "settings.service.form.enableAudio": "Enable audio",
116 "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted",
109 "settings.service.error.headline": "Error", 117 "settings.service.error.headline": "Error",
110 "settings.service.error.goBack": "Back to services", 118 "settings.service.error.goBack": "Back to services",
111 "settings.service.error.message": "Could not load service recipe.", 119 "settings.service.error.message": "Could not load service recipe.",
112 "settings.services.tooltip.isDisabled": "Service is disabled", 120 "settings.services.tooltip.isDisabled": "Service is disabled",
113 "settings.services.tooltip.notificationsDisabled": "Notifications are disabled", 121 "settings.services.tooltip.notificationsDisabled": "Notifications are disabled",
122 "settings.services.tooltip.isMuted": "All sounds are muted",
114 "settings.services.headline": "Your services", 123 "settings.services.headline": "Your services",
115 "settings.services.noServicesAdded": "You haven't added any services yet.", 124 "settings.services.noServicesAdded": "You haven't added any services yet.",
116 "settings.services.discoverServices": "Discover services", 125 "settings.services.discoverServices": "Discover services",
@@ -133,12 +142,6 @@
133 "settings.app.form.language": "Language", 142 "settings.app.form.language": "Language",
134 "settings.app.form.beta": "Include beta versions", 143 "settings.app.form.beta": "Include beta versions",
135 "settings.app.currentVersion": "Current version:", 144 "settings.app.currentVersion": "Current version:",
136 "settings.service.form.name": "Name",
137 "settings.service.form.enableService": "Enable service",
138 "settings.service.form.enableNotification": "Enable notifications",
139 "settings.service.form.team": "Team",
140 "settings.service.form.customUrl": "Custom server",
141 "settings.service.form.indirectMessages": "Show message badge for all new messages",
142 "settings.user.form.firstname": "Firstname", 145 "settings.user.form.firstname": "Firstname",
143 "settings.user.form.lastname": "Lastname", 146 "settings.user.form.lastname": "Lastname",
144 "settings.user.form.email": "Email", 147 "settings.user.form.email": "Email",
diff --git a/src/models/Service.js b/src/models/Service.js
index dc53807f7..eb68493fe 100644
--- a/src/models/Service.js
+++ b/src/models/Service.js
@@ -18,6 +18,7 @@ export default class Service {
18 18
19 @observable order = 99; 19 @observable order = 99;
20 @observable isEnabled = true; 20 @observable isEnabled = true;
21 @observable isMuted = false;
21 @observable team = ''; 22 @observable team = '';
22 @observable customUrl = ''; 23 @observable customUrl = '';
23 @observable isNotificationEnabled = true; 24 @observable isNotificationEnabled = true;
@@ -54,6 +55,8 @@ export default class Service {
54 this.isIndirectMessageBadgeEnabled = data.isIndirectMessageBadgeEnabled !== undefined 55 this.isIndirectMessageBadgeEnabled = data.isIndirectMessageBadgeEnabled !== undefined
55 ? data.isIndirectMessageBadgeEnabled : this.isIndirectMessageBadgeEnabled; 56 ? data.isIndirectMessageBadgeEnabled : this.isIndirectMessageBadgeEnabled;
56 57
58 this.isMuted = data.isMuted !== undefined ? data.isMuted : this.isMuted;
59
57 this.recipe = recipe; 60 this.recipe = recipe;
58 } 61 }
59 62
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 1d895d532..96c503510 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -287,7 +287,7 @@ export default class ServicesStore extends Store {
287 }); 287 });
288 } else if (channel === 'notification') { 288 } else if (channel === 'notification') {
289 const options = args[0].options; 289 const options = args[0].options;
290 if (service.recipe.hasNotificationSound) { 290 if (service.recipe.hasNotificationSound || service.isMuted) {
291 Object.assign(options, { 291 Object.assign(options, {
292 silent: true, 292 silent: true,
293 }); 293 });
diff --git a/src/styles/settings.scss b/src/styles/settings.scss
index 9b19deb4e..48d12a807 100644
--- a/src/styles/settings.scss
+++ b/src/styles/settings.scss
@@ -169,7 +169,7 @@
169 } 169 }
170 } 170 }
171 171
172 .settings__indirect-message-help { 172 .settings__help {
173 margin: -10px 0 20px 55px;; 173 margin: -10px 0 20px 55px;;
174 font-size: 12px; 174 font-size: 12px;
175 color: $theme-gray-light; 175 color: $theme-gray-light;