diff options
author | Iaroslav <yavoloh@mail.ru> | 2021-10-23 19:16:01 +0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-23 19:46:01 +0530 |
commit | 4d02744dfab8a49075b82a5ddbdc02e08c7e8a66 (patch) | |
tree | dc7b08818a8f116d41886924552c92719c4d081a /src/stores | |
parent | chore: upgrade npm modules (diff) | |
download | ferdium-app-4d02744dfab8a49075b82a5ddbdc02e08c7e8a66.tar.gz ferdium-app-4d02744dfab8a49075b82a5ddbdc02e08c7e8a66.tar.zst ferdium-app-4d02744dfab8a49075b82a5ddbdc02e08c7e8a66.zip |
Add active dialog title feature (#2114)
https://github.com/getferdi/ferdi/issues/1280
WhatsApp-like services can set active dialog title to the app title eg. Ferdi - WhatsApp - Contact Name
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 4f7ad7442..e52d661f3 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 | ||
@@ -741,6 +748,16 @@ export default class ServicesStore extends Store { | |||
741 | 748 | ||
742 | break; | 749 | break; |
743 | } | 750 | } |
751 | case 'active-dialog-title': { | ||
752 | debug(`Received active dialog title from '${serviceId}'`, args[0]); | ||
753 | |||
754 | this.actions.service.setDialogTitle({ | ||
755 | serviceId, | ||
756 | dialogTitle: args[0], | ||
757 | }); | ||
758 | |||
759 | break; | ||
760 | } | ||
744 | case 'notification': { | 761 | case 'notification': { |
745 | const { options } = args[0]; | 762 | const { options } = args[0]; |
746 | 763 | ||
@@ -1063,7 +1080,9 @@ export default class ServicesStore extends Store { | |||
1063 | const service = this.active; | 1080 | const service = this.active; |
1064 | if (service) { | 1081 | if (service) { |
1065 | this.actions.service.focusService({ serviceId: service.id }); | 1082 | this.actions.service.focusService({ serviceId: service.id }); |
1066 | document.title = `Ferdi - ${service.name}`; | 1083 | document.title = `Ferdi - ${service.name} ${ |
1084 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | ||
1085 | }`; | ||
1067 | } else { | 1086 | } else { |
1068 | debug('No service is active'); | 1087 | debug('No service is active'); |
1069 | } | 1088 | } |