diff options
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/AppStore.js | 4 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 56 |
2 files changed, 32 insertions, 28 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index d652276ea..5881e37a4 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -19,7 +19,7 @@ import Request from './lib/Request'; | |||
19 | import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config'; | 19 | import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config'; |
20 | import { isMac, electronVersion, osRelease } from '../environment'; | 20 | import { isMac, electronVersion, osRelease } from '../environment'; |
21 | import { ferdiVersion, userDataPath, ferdiLocale } from '../environment-remote'; | 21 | import { ferdiVersion, userDataPath, ferdiLocale } from '../environment-remote'; |
22 | import locales from '../i18n/translations'; | 22 | import { generatedTranslations } from '../i18n/translations'; |
23 | import { getLocale } from '../helpers/i18n-helpers'; | 23 | import { getLocale } from '../helpers/i18n-helpers'; |
24 | 24 | ||
25 | import { | 25 | import { |
@@ -42,6 +42,8 @@ const autoLauncher = new AutoLaunch({ | |||
42 | const CATALINA_NOTIFICATION_HACK_KEY = | 42 | const CATALINA_NOTIFICATION_HACK_KEY = |
43 | '_temp_askedForCatalinaNotificationPermissions'; | 43 | '_temp_askedForCatalinaNotificationPermissions'; |
44 | 44 | ||
45 | const locales = generatedTranslations(); | ||
46 | |||
45 | export default class AppStore extends Store { | 47 | export default class AppStore extends Store { |
46 | updateStatusTypes = { | 48 | updateStatusTypes = { |
47 | CHECKING: 'CHECKING', | 49 | CHECKING: 'CHECKING', |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 16deb91c5..3d418c4c5 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -655,20 +655,20 @@ export default class ServicesStore extends Store { | |||
655 | 655 | ||
656 | @action _setWebviewReference({ serviceId, webview }) { | 656 | @action _setWebviewReference({ serviceId, webview }) { |
657 | const service = this.one(serviceId); | 657 | const service = this.one(serviceId); |
658 | 658 | if (service) { | |
659 | service.webview = webview; | 659 | service.webview = webview; |
660 | 660 | ||
661 | if (!service.isAttached) { | 661 | if (!service.isAttached) { |
662 | debug('Webview is not attached, initializing'); | 662 | debug('Webview is not attached, initializing'); |
663 | service.initializeWebViewEvents({ | 663 | service.initializeWebViewEvents({ |
664 | handleIPCMessage: this.actions.service.handleIPCMessage, | 664 | handleIPCMessage: this.actions.service.handleIPCMessage, |
665 | openWindow: this.actions.service.openWindow, | 665 | openWindow: this.actions.service.openWindow, |
666 | stores: this.stores, | 666 | stores: this.stores, |
667 | }); | 667 | }); |
668 | service.initializeWebViewListener(); | 668 | service.initializeWebViewListener(); |
669 | } | ||
670 | service.isAttached = true; | ||
669 | } | 671 | } |
670 | |||
671 | service.isAttached = true; | ||
672 | } | 672 | } |
673 | 673 | ||
674 | @action _detachService({ service }) { | 674 | @action _detachService({ service }) { |
@@ -690,20 +690,22 @@ export default class ServicesStore extends Store { | |||
690 | // TODO: add checks to not focus service when router path is /settings or /auth | 690 | // TODO: add checks to not focus service when router path is /settings or /auth |
691 | const service = this.active; | 691 | const service = this.active; |
692 | if (service) { | 692 | if (service) { |
693 | document.title = `Ferdi - ${service.name} ${ | 693 | if (service._webview) { |
694 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | 694 | document.title = `Ferdi - ${service.name} ${ |
695 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; | 695 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' |
696 | this._focusService({ serviceId: service.id }); | 696 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; |
697 | if (this.stores.settings.app.splitMode && !focusEvent) { | 697 | this._focusService({ serviceId: service.id }); |
698 | setTimeout(() => { | 698 | if (this.stores.settings.app.splitMode && !focusEvent) { |
699 | document | 699 | setTimeout(() => { |
700 | .querySelector('.services__webview-wrapper.is-active') | 700 | document |
701 | .scrollIntoView({ | 701 | .querySelector('.services__webview-wrapper.is-active') |
702 | behavior: 'smooth', | 702 | .scrollIntoView({ |
703 | block: 'end', | 703 | behavior: 'smooth', |
704 | inline: 'nearest', | 704 | block: 'end', |
705 | }); | 705 | inline: 'nearest', |
706 | }, 10); | 706 | }); |
707 | }, 10); | ||
708 | } | ||
707 | } | 709 | } |
708 | } else { | 710 | } else { |
709 | debug('No service is active'); | 711 | debug('No service is active'); |