fix - dock icon is hidden for any flow

This commit is contained in:
geekgeekrun
2024-02-23 08:40:12 +08:00
parent c4453ba605
commit 588e75f92d
3 changed files with 7 additions and 5 deletions

View File

@@ -2,13 +2,12 @@ import { app } from 'electron'
import checkAndDownloadPuppeteer from './check-and-download-puppeteer' import checkAndDownloadPuppeteer from './check-and-download-puppeteer'
import * as net from 'net' import * as net from 'net'
app.dock.hide()
export enum DOWNLOAD_ERROR_EXIT_CODE { export enum DOWNLOAD_ERROR_EXIT_CODE {
NO_ERROR = 0, NO_ERROR = 0,
DOWNLOAD_ERROR = 1 DOWNLOAD_ERROR = 1
} }
export const checkAndDownloadDependenciesForInit = async () => { export const checkAndDownloadDependenciesForInit = async () => {
app.dock.hide()
let pipe: null | net.Socket = null let pipe: null | net.Socket = null
try { try {
pipe = new net.Socket({ fd: 3 }) pipe = new net.Socket({ fd: 3 })

View File

@@ -7,8 +7,6 @@ import {
checkPuppeteerExecutable, checkPuppeteerExecutable,
} from './CHECK_AND_DOWNLOAD_DEPENDENCIES/check-and-download-puppeteer' } from './CHECK_AND_DOWNLOAD_DEPENDENCIES/check-and-download-puppeteer'
app.dock.hide()
const { groupRobotAccessToken: dingTalkAccessToken } = readConfigFile('dingtalk.json') const { groupRobotAccessToken: dingTalkAccessToken } = readConfigFile('dingtalk.json')
const initPlugins = (hooks) => { const initPlugins = (hooks) => {
@@ -16,6 +14,7 @@ const initPlugins = (hooks) => {
} }
export const runAutoChat = async () => { export const runAutoChat = async () => {
app.dock.hide()
let pipe: null | net.Socket = null let pipe: null | net.Socket = null
try { try {
pipe = new net.Socket({ fd: 3 }) pipe = new net.Socket({ fd: 3 })

View File

@@ -15,7 +15,7 @@ import {
} from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/check-and-download-puppeteer' } from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/check-and-download-puppeteer'
import * as JSONStream from 'JSONStream' import * as JSONStream from 'JSONStream'
import { DOWNLOAD_ERROR_EXIT_CODE } from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES' import { DOWNLOAD_ERROR_EXIT_CODE } from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES'
let mainWindow: BrowserWindow let mainWindow: BrowserWindow = null
export function createMainWindow(): void { export function createMainWindow(): void {
// Create the browser window. // Create the browser window.
@@ -196,4 +196,8 @@ export function createMainWindow(): void {
activate: true activate: true
}) })
}) })
mainWindow!.once('closed', () => {
mainWindow = null
})
} }