catch if components fail (ms builds)

This commit is contained in:
vapormusic 2022-01-06 21:06:48 +07:00
parent 5185d5aa01
commit 3c4441e8c5

View file

@ -2,7 +2,7 @@ require('v8-compile-cache');
const {app, components} = require('electron'),
{resolve, join} = require("path"),
CiderBase = require('./src/main/cider-base');
var componentsFail = false;
// Analytics for debugging.
const ElectronSentry = require("@sentry/electron");
ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"});
@ -138,26 +138,30 @@ if (process.platform === "linux") {
app.on('ready', () => {
app.whenReady().then(async () => {
await components.whenReady().catch(e => console.log(`component ready fail:`, e));
console.log('components ready:', components.status());
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');
if (components != null) {
try{
await components.whenReady().catch(e => {console.log(`component ready fail:`, e); componentsFail = true});
console.log('components ready:', components.status());
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()
console.log('[Cider] Application is Ready. Creating Window.')
if (!app.isPackaged) {
console.info('[Cider] Running in development mode.')
require('vue-devtools').install()
}
CreateWindow()
} catch (e) {componentsFail = true}
} else {componentsFail = true}
})
});
app.on('before-quit', () => {
app.on('before-quit', () => {s
app.isQuiting = true;
console.warn(`${app.getName()} exited.`);
});
@ -169,6 +173,23 @@ app.on('widevine-ready', (version, lastVersion) => {
} else {
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) => {