aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-05-03 14:19:48 +0530
committerLibravatar GitHub <noreply@github.com>2021-05-03 08:49:48 +0000
commit60aecd409131310339ab0809faeb9f95c7be7cb8 (patch)
tree83f6483073c29b49c2e215c78021414fbca0eb8b
parentdocs: add kris7t as a contributor (#1335) (diff)
downloadferdium-app-60aecd409131310339ab0809faeb9f95c7be7cb8.tar.gz
ferdium-app-60aecd409131310339ab0809faeb9f95c7be7cb8.tar.zst
ferdium-app-60aecd409131310339ab0809faeb9f95c7be7cb8.zip
Delete service confirmation (#1328)
-rw-r--r--src/components/services/tabs/TabItem.js22
-rw-r--r--src/i18n/locales/en-US.json1
-rw-r--r--src/i18n/messages/src/components/services/tabs/TabItem.json13
3 files changed, 33 insertions, 3 deletions
diff --git a/src/components/services/tabs/TabItem.js b/src/components/services/tabs/TabItem.js
index 479f151a6..75611f77c 100644
--- a/src/components/services/tabs/TabItem.js
+++ b/src/components/services/tabs/TabItem.js
@@ -14,7 +14,7 @@ import { ctrlKey, cmdKey } from '../../../environment';
14 14
15const IS_SERVICE_DEBUGGING_ENABLED = (localStorage.getItem('debug') || '').includes('Franz:Service'); 15const IS_SERVICE_DEBUGGING_ENABLED = (localStorage.getItem('debug') || '').includes('Franz:Service');
16 16
17const { Menu } = remote; 17const { Menu, dialog, app } = remote;
18 18
19const messages = defineMessages({ 19const messages = defineMessages({
20 reload: { 20 reload: {
@@ -53,6 +53,10 @@ const messages = defineMessages({
53 id: 'tabs.item.deleteService', 53 id: 'tabs.item.deleteService',
54 defaultMessage: '!!!Delete Service', 54 defaultMessage: '!!!Delete Service',
55 }, 55 },
56 confirmDeleteService: {
57 id: 'tabs.item.confirmDeleteService',
58 defaultMessage: '!!!Do you really want to delete the {serviceName} service?',
59 },
56}); 60});
57 61
58const styles = { 62const styles = {
@@ -147,7 +151,6 @@ const styles = {
147 } = this.props; 151 } = this.props;
148 const { intl } = this.context; 152 const { intl } = this.context;
149 153
150
151 const menuTemplate = [{ 154 const menuTemplate = [{
152 label: service.name || service.recipe.name, 155 label: service.name || service.recipe.name,
153 enabled: false, 156 enabled: false,
@@ -181,7 +184,20 @@ const styles = {
181 type: 'separator', 184 type: 'separator',
182 }, { 185 }, {
183 label: intl.formatMessage(messages.deleteService), 186 label: intl.formatMessage(messages.deleteService),
184 click: () => deleteService(), 187 click: () => {
188 const selection = dialog.showMessageBoxSync(app.mainWindow, {
189 type: 'question',
190 message: intl.formatMessage(messages.deleteService),
191 detail: intl.formatMessage(messages.confirmDeleteService, { serviceName: service.name || service.recipe.name }),
192 buttons: [
193 'Yes',
194 'No',
195 ],
196 });
197 if (selection === 0) {
198 deleteService();
199 }
200 },
185 }]; 201 }];
186 const menu = Menu.buildFromTemplate(menuTemplate); 202 const menu = Menu.buildFromTemplate(menuTemplate);
187 203
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index a2ed91b79..bb15485d1 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -519,6 +519,7 @@
519 "subscription.teaser.intro": "Ferdi 5 comes with a wide range of new features to boost up your everyday communication - batteries included. Check out our new plans and find out which one suits you most!", 519 "subscription.teaser.intro": "Ferdi 5 comes with a wide range of new features to boost up your everyday communication - batteries included. Check out our new plans and find out which one suits you most!",
520 "subscriptionPopup.buttonCancel": "Cancel", 520 "subscriptionPopup.buttonCancel": "Cancel",
521 "subscriptionPopup.buttonDone": "Done", 521 "subscriptionPopup.buttonDone": "Done",
522 "tabs.item.confirmDeleteService": "Do you really want to delete the {serviceName} service?",
522 "tabs.item.deleteService": "Delete service", 523 "tabs.item.deleteService": "Delete service",
523 "tabs.item.disableAudio": "Disable audio", 524 "tabs.item.disableAudio": "Disable audio",
524 "tabs.item.disableNotifications": "Disable notifications", 525 "tabs.item.disableNotifications": "Disable notifications",
diff --git a/src/i18n/messages/src/components/services/tabs/TabItem.json b/src/i18n/messages/src/components/services/tabs/TabItem.json
index 495d35c8b..a1b0d2435 100644
--- a/src/i18n/messages/src/components/services/tabs/TabItem.json
+++ b/src/i18n/messages/src/components/services/tabs/TabItem.json
@@ -115,5 +115,18 @@
115 "line": 55, 115 "line": 55,
116 "column": 3 116 "column": 3
117 } 117 }
118 },
119 {
120 "id": "tabs.item.confirmDeleteService",
121 "defaultMessage": "!!!Do you really want to delete the {serviceName} service?",
122 "file": "src/components/services/tabs/TabItem.js",
123 "start": {
124 "line": 56,
125 "column": 24
126 },
127 "end": {
128 "line": 59,
129 "column": 3
130 }
118 } 131 }
119] \ No newline at end of file 132] \ No newline at end of file