Compare commits
	
		
			4 Commits
		
	
	
		
			39a514b2cc
			...
			0a5bcd76f0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0a5bcd76f0 | |||
| 393e7e7fe2 | |||
| d53acf0146 | |||
| fea2a9af16 | 
							
								
								
									
										75
									
								
								assets/LoadingPage.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								assets/LoadingPage.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -20,6 +20,7 @@ | |||||||
|     "build-run-web": "npm run build-web & npm run build-service & npm run run-service", |     "build-run-web": "npm run build-web & npm run build-service & npm run run-service", | ||||||
|     "release-run-web": "npm run release-web & npm run release-service & npm run run-service", |     "release-run-web": "npm run release-web & npm run release-service & npm run run-service", | ||||||
|     "copy-fluent-icon": "fse mkdirp ./build/font-icon/ & fse emptyDir ./build/font-icon/ & fse copy ./node_modules/@fluentui/font-icons-mdl2/fonts/ ./build/font-icon/", |     "copy-fluent-icon": "fse mkdirp ./build/font-icon/ & fse emptyDir ./build/font-icon/ & fse copy ./node_modules/@fluentui/font-icons-mdl2/fonts/ ./build/font-icon/", | ||||||
|  |     "copy-loading-page": "fse mkdirp ./build & fse copy ./assets/LoadingPage.html ./build/LoadingPage.html", | ||||||
|     "build-run-desktop-web": "npm run build-desktop-web & npm run copy-fluent-icon & npm run build-service & npm run run-service", |     "build-run-desktop-web": "npm run build-desktop-web & npm run copy-fluent-icon & npm run build-service & npm run run-service", | ||||||
|     "release-run-desktop-web": "npm run release-desktop-web & npm run copy-fluent-icon & npm run release-service & npm run run-service", |     "release-run-desktop-web": "npm run release-desktop-web & npm run copy-fluent-icon & npm run release-service & npm run run-service", | ||||||
|     "skip-electron-ci": "set ELECTRON_SKIP_BINARY_DOWNLOAD=1& npm ci", |     "skip-electron-ci": "set ELECTRON_SKIP_BINARY_DOWNLOAD=1& npm ci", | ||||||
| @ -28,8 +29,8 @@ | |||||||
|     "electron-cache": "set ELECTRON_SKIP_BINARY_DOWNLOAD=& set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/& set ELECTRON_CUSTOM_DIR={{ version }}& node ./node_modules/electron/install.js", |     "electron-cache": "set ELECTRON_SKIP_BINARY_DOWNLOAD=& set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/& set ELECTRON_CUSTOM_DIR={{ version }}& node ./node_modules/electron/install.js", | ||||||
|     "electron": "set LIVING_TOGETHER_BASE_PATH=./build& set LIVING_TOGETHER_WEB_PATH=/& npx electron ./build/Electron.js", |     "electron": "set LIVING_TOGETHER_BASE_PATH=./build& set LIVING_TOGETHER_WEB_PATH=/& npx electron ./build/Electron.js", | ||||||
|     "hmr-electron": "npm run build-electron & set LIVING_TOGETHER_SERVICE=http://127.0.0.1:12000& npm run electron", |     "hmr-electron": "npm run build-electron & set LIVING_TOGETHER_SERVICE=http://127.0.0.1:12000& npm run electron", | ||||||
|     "build-run-electron": "npm run build-desktop-web & npm run copy-fluent-icon & npm run build-electron & npm run electron", |     "build-run-electron": "npm run build-desktop-web & npm run copy-fluent-icon & npm run copy-loading-page & npm run build-electron & npm run electron", | ||||||
|     "release-run-electron": "npm run release-desktop-web & npm run copy-fluent-icon & npm run release-electron & npm run electron", |     "release-run-electron": "npm run release-desktop-web & npm run copy-fluent-icon & npm run copy-loading-page & npm run release-electron & npm run electron", | ||||||
|     "copy-package-json": "fse mkdirp ./bundle/ & node ./config/electron.forge.config.js --out ./bundle", |     "copy-package-json": "fse mkdirp ./bundle/ & node ./config/electron.forge.config.js --out ./bundle", | ||||||
|     "copy-build-result": "fse mkdirp ./bundle/ & fse mkdirp ./build/ & fse copy ./build/ ./bundle/", |     "copy-build-result": "fse mkdirp ./bundle/ & fse mkdirp ./build/ & fse copy ./build/ ./bundle/", | ||||||
|     "copy-electron-icon": "fse mkdirp ./bundle/ & fse copy ./assets/living-together.ico ./bundle/living-together.ico & fse copy ./assets/living-together.icns ./bundle/living-together.icns", |     "copy-electron-icon": "fse mkdirp ./bundle/ & fse copy ./assets/living-together.ico ./bundle/living-together.ico & fse copy ./assets/living-together.icns ./bundle/living-together.icns", | ||||||
|  | |||||||
| @ -29,12 +29,38 @@ class ElectronApp { | |||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	public loadingPage?: BrowserWindow; | ||||||
| 	public simulatorWindow?: BrowserWindow; | 	public simulatorWindow?: BrowserWindow; | ||||||
| 
 | 
 | ||||||
|  | 	public async showLoadingPage() { | ||||||
|  | 		return new Promise((r) => { | ||||||
|  | 
 | ||||||
|  | 			this.loadingPage = new BrowserWindow({ | ||||||
|  | 				width: 603, | ||||||
|  | 				height: 432, | ||||||
|  | 				fullscreenable: false, | ||||||
|  | 				skipTaskbar: true, | ||||||
|  | 				resizable: false, | ||||||
|  | 				titleBarStyle: 'hidden', | ||||||
|  | 				frame: false, | ||||||
|  | 				show: false | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			this.loadingPage.loadFile(ENV.LIVING_TOGETHER_LOADING_PAGE ?? "./LoadingPage.html"); | ||||||
|  | 
 | ||||||
|  | 			this.loadingPage.on("ready-to-show", () => { | ||||||
|  | 				this.loadingPage?.show(); | ||||||
|  | 				r(undefined); | ||||||
|  | 			}); | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	public async runMainThread() { | 	public async runMainThread() { | ||||||
| 
 | 
 | ||||||
| 		await app.whenReady(); | 		await app.whenReady(); | ||||||
| 
 | 
 | ||||||
|  | 		await this.showLoadingPage(); | ||||||
|  | 
 | ||||||
| 		await this.runService(); | 		await this.runService(); | ||||||
| 
 | 
 | ||||||
| 		let preload = pathJoin(__dirname, "./SimulatorWindow.js"); | 		let preload = pathJoin(__dirname, "./SimulatorWindow.js"); | ||||||
| @ -50,11 +76,19 @@ class ElectronApp { | |||||||
| 			frame: false, | 			frame: false, | ||||||
| 			minWidth: 460, | 			minWidth: 460, | ||||||
| 			minHeight: 300, | 			minHeight: 300, | ||||||
| 			webPreferences: { preload } | 			webPreferences: { preload }, | ||||||
|  | 			show: false, | ||||||
| 		}); | 		}); | ||||||
| 
 | 
 | ||||||
| 		this.simulatorWindow.loadURL(this.serviceUrl + (ENV.LIVING_TOGETHER_WEB_PATH ?? "/resources/app.asar/")); | 		this.simulatorWindow.loadURL(this.serviceUrl + (ENV.LIVING_TOGETHER_WEB_PATH ?? "/resources/app.asar/")); | ||||||
| 
 | 
 | ||||||
|  | 		this.simulatorWindow.on("ready-to-show", () => { | ||||||
|  | 			setTimeout(() => { | ||||||
|  | 				this.loadingPage?.close(); | ||||||
|  | 				this.simulatorWindow?.show(); | ||||||
|  | 			}, 1220); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
| 		this.handelSimulatorWindowBehavior(); | 		this.handelSimulatorWindowBehavior(); | ||||||
| 		this.handelFileChange(); | 		this.handelFileChange(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user