From aaf701425b354c1e1b82b9db9c5cb0577fbb3023 Mon Sep 17 00:00:00 2001 From: Aero Mail Dev Date: Thu, 16 Apr 2026 05:53:21 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20(=D0=BE=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=20+=20=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=D0=B0)=20=D0=B8=20=D0=B3=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B5=D1=80=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=BE=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Восстановлен Electron Notification в setupNewMailListener: title = имя/адрес отправителя, body = тема письма; клик фокусирует окно и навигирует к письму через notification:click IPC - Восстановлен обработчик notification:click в NotificationContainer.vue - Таймер опроса новых писем перенесён из MessageList.vue в App.vue: теперь работает непрерывно при любом активном представлении (Настройки, Календарь) — раньше останавливался при смене вкладки - refresh() в MessageList.vue больше не вызывает messages:poll — это теперь задача глобального таймера в App.vue Co-Authored-By: Claude Sonnet 4.6 --- src/main/services/account-manager.ts | 28 +++++++++++++++++- src/renderer/src/App.vue | 29 ++++++++++++++++++- .../src/components/messages/MessageList.vue | 6 ---- .../notifications/NotificationContainer.vue | 6 ++++ 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/main/services/account-manager.ts b/src/main/services/account-manager.ts index 0878702..c7509a1 100644 --- a/src/main/services/account-manager.ts +++ b/src/main/services/account-manager.ts @@ -1,4 +1,5 @@ -import { BrowserWindow } from 'electron' +import { BrowserWindow, Notification, nativeImage, app } from 'electron' +import { join } from 'node:path' import type { AccountConfig, ImapCredentials } from '@shared/types/account' import { AccountType } from '@shared/types/account' import type { IEmailProvider, FolderListResult, MessageListResult } from '@shared/types/provider' @@ -391,6 +392,31 @@ export class AccountManager { if (this.mainWindow && !this.mainWindow.isDestroyed()) { this.mainWindow.webContents.send('mail:new', { accountId, folderId, envelope }) } + + if (Notification.isSupported()) { + const from = envelope.from.name || envelope.from.email || 'Новое письмо' + const subject = envelope.subject || '(без темы)' + + const iconPath = app.isPackaged + ? join(process.resourcesPath, 'icon.png') + : join(app.getAppPath(), 'resources/icon.png') + const icon = nativeImage.createFromPath(iconPath) + + const n = new Notification({ + title: from, + body: subject, + icon: icon.isEmpty() ? undefined : icon, + silent: false, + }) + n.on('click', () => { + if (this.mainWindow && !this.mainWindow.isDestroyed()) { + this.mainWindow.show() + this.mainWindow.focus() + this.mainWindow.webContents.send('notification:click', { accountId, folderId, messageId: envelope.id }) + } + }) + n.show() + } }) } } diff --git a/src/renderer/src/App.vue b/src/renderer/src/App.vue index de269c6..a251bee 100644 --- a/src/renderer/src/App.vue +++ b/src/renderer/src/App.vue @@ -1,12 +1,39 @@