调整跳过显示时机

This commit is contained in:
dinglili 2024-05-30 10:05:38 +08:00 committed by wangpenglong
parent 8d40ce907d
commit e15ef0b7ba
2 changed files with 24 additions and 24 deletions

View File

@ -122,6 +122,8 @@ import { IAuxiliaryWindowsMainService, isAuxiliaryWindow } from 'vs/platform/aux
import { AuxiliaryWindowsMainService } from 'vs/platform/auxiliaryWindow/electron-main/auxiliaryWindowsMainService'; import { AuxiliaryWindowsMainService } from 'vs/platform/auxiliaryWindow/electron-main/auxiliaryWindowsMainService';
import { IDeployMainService } from 'vs/platform/issue/common/deploy'; import { IDeployMainService } from 'vs/platform/issue/common/deploy';
import { DeployMainService } from 'vs/platform/issue/electron-main/deployMainService'; import { DeployMainService } from 'vs/platform/issue/electron-main/deployMainService';
import * as fs from 'fs';
import * as path from 'path';
/** /**
* The main VS Code application. There will only ever be one instance, * The main VS Code application. There will only ever be one instance,
@ -634,7 +636,10 @@ export class CodeApplication extends Disposable {
this.lifecycleMainService.phase = LifecycleMainPhase.Ready; this.lifecycleMainService.phase = LifecycleMainPhase.Ready;
//install window wait to do by dll //install window wait to do by dll
await appInstantiationService.invokeFunction(accessor => this.openDeploylWindow(accessor)); if (await this.isFirstLoad()) {
await appInstantiationService.invokeFunction(accessor => this.openDeploylWindow(accessor));
}
// Open Windows // Open Windows
await appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor, initialProtocolUrls)); await appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor, initialProtocolUrls));
@ -1474,4 +1479,20 @@ export class CodeApplication extends Disposable {
this.logService.error(error); this.logService.error(error);
} }
} }
private async isFirstLoad(): Promise<boolean> {
let res = false;
const userDataPath = path.join(this.environmentMainService.userHome.fsPath, '.config', 'Kylin-IDE', 'installconfig');
const flagFilePath = path.join(userDataPath, 'first-run.flag');
if (!fs.existsSync(userDataPath)) {
fs.mkdirSync(userDataPath, { recursive: true }); // 递归创建目录
}
if (fs.existsSync(flagFilePath)) {
res = false; // 标记文件存在,不是首次启动
} else {
fs.writeFileSync(flagFilePath, ''); // 创建标记文件
res = true; // 标记文件不存在,是首次启动
}
return res;
}
} }

View File

@ -530,15 +530,11 @@ export class DeployMainService implements IDeployMainService {
} }
//#region Used by renderer //#region Used by renderer
async openDeployWindow(flag?: boolean): Promise<void> { async openDeployWindow(flag: boolean = true): Promise<void> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
let isFirstLoad;
if (!this.DeployWindow) { if (!this.DeployWindow) {
const data = {} as DeployData; const data = {} as DeployData;
if (flag === undefined) {
isFirstLoad = await this.isFirstLoad();
}
const DeployDisposables = new DisposableStore(); const DeployDisposables = new DisposableStore();
const deployWindowConfigUrl = DeployDisposables.add(this.protocolMainService.createIPCObjectUrl<DeployWindowConfiguration>()); const deployWindowConfigUrl = DeployDisposables.add(this.protocolMainService.createIPCObjectUrl<DeployWindowConfiguration>());
console.log("---------------------deployWindowConfigUrl", deployWindowConfigUrl.resource.toString()); console.log("---------------------deployWindowConfigUrl", deployWindowConfigUrl.resource.toString());
@ -560,7 +556,7 @@ export class DeployMainService implements IDeployMainService {
// // Menu.setApplicationMenu(null); // // Menu.setApplicationMenu(null);
let initData = { let initData = {
isFirstLoad: flag === undefined ? isFirstLoad : flag, isFirstLoad: flag,
} }
this.DeployWindow.webContents.on('did-finish-load', () => { this.DeployWindow.webContents.on('did-finish-load', () => {
if (this.DeployWindow) { if (this.DeployWindow) {
@ -949,23 +945,6 @@ export class DeployMainService implements IDeployMainService {
} }
return url; return url;
} }
//ide是否首次启动如果是首次启动返回true,否则返回false
private async isFirstLoad(): Promise<boolean> {
let res = false;
const userDataPath = path.join(this.environmentMainService.userHome.fsPath, '.config', 'Kylin-Code', 'installconfig');
const flagFilePath = path.join(userDataPath, 'first-run.flag');
if (!fs.existsSync(userDataPath)) {
fs.mkdirSync(userDataPath, { recursive: true }); // 递归创建目录
}
if (fs.existsSync(flagFilePath)) {
res = false; // 标记文件存在,不是首次启动
} else {
fs.writeFileSync(flagFilePath, ''); // 创建标记文件
res = true; // 标记文件不存在,是首次启动
}
return res;
}
private getPublicKeyPem(publicKeyPath: string) { private getPublicKeyPem(publicKeyPath: string) {
const data = fs.readFileSync(publicKeyPath, 'utf-8'); const data = fs.readFileSync(publicKeyPath, 'utf-8');
return data; return data;