refs #452 Add splash screen when starting the window
This commit is contained in:
parent
0fd942e080
commit
bf5a7f35f6
|
@ -42,6 +42,11 @@
|
|||
"integrity": "sha512-LAQ1d4OPfSJ/BMbI2DuizmYrrkD9JMaTdi2hQTlI53lQ4kRQPyZQRS4CYQ7O66bnBBnP/oYdRxbk++X0xuFU6A==",
|
||||
"dev": true
|
||||
},
|
||||
"@trodi/electron-splashscreen": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@trodi/electron-splashscreen/-/electron-splashscreen-0.3.1.tgz",
|
||||
"integrity": "sha512-2NilGoVuVNBKoOwjnDp9MIsb5gPJZTxEK5Dg/Vd/TaOvgMwFl4aPAWky3+O3OH2SISUdmvQyWo0UmWMnjY+04A=="
|
||||
},
|
||||
"@types/caseless": {
|
||||
"version": "0.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.1.tgz",
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@trodi/electron-splashscreen": "^0.3.1",
|
||||
"about-window": "^1.11.0",
|
||||
"animate.css": "^3.6.1",
|
||||
"axios": "^0.18.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
import { app, ipcMain, BrowserWindow, shell, Menu } from 'electron'
|
||||
import { app, ipcMain, shell, Menu } from 'electron'
|
||||
import Datastore from 'nedb'
|
||||
import empty from 'is-empty'
|
||||
import log from 'electron-log'
|
||||
|
@ -9,6 +9,7 @@ import simplayer from 'simplayer'
|
|||
import path from 'path'
|
||||
import openAboutWindow from 'about-window'
|
||||
import ContextMenu from 'electron-context-menu'
|
||||
import * as Splashscreen from '@trodi/electron-splashscreen'
|
||||
|
||||
import Authentication from './auth'
|
||||
import Account from './account'
|
||||
|
@ -40,6 +41,10 @@ const winURL = process.env.NODE_ENV === 'development'
|
|||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`
|
||||
|
||||
const splashURL = process.env.NODE_ENV === 'development'
|
||||
? path.resolve(__dirname, '../../dist/electron/static/splash-screen.html')
|
||||
: `file://${__dirname}/static/splash-screen.html`
|
||||
|
||||
// https://github.com/louischatriot/nedb/issues/459
|
||||
const userData = app.getPath('userData')
|
||||
const accountDBPath = process.env.NODE_ENV === 'production'
|
||||
|
@ -277,7 +282,8 @@ async function createWindow () {
|
|||
defaultWidth: 1000,
|
||||
height: 563
|
||||
})
|
||||
mainWindow = new BrowserWindow({
|
||||
// mainWindow = new BrowserWindow({
|
||||
const mainOpts = {
|
||||
titleBarStyle: 'hidden',
|
||||
transparent: true,
|
||||
x: mainWindowState.x,
|
||||
|
@ -286,10 +292,20 @@ async function createWindow () {
|
|||
height: mainWindowState.height,
|
||||
useContentSize: true,
|
||||
icon: path.resolve(__dirname, '../../build/icons/256x256.png')
|
||||
})
|
||||
mainWindowState.manage(mainWindow)
|
||||
}
|
||||
const config = {
|
||||
windowOpts: mainOpts,
|
||||
templateUrl: splashURL,
|
||||
splashScreenOpts: {
|
||||
width: 425,
|
||||
height: 325
|
||||
}
|
||||
}
|
||||
mainWindow = Splashscreen.initSplashScreen(config)
|
||||
|
||||
mainWindow.loadURL(winURL)
|
||||
mainWindowState.manage(mainWindow)
|
||||
console.log(winURL)
|
||||
// mainWindow.loadURL(winURL)
|
||||
|
||||
mainWindow.webContents.on('will-navigate', (event) => event.preventDefault())
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="./images/icon.png" width="200" height="200"></img>
|
||||
</center>
|
||||
<center>
|
||||
Loading...<span id="status"></span>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue