diff options
author | 2019-03-07 16:47:32 +0100 | |
---|---|---|
committer | 2019-03-07 16:47:32 +0100 | |
commit | a73e6bd9814d49eeb1cc7ff350cb5e4a621fd4ad (patch) | |
tree | 904fa0385c9b68d426bddae3b88ab81c07439633 | |
parent | Merge branch 'chore/react-intl-manager' into develop (diff) | |
download | ferdium-app-a73e6bd9814d49eeb1cc7ff350cb5e4a621fd4ad.tar.gz ferdium-app-a73e6bd9814d49eeb1cc7ff350cb5e4a621fd4ad.tar.zst ferdium-app-a73e6bd9814d49eeb1cc7ff350cb5e4a621fd4ad.zip |
fix(Service) shortcuts for activating prev/next service fixes #1298
-rw-r--r-- | src/i18n/locales/defaultMessages.json | 26 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 4 | ||||
-rw-r--r-- | src/i18n/messages/src/lib/Menu.json | 26 | ||||
-rw-r--r-- | src/lib/Menu.js | 52 | ||||
-rw-r--r-- | src/stores/AppStore.js | 13 |
5 files changed, 92 insertions, 29 deletions
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index 065398dc6..d3a97de78 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json | |||
@@ -3875,6 +3875,32 @@ | |||
3875 | "column": 17, | 3875 | "column": 17, |
3876 | "line": 178 | 3876 | "line": 178 |
3877 | } | 3877 | } |
3878 | }, | ||
3879 | { | ||
3880 | "defaultMessage": "!!!Activate next service...", | ||
3881 | "end": { | ||
3882 | "column": 3, | ||
3883 | "line": 185 | ||
3884 | }, | ||
3885 | "file": "src/lib/Menu.js", | ||
3886 | "id": "menu.services.setNextServiceActive", | ||
3887 | "start": { | ||
3888 | "column": 23, | ||
3889 | "line": 182 | ||
3890 | } | ||
3891 | }, | ||
3892 | { | ||
3893 | "defaultMessage": "!!!Activate previous service...", | ||
3894 | "end": { | ||
3895 | "column": 3, | ||
3896 | "line": 189 | ||
3897 | }, | ||
3898 | "file": "src/lib/Menu.js", | ||
3899 | "id": "menu.services.activatePreviousService", | ||
3900 | "start": { | ||
3901 | "column": 27, | ||
3902 | "line": 186 | ||
3903 | } | ||
3878 | } | 3904 | } |
3879 | ], | 3905 | ], |
3880 | "path": "src/lib/Menu.json" | 3906 | "path": "src/lib/Menu.json" |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index af6edd2df..a9ac92a3a 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -70,7 +70,9 @@ | |||
70 | "menu.help.support": "Support", | 70 | "menu.help.support": "Support", |
71 | "menu.help.tos": "Terms of Service", | 71 | "menu.help.tos": "Terms of Service", |
72 | "menu.services": "Services", | 72 | "menu.services": "Services", |
73 | "menu.services.activatePreviousService": "Activate previous service", | ||
73 | "menu.services.addNewService": "Add New Service...", | 74 | "menu.services.addNewService": "Add New Service...", |
75 | "menu.services.setNextServiceActive": "Activate next service", | ||
74 | "menu.view": "View", | 76 | "menu.view": "View", |
75 | "menu.view.enterFullScreen": "Enter Full Screen", | 77 | "menu.view.enterFullScreen": "Enter Full Screen", |
76 | "menu.view.exitFullScreen": "Exit Full Screen", | 78 | "menu.view.exitFullScreen": "Exit Full Screen", |
@@ -280,4 +282,4 @@ | |||
280 | "validation.url": "{field} is not a valid URL", | 282 | "validation.url": "{field} is not a valid URL", |
281 | "welcome.loginButton": "Login to your account", | 283 | "welcome.loginButton": "Login to your account", |
282 | "welcome.signupButton": "Create a free account" | 284 | "welcome.signupButton": "Create a free account" |
283 | } \ No newline at end of file | 285 | } |
diff --git a/src/i18n/messages/src/lib/Menu.json b/src/i18n/messages/src/lib/Menu.json index 6958f0219..a131851aa 100644 --- a/src/i18n/messages/src/lib/Menu.json +++ b/src/i18n/messages/src/lib/Menu.json | |||
@@ -557,5 +557,31 @@ | |||
557 | "line": 181, | 557 | "line": 181, |
558 | "column": 3 | 558 | "column": 3 |
559 | } | 559 | } |
560 | }, | ||
561 | { | ||
562 | "id": "menu.services.setNextServiceActive", | ||
563 | "defaultMessage": "!!!Activate next service...", | ||
564 | "file": "src/lib/Menu.js", | ||
565 | "start": { | ||
566 | "line": 182, | ||
567 | "column": 23 | ||
568 | }, | ||
569 | "end": { | ||
570 | "line": 185, | ||
571 | "column": 3 | ||
572 | } | ||
573 | }, | ||
574 | { | ||
575 | "id": "menu.services.activatePreviousService", | ||
576 | "defaultMessage": "!!!Activate previous service...", | ||
577 | "file": "src/lib/Menu.js", | ||
578 | "start": { | ||
579 | "line": 186, | ||
580 | "column": 27 | ||
581 | }, | ||
582 | "end": { | ||
583 | "line": 189, | ||
584 | "column": 3 | ||
585 | } | ||
560 | } | 586 | } |
561 | ] \ No newline at end of file | 587 | ] \ No newline at end of file |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index dce8ab969..7bdbd9159 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -179,6 +179,14 @@ const menuItems = defineMessages({ | |||
179 | id: 'menu.services.addNewService', | 179 | id: 'menu.services.addNewService', |
180 | defaultMessage: '!!!Add New Service...', | 180 | defaultMessage: '!!!Add New Service...', |
181 | }, | 181 | }, |
182 | activateNextService: { | ||
183 | id: 'menu.services.setNextServiceActive', | ||
184 | defaultMessage: '!!!Activate next service...', | ||
185 | }, | ||
186 | activatePreviousService: { | ||
187 | id: 'menu.services.activatePreviousService', | ||
188 | defaultMessage: '!!!Activate previous service...', | ||
189 | }, | ||
182 | }); | 190 | }); |
183 | 191 | ||
184 | function getActiveWebview() { | 192 | function getActiveWebview() { |
@@ -525,7 +533,7 @@ export default class FranzMenu { | |||
525 | return; | 533 | return; |
526 | } | 534 | } |
527 | 535 | ||
528 | const intl = window.franz.intl; | 536 | const { intl } = window.franz; |
529 | const tpl = isMac ? _templateFactory(intl) : _titleBarTemplateFactory(intl); | 537 | const tpl = isMac ? _templateFactory(intl) : _titleBarTemplateFactory(intl); |
530 | 538 | ||
531 | tpl[1].submenu.push({ | 539 | tpl[1].submenu.push({ |
@@ -683,17 +691,6 @@ export default class FranzMenu { | |||
683 | }, about); | 691 | }, about); |
684 | } | 692 | } |
685 | 693 | ||
686 | serviceTpl.unshift({ | ||
687 | label: intl.formatMessage(menuItems.addNewService), | ||
688 | accelerator: `${cmdKey}+N`, | ||
689 | click: () => { | ||
690 | this.actions.ui.openSettings({ path: 'recipes' }); | ||
691 | }, | ||
692 | enabled: this.stores.user.isLoggedIn, | ||
693 | }, { | ||
694 | type: 'separator', | ||
695 | }); | ||
696 | |||
697 | if (serviceTpl.length > 0) { | 694 | if (serviceTpl.length > 0) { |
698 | tpl[3].submenu = serviceTpl; | 695 | tpl[3].submenu = serviceTpl; |
699 | } | 696 | } |
@@ -704,10 +701,35 @@ export default class FranzMenu { | |||
704 | } | 701 | } |
705 | 702 | ||
706 | @computed get serviceTpl() { | 703 | @computed get serviceTpl() { |
704 | const { intl } = window.franz; | ||
707 | const services = this.stores.services.allDisplayed; | 705 | const services = this.stores.services.allDisplayed; |
706 | const menu = [{ | ||
707 | label: intl.formatMessage(menuItems.addNewService), | ||
708 | accelerator: `${cmdKey}+N`, | ||
709 | click: () => { | ||
710 | this.actions.ui.openSettings({ path: 'recipes' }); | ||
711 | }, | ||
712 | enabled: this.stores.user.isLoggedIn, | ||
713 | }, { | ||
714 | type: 'separator', | ||
715 | }, { | ||
716 | label: intl.formatMessage(menuItems.activateNextService), | ||
717 | accelerator: `${cmdKey}+alt+right`, | ||
718 | click: () => this.actions.service.setActiveNext(), | ||
719 | enabled: this.stores.user.isLoggedIn, | ||
720 | }, { | ||
721 | label: intl.formatMessage(menuItems.activatePreviousService), | ||
722 | accelerator: `${cmdKey}+alt+left`, | ||
723 | click: () => this.actions.service.setActivePrev(), | ||
724 | enabled: this.stores.user.isLoggedIn, | ||
725 | }, { | ||
726 | type: 'separator', | ||
727 | }]; | ||
728 | |||
729 | menu.push(); | ||
708 | 730 | ||
709 | if (this.stores.user.isLoggedIn) { | 731 | if (this.stores.user.isLoggedIn) { |
710 | return services.map((service, i) => ({ | 732 | services.forEach((service, i) => (menu.push({ |
711 | label: this._getServiceName(service), | 733 | label: this._getServiceName(service), |
712 | accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, | 734 | accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, |
713 | type: 'radio', | 735 | type: 'radio', |
@@ -715,10 +737,10 @@ export default class FranzMenu { | |||
715 | click: () => { | 737 | click: () => { |
716 | this.actions.service.setActive({ serviceId: service.id }); | 738 | this.actions.service.setActive({ serviceId: service.id }); |
717 | }, | 739 | }, |
718 | })); | 740 | }))); |
719 | } | 741 | } |
720 | 742 | ||
721 | return []; | 743 | return menu; |
722 | } | 744 | } |
723 | 745 | ||
724 | _getServiceName(service) { | 746 | _getServiceName(service) { |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index d933ca407..1db61a64e 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -157,19 +157,6 @@ export default class AppStore extends Store { | |||
157 | this.stores.router.push(url); | 157 | this.stores.router.push(url); |
158 | }); | 158 | }); |
159 | 159 | ||
160 | // Set active the next service | ||
161 | key( | ||
162 | '⌘+pagedown, ctrl+pagedown, ⌘+alt+right, ctrl+tab', () => { | ||
163 | this.actions.service.setActiveNext(); | ||
164 | }, | ||
165 | ); | ||
166 | |||
167 | // Set active the prev service | ||
168 | key( | ||
169 | '⌘+pageup, ctrl+pageup, ⌘+alt+left, ctrl+shift+tab', () => { | ||
170 | this.actions.service.setActivePrev(); | ||
171 | }, | ||
172 | ); | ||
173 | 160 | ||
174 | // Global Mute | 161 | // Global Mute |
175 | key( | 162 | key( |