diff --git a/app/components/ActiveCall/ActiveCall.tsx b/app/components/ActiveCall/ActiveCall.tsx index ed7f027..b3cbdb3 100644 --- a/app/components/ActiveCall/ActiveCall.tsx +++ b/app/components/ActiveCall/ActiveCall.tsx @@ -16,7 +16,10 @@ export function ActiveCall() { } const getConnectingClass = () => { - if(callState === CallState.CONNECTING){ + if(callState === CallState.CONNECTING + || callState === CallState.INCOMING + || callState === CallState.KEY_EXCHANGE + || callState === CallState.WEB_RTC_EXCHANGE){ return classes.connecting; } if(callState === CallState.ACTIVE){ diff --git a/app/components/Call/Call.tsx b/app/components/Call/Call.tsx index 0b8b8b1..76a8908 100644 --- a/app/components/Call/Call.tsx +++ b/app/components/Call/Call.tsx @@ -40,13 +40,13 @@ export function Call(props: CallProps) { setShowCallView(false)} justify={'center'} align={'center'}> - - Back + + Back - + - + diff --git a/app/hooks/useWindow.ts b/app/hooks/useWindow.ts index ea5d28f..cd3ff31 100644 --- a/app/hooks/useWindow.ts +++ b/app/hooks/useWindow.ts @@ -20,10 +20,19 @@ const useWindow = () => { window.api.send('window-theme', theme); } + const setWindowPriority = (isTop: boolean) => { + if(isTop){ + window.api.invoke('window-top'); + } else { + window.api.invoke('window-priority-normal'); + } + } + return { setSize, setResizeble, - setTheme + setTheme, + setWindowPriority } } diff --git a/lib/main/app.ts b/lib/main/app.ts index 04ea6eb..38461f7 100644 --- a/lib/main/app.ts +++ b/lib/main/app.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, shell, ipcMain, nativeTheme, screen, powerMonitor } from 'electron' +import { BrowserWindow, shell, ipcMain, nativeTheme, screen, powerMonitor, app } from 'electron' import { join } from 'path' import fs from 'fs' import { WORKING_DIR } from './constants'; @@ -45,7 +45,8 @@ export function createAppWindow(preloaderWindow?: BrowserWindow): void { nodeIntegrationInSubFrames: true, nodeIntegrationInWorker: true, webSecurity: false, - allowRunningInsecureContent: true + allowRunningInsecureContent: true, + autoplayPolicy: 'no-user-gesture-required' } }); @@ -73,6 +74,7 @@ export function createAppWindow(preloaderWindow?: BrowserWindow): void { } export function foundationIpcRegistration(mainWindow: BrowserWindow) { + let bounceId: number | null = null; ipcMain.removeAllListeners('window-resize'); ipcMain.removeAllListeners('window-resizeble'); ipcMain.removeAllListeners('window-theme'); @@ -86,6 +88,38 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) { ipcMain.removeHandler('window-minimize'); ipcMain.removeHandler('showItemInFolder'); ipcMain.removeHandler('openExternal'); + ipcMain.removeHandler('window-top'); + ipcMain.removeHandler('window-priority-normal'); + + ipcMain.handle('window-top', () => { + if (mainWindow.isMinimized()){ + mainWindow.restore(); + } + mainWindow.setAlwaysOnTop(true, "screen-saver"); // самый высокий уровень + mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }); + + mainWindow.show(); + mainWindow.focus(); + + if (process.platform === "darwin") { + /** + * Только в macos! Подпрыгивание иконки в Dock + */ + bounceId = app.dock!.bounce("critical"); + } + }) + + ipcMain.handle('window-priority-normal', () => { + mainWindow.setAlwaysOnTop(false); + mainWindow.setVisibleOnAllWorkspaces(false); + if(process.platform === "darwin" && bounceId !== null){ + /** + * Только в macos! Отмена подпрыгивания иконки в Dock + */ + app.dock!.cancelBounce(bounceId); + bounceId = null; + } + }) ipcMain.handle('open-dev-tools', () => { if (mainWindow.webContents.isDevToolsOpened()) { diff --git a/package.json b/package.json index 16e87de..985f4ec 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,14 @@ { "name": "Rosetta", - "version": "1.5.0", + "version": "1.5.2", "description": "Rosetta Messenger", "main": "./out/main/main.js", "license": "MIT", "build": { "electronUpdaterCompatibility": false, + "extraResources": [ + { "from": "resources/", "to": "resources/" } + ], "files": [ "node_modules/sqlite3/**/*", "out/main/**/*",