catch if components fail (ms builds)
This commit is contained in:
parent
5185d5aa01
commit
3c4441e8c5
1 changed files with 38 additions and 17 deletions
55
index.js
55
index.js
|
@ -2,7 +2,7 @@ require('v8-compile-cache');
|
||||||
const {app, components} = require('electron'),
|
const {app, components} = require('electron'),
|
||||||
{resolve, join} = require("path"),
|
{resolve, join} = require("path"),
|
||||||
CiderBase = require('./src/main/cider-base');
|
CiderBase = require('./src/main/cider-base');
|
||||||
|
var componentsFail = false;
|
||||||
// Analytics for debugging.
|
// Analytics for debugging.
|
||||||
const ElectronSentry = require("@sentry/electron");
|
const ElectronSentry = require("@sentry/electron");
|
||||||
ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"});
|
ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"});
|
||||||
|
@ -138,26 +138,30 @@ if (process.platform === "linux") {
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
await components.whenReady().catch(e => console.log(`component ready fail:`, e));
|
if (components != null) {
|
||||||
console.log('components ready:', components.status());
|
try{
|
||||||
if (app.isQuiting) {
|
await components.whenReady().catch(e => {console.log(`component ready fail:`, e); componentsFail = true});
|
||||||
app.quit();
|
console.log('components ready:', components.status());
|
||||||
return;
|
if (app.isQuiting) {
|
||||||
}
|
app.quit();
|
||||||
app.commandLine.appendSwitch('high-dpi-support', 1)
|
return;
|
||||||
app.commandLine.appendSwitch('force-device-scale-factor', 1)
|
}
|
||||||
app.commandLine.appendSwitch('disable-pinch');
|
app.commandLine.appendSwitch('high-dpi-support', 1)
|
||||||
|
app.commandLine.appendSwitch('force-device-scale-factor', 1)
|
||||||
|
app.commandLine.appendSwitch('disable-pinch');
|
||||||
|
|
||||||
console.log('[Cider] Application is Ready. Creating Window.')
|
console.log('[Cider] Application is Ready. Creating Window.')
|
||||||
if (!app.isPackaged) {
|
if (!app.isPackaged) {
|
||||||
console.info('[Cider] Running in development mode.')
|
console.info('[Cider] Running in development mode.')
|
||||||
require('vue-devtools').install()
|
require('vue-devtools').install()
|
||||||
}
|
}
|
||||||
CreateWindow()
|
CreateWindow()
|
||||||
|
} catch (e) {componentsFail = true}
|
||||||
|
} else {componentsFail = true}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('before-quit', () => {
|
app.on('before-quit', () => {s
|
||||||
app.isQuiting = true;
|
app.isQuiting = true;
|
||||||
console.warn(`${app.getName()} exited.`);
|
console.warn(`${app.getName()} exited.`);
|
||||||
});
|
});
|
||||||
|
@ -169,6 +173,23 @@ app.on('widevine-ready', (version, lastVersion) => {
|
||||||
} else {
|
} else {
|
||||||
console.log('[Cider][Widevine] Widevine ' + version + ' is ready to be used!')
|
console.log('[Cider][Widevine] Widevine ' + version + ' is ready to be used!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(componentsFail){
|
||||||
|
if (app.isQuiting) {
|
||||||
|
app.quit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
app.commandLine.appendSwitch('high-dpi-support', 1)
|
||||||
|
app.commandLine.appendSwitch('force-device-scale-factor', 1)
|
||||||
|
app.commandLine.appendSwitch('disable-pinch');
|
||||||
|
|
||||||
|
console.log('[Cider] Application is Ready. Creating Window.')
|
||||||
|
if (!app.isPackaged) {
|
||||||
|
console.info('[Cider] Running in development mode.')
|
||||||
|
require('vue-devtools').install()
|
||||||
|
}
|
||||||
|
CreateWindow()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
|
app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue