mirror of
https://github.com/cupcakearmy/unpixel.git
synced 2024-12-22 08:06:33 +00:00
banner logic
This commit is contained in:
parent
14ac96366e
commit
1b691949a3
@ -1,13 +1,11 @@
|
|||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
import { app, BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
|
import { app, BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import logger from 'electron-log'
|
|
||||||
import ms from 'ms'
|
|
||||||
|
|
||||||
import { DEV } from '.'
|
import { DEV } from '.'
|
||||||
import Settings from './settings'
|
import Settings from './settings'
|
||||||
import TrayUtility from './tray'
|
import TrayUtility from './tray'
|
||||||
|
import { InputDevicesStatus } from './utils'
|
||||||
|
|
||||||
export default class Banner {
|
export default class Banner {
|
||||||
static interval: ReturnType<typeof setInterval>
|
static interval: ReturnType<typeof setInterval>
|
||||||
@ -22,18 +20,21 @@ export default class Banner {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static shouldShow(): boolean {
|
||||||
|
const [paused, interval] = Settings.getStatus()
|
||||||
|
if (paused || interval > 1000) return false
|
||||||
|
if (InputDevicesStatus.areCameraOrMicrophoneActive()) return true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
static check() {
|
static check() {
|
||||||
TrayUtility.build()
|
TrayUtility.build()
|
||||||
const [paused, interval] = Settings.getStatus()
|
if (Banner.shouldShow()) Banner.open()
|
||||||
if (!paused && interval < 1000) {
|
|
||||||
Banner.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static open() {
|
static open() {
|
||||||
if (this.window) return
|
if (this.window) return
|
||||||
|
|
||||||
logger.debug('Showing banner')
|
|
||||||
const options: BrowserWindowConstructorOptions = {
|
const options: BrowserWindowConstructorOptions = {
|
||||||
frame: false,
|
frame: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
Loading…
Reference in New Issue
Block a user