* Focus the window that owns a given chatId. * Returns true if the window was found and focused.
(chatId: string)
| 189 | * Returns true if the window was found and focused. |
| 190 | */ |
| 191 | focusChatOwner(chatId: string): boolean { |
| 192 | const ownerId = this.chatOwnership.get(chatId) |
| 193 | if (ownerId === undefined) return false |
| 194 | |
| 195 | const window = this.windows.get(ownerId) |
| 196 | if (!window || window.isDestroyed()) { |
| 197 | this.chatOwnership.delete(chatId) |
| 198 | return false |
| 199 | } |
| 200 | |
| 201 | if (window.isMinimized()) window.restore() |
| 202 | window.focus() |
| 203 | return true |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Get the electron window ID that owns a chat, if any. |
no test coverage detected