main: rename crash screen
This commit is contained in:
1 parent
ddfffb5a2f
commit
ca93505dc6
3 files changed
+18
-13
No files matched your search
+14
-10
@@ -15,6 +15,7 @@ export default class MainRunner {
|
||||
})
|
||||
|
||||
mainWindow.setMenu(null)
|
||||
|
||||
mainWindow.on('close', (event) => {
|
||||
event.preventDefault()
|
||||
MainRunner.exitApp(mainWindow)
|
||||
@@ -41,34 +42,37 @@ export default class MainRunner {
|
||||
return mainWindow
|
||||
}
|
||||
|
||||
static createCrashWindow (crashWindow, mainWindow, details) {
|
||||
static createErrorWindow (errorWindow, mainWindow, details) {
|
||||
if (!Constants.IS_DEV_ENV) {
|
||||
mainWindow?.hide()
|
||||
}
|
||||
|
||||
crashWindow = new BrowserWindow({
|
||||
errorWindow = new BrowserWindow({
|
||||
show: false,
|
||||
title: Constants.APP_NAME,
|
||||
icon: path.join(__static, Constants.APP_ICON),
|
||||
resizable: Constants.IS_DEV_ENV,
|
||||
webPreferences: Constants.DEFAULT_WEB_PREFERENCES
|
||||
})
|
||||
crashWindow.setMenu(null)
|
||||
crashWindow.loadURL(`${Constants.APP_INDEX_URL}#/crash`).then(() => true)
|
||||
crashWindow.on('ready-to-show', () => {
|
||||
|
||||
errorWindow.setMenu(null)
|
||||
errorWindow.loadURL(`${Constants.APP_INDEX_URL}#/error`).then(() => true)
|
||||
|
||||
errorWindow.on('ready-to-show', () => {
|
||||
if (!Constants.IS_DEV_ENV && mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.destroy()
|
||||
}
|
||||
crashWindow.show()
|
||||
crashWindow.focus()
|
||||
errorWindow.show()
|
||||
errorWindow.focus()
|
||||
})
|
||||
crashWindow.webContents.on('did-frame-finish-load', () => {
|
||||
|
||||
errorWindow.webContents.on('did-frame-finish-load', () => {
|
||||
if (Constants.IS_DEV_ENV) {
|
||||
crashWindow.webContents.openDevTools()
|
||||
errorWindow.webContents.openDevTools()
|
||||
}
|
||||
})
|
||||
|
||||
return crashWindow
|
||||
return errorWindow
|
||||
}
|
||||
|
||||
static exitApp (mainWindow) {
|
||||
|
||||
+3
-2
@@ -6,7 +6,7 @@ import Constants from './utils/Constants'
|
||||
import * as electronRemote from '@electron/remote/main'
|
||||
|
||||
let mainWindow
|
||||
let crashWindow
|
||||
let errorWindow
|
||||
|
||||
if (!Constants.IS_DEV_ENV) {
|
||||
global.__static = path.join(path.dirname(fileURLToPath(import.meta.url)), '/static')
|
||||
@@ -27,6 +27,7 @@ app.on('activate', () => {
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
mainWindow = null
|
||||
errorWindow = null
|
||||
|
||||
if (!Constants.IS_MAC) {
|
||||
app.quit()
|
||||
@@ -34,5 +35,5 @@ app.on('window-all-closed', () => {
|
||||
})
|
||||
|
||||
app.on('render-process-gone', (ev, webContents, details) => {
|
||||
crashWindow = MainRunner.createCrashWindow(crashWindow, mainWindow, details)
|
||||
errorWindow = MainRunner.createErrorWindow(errorWindow, mainWindow, details)
|
||||
})
|
||||
@@ -9,7 +9,7 @@ const router = createRouter({
|
||||
component: MainScreen
|
||||
},
|
||||
{
|
||||
path: '/crash',
|
||||
path: '/error',
|
||||
component: ErrorScreen
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user