diff options
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 4f7ad7442..926ee36f0 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -82,6 +82,7 @@ export default class ServicesStore extends Store { | |||
82 | this.actions.service.setUnreadMessageCount.listen( | 82 | this.actions.service.setUnreadMessageCount.listen( |
83 | this._setUnreadMessageCount.bind(this), | 83 | this._setUnreadMessageCount.bind(this), |
84 | ); | 84 | ); |
85 | this.actions.service.setDialogTitle.listen(this._setDialogTitle.bind(this)); | ||
85 | this.actions.service.openWindow.listen(this._openWindow.bind(this)); | 86 | this.actions.service.openWindow.listen(this._openWindow.bind(this)); |
86 | this.actions.service.filter.listen(this._filter.bind(this)); | 87 | this.actions.service.filter.listen(this._filter.bind(this)); |
87 | this.actions.service.resetFilter.listen(this._resetFilter.bind(this)); | 88 | this.actions.service.resetFilter.listen(this._resetFilter.bind(this)); |
@@ -646,6 +647,12 @@ export default class ServicesStore extends Store { | |||
646 | service.unreadIndirectMessageCount = count.indirect; | 647 | service.unreadIndirectMessageCount = count.indirect; |
647 | } | 648 | } |
648 | 649 | ||
650 | @action _setDialogTitle({ serviceId, dialogTitle }) { | ||
651 | const service = this.one(serviceId); | ||
652 | |||
653 | service.dialogTitle = dialogTitle; | ||
654 | } | ||
655 | |||
649 | @action _setWebviewReference({ serviceId, webview }) { | 656 | @action _setWebviewReference({ serviceId, webview }) { |
650 | const service = this.one(serviceId); | 657 | const service = this.one(serviceId); |
651 | 658 | ||
@@ -683,6 +690,9 @@ export default class ServicesStore extends Store { | |||
683 | // 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 |
684 | const service = this.active; | 691 | const service = this.active; |
685 | if (service) { | 692 | if (service) { |
693 | document.title = `Ferdi - ${service.name} ${ | ||
694 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | ||
695 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; | ||
686 | this._focusService({ serviceId: service.id }); | 696 | this._focusService({ serviceId: service.id }); |
687 | if (this.stores.settings.app.splitMode && !focusEvent) { | 697 | if (this.stores.settings.app.splitMode && !focusEvent) { |
688 | setTimeout(() => { | 698 | setTimeout(() => { |
@@ -741,6 +751,16 @@ export default class ServicesStore extends Store { | |||
741 | 751 | ||
742 | break; | 752 | break; |
743 | } | 753 | } |
754 | case 'active-dialog-title': { | ||
755 | debug(`Received active dialog title from '${serviceId}'`, args[0]); | ||
756 | |||
757 | this.actions.service.setDialogTitle({ | ||
758 | serviceId, | ||
759 | dialogTitle: args[0], | ||
760 | }); | ||
761 | |||
762 | break; | ||
763 | } | ||
744 | case 'notification': { | 764 | case 'notification': { |
745 | const { options } = args[0]; | 765 | const { options } = args[0]; |
746 | 766 | ||
@@ -1063,7 +1083,9 @@ export default class ServicesStore extends Store { | |||
1063 | const service = this.active; | 1083 | const service = this.active; |
1064 | if (service) { | 1084 | if (service) { |
1065 | this.actions.service.focusService({ serviceId: service.id }); | 1085 | this.actions.service.focusService({ serviceId: service.id }); |
1066 | document.title = `Ferdi - ${service.name}`; | 1086 | document.title = `Ferdi - ${service.name} ${ |
1087 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | ||
1088 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; | ||
1067 | } else { | 1089 | } else { |
1068 | debug('No service is active'); | 1090 | debug('No service is active'); |
1069 | } | 1091 | } |