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