From e727529b89fa5fea97797fe6cb65ece3f580db8a Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 24 Mar 2026 17:19:22 +0200 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20CMD=20+,=20=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=20=D0=B7=D1=83=D0=BC=D0=B0,=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=20=D0=B2=D0=B5=D1=80=D1=85=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20toolbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usePrepareAttachment.ts | 2 +- app/version.ts | 10 +- lib/main/app.ts | 6 +- lib/main/main.ts | 152 ++++++++++-------- package.json | 2 +- 5 files changed, 97 insertions(+), 75 deletions(-) diff --git a/app/providers/AttachmentProvider/usePrepareAttachment.ts b/app/providers/AttachmentProvider/usePrepareAttachment.ts index 213e70d..71b6623 100644 --- a/app/providers/AttachmentProvider/usePrepareAttachment.ts +++ b/app/providers/AttachmentProvider/usePrepareAttachment.ts @@ -103,7 +103,7 @@ export function usePrepareAttachment() { const attachment : Attachment = attachments[i]; if(attachment.type == AttachmentType.CALL){ /** - * Звонок загружать не надо + * Звонк загружать не надо, по этому просто отправляем его как есть, там нет blob */ prepared.push(attachment); continue; diff --git a/app/version.ts b/app/version.ts index e905566..112c167 100644 --- a/app/version.ts +++ b/app/version.ts @@ -1,8 +1,8 @@ -export const APP_VERSION = "1.1.3"; -export const CORE_MIN_REQUIRED_VERSION = "1.5.3"; +export const APP_VERSION = "1.1.4"; +export const CORE_MIN_REQUIRED_VERSION = "1.5.4"; export const RELEASE_NOTICE = ` -**Обновление v1.1.3** :emoji_1f631: -- Улучшено отображение вложения звонка -- Теперь unicode emoji отображаются корректно +**Обновление v1.1.4** :emoji_1f631: +- Улучшено отображение звонка +- Убрана возможность зума в окне приложения `; \ No newline at end of file diff --git a/lib/main/app.ts b/lib/main/app.ts index 38461f7..fe8b526 100644 --- a/lib/main/app.ts +++ b/lib/main/app.ts @@ -33,7 +33,7 @@ export function createAppWindow(preloaderWindow?: BrowserWindow): void { minWidth: 385, minHeight: 555, show: false, - title: 'Rosetta Messager', + title: 'Rosetta Messager', icon: join(__dirname, '../../resources/R.png'), frame: false, autoHideMenuBar: true, @@ -92,7 +92,7 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) { ipcMain.removeHandler('window-priority-normal'); ipcMain.handle('window-top', () => { - if (mainWindow.isMinimized()){ + if (mainWindow.isMinimized()) { mainWindow.restore(); } mainWindow.setAlwaysOnTop(true, "screen-saver"); // самый высокий уровень @@ -112,7 +112,7 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) { ipcMain.handle('window-priority-normal', () => { mainWindow.setAlwaysOnTop(false); mainWindow.setVisibleOnAllWorkspaces(false); - if(process.platform === "darwin" && bounceId !== null){ + if (process.platform === "darwin" && bounceId !== null) { /** * Только в macos! Отмена подпрыгивания иконки в Dock */ diff --git a/lib/main/main.ts b/lib/main/main.ts index 90c71db..773265d 100644 --- a/lib/main/main.ts +++ b/lib/main/main.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, Menu, nativeImage } from 'electron' +import { app, BrowserWindow, Menu, Tray, nativeImage } from 'electron' import { electronApp, optimizer } from '@electron-toolkit/utils' import { createAppWindow, startApplication } from './app' import './ipcs/ipcDatabase' @@ -9,96 +9,118 @@ import './ipcs/ipcNotification' import './ipcs/ipcDevice' import './ipcs/ipcCore' import './ipcs/ipcRuntime' -import { Tray } from 'electron/main' import { join } from 'path' import { Logger } from './logger' -let lockInstance = app.requestSingleInstanceLock(); -let tray : Tray | null = null; -const size = process.platform === 'darwin' ? 18 : 22; -const logger = Logger('main'); +const lockInstance = app.requestSingleInstanceLock() +let tray: Tray | null = null +const size = process.platform === 'darwin' ? 18 : 22 +const logger = Logger('main') +const icon = nativeImage + .createFromPath(join(__dirname, '../../resources/R.png')) + .resize({ width: size, height: size }) -const icon = nativeImage.createFromPath( - join(__dirname, '../../resources/R.png') -).resize({ width: size, height: size }); - -if(!lockInstance){ - app.quit(); - process.exit(0); +if (!lockInstance) { + app.quit() + process.exit(0) } process.on('unhandledRejection', (reason) => { - logger.log(`main thread error, reason: ${reason}`); -}); + logger.log(`main thread error, reason: ${reason}`) +}) -app.disableHardwareAcceleration(); +app.disableHardwareAcceleration() app.on('second-instance', () => { - // Someone tried to run a second instance, we should focus our window. - const allWindows = BrowserWindow.getAllWindows(); + const allWindows = BrowserWindow.getAllWindows() if (allWindows.length) { - const mainWindow = allWindows[0]; - if (mainWindow.isMinimized()) mainWindow.restore(); - if (mainWindow.isVisible() === false) mainWindow.show(); - mainWindow.focus(); + const mainWindow = allWindows[0] + if (mainWindow.isMinimized()) mainWindow.restore() + if (!mainWindow.isVisible()) mainWindow.show() + mainWindow.focus() } -}); +}) export const restoreApplicationAfterClickOnTrayOrDock = () => { - const allWindows = BrowserWindow.getAllWindows(); - if (allWindows.length > 0) { - const mainWindow = allWindows[0]; - if (mainWindow.isMinimized()){ - mainWindow.restore(); - return; - } - if(mainWindow.isVisible() === false){ - mainWindow.show(); - } - mainWindow.focus(); - } else { - createAppWindow(); - } + const allWindows = BrowserWindow.getAllWindows() + if (allWindows.length > 0) { + const mainWindow = allWindows[0] + if (mainWindow.isMinimized()) { + mainWindow.restore() + return + } + if (!mainWindow.isVisible()) { + mainWindow.show() + } + mainWindow.focus() + } else { + createAppWindow() + } } -//Menu.setApplicationMenu(null); -// This method will be called when Electron has finished -// initialization and is ready to create browser windows. -// Some APIs can only be used after this event occurs. app.whenReady().then(async () => { - electronApp.setAppUserModelId('Rosetta'); - tray = new Tray(icon); + electronApp.setAppUserModelId('Rosetta') + + // Убираем File/View и оставляем только app + минимальный Edit (roles) + if (process.platform === 'darwin') { + const minimalMenu = Menu.buildFromTemplate([ + { + label: app.name, + submenu: [ + { role: 'about' }, + { type: 'separator' }, + { role: 'hide' }, + { role: 'hideOthers' }, + { role: 'unhide' }, + { type: 'separator' }, + { role: 'quit' } + ] + }, + { + label: 'Edit', + submenu: [ + { role: 'undo' }, + { role: 'redo' }, + { type: 'separator' }, + { role: 'cut' }, + { role: 'copy' }, + { role: 'paste' }, + { role: 'pasteAndMatchStyle' }, + { role: 'delete' }, + { role: 'selectAll' } + ] + } + ]) + Menu.setApplicationMenu(minimalMenu) + } else { + Menu.setApplicationMenu(null) + } + + tray = new Tray(icon) const contextMenu = Menu.buildFromTemplate([ { label: 'Open App', click: () => restoreApplicationAfterClickOnTrayOrDock() }, { label: 'Quit', click: () => app.quit() } - ]); - tray.setContextMenu(contextMenu); - tray.setToolTip('Rosetta'); + ]) + tray.setContextMenu(contextMenu) + tray.setToolTip('Rosetta') tray.on('click', () => { - restoreApplicationAfterClickOnTrayOrDock(); - }); - startApplication(); + restoreApplicationAfterClickOnTrayOrDock() + }) + + startApplication() - // Default open or close DevTools by F12 in development - // and ignore CommandOrControl + R in production. - // see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils app.on('browser-window-created', (_, window) => { optimizer.watchWindowShortcuts(window) }) - - app.on('activate', function () { - restoreApplicationAfterClickOnTrayOrDock(); - }); + + app.on('activate', () => { + restoreApplicationAfterClickOnTrayOrDock() + }) }) -// Quit when all windows are closed, except on macOS. There, it's common -// for applications and their menu bar to stay active until the user quits -// explicitly with Cmd + Q. app.on('window-all-closed', () => { - if (process.platform == 'darwin') { - app.hide(); - } -}) -// In this file, you can include the rest of your app's specific main process -// code. You can also put them in separate files and import them here. + if (process.platform === 'darwin') { + app.hide() + } +}) \ No newline at end of file diff --git a/package.json b/package.json index 1b152fb..bd8e2eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Rosetta", - "version": "1.5.3", + "version": "1.5.4", "description": "Rosetta Messenger", "main": "./out/main/main.js", "license": "MIT",