Components tweak

This commit is contained in:
Core 2022-01-06 15:07:39 +00:00
parent 3c4441e8c5
commit c51d82271e

View file

@ -2,7 +2,9 @@ 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;
const comps = components;
// 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"});
@ -128,27 +130,29 @@ function CreateWindow() {
if (process.platform === "linux") { if (process.platform === "linux") {
app.commandLine.appendSwitch('disable-features', 'MediaSessionService'); app.commandLine.appendSwitch('disable-features', 'MediaSessionService');
} }
app.commandLine.appendSwitch('high-dpi-support', "1")
app.commandLine.appendSwitch('force-device-scale-factor', "1")
app.commandLine.appendSwitch('disable-pinch');
// app.commandLine.appendSwitch('js-flags', '--max-old-space-size=1024')
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* App Event Handlers * App Event Handlers
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// app.commandLine.appendSwitch('js-flags', '--max-old-space-size=1024') app.whenReady().then(async () => {
if (comps == null) {
app.on('ready', () => { app.on("widevine-ready", () => {
app.whenReady().then(async () => { console.log('[Cider] Application is Ready. Creating Window.')
if (components != null) { if (!app.isPackaged) {
try{ console.info('[Cider] Running in development mode.')
await components.whenReady().catch(e => {console.log(`component ready fail:`, e); componentsFail = true}); require('vue-devtools').install()
console.log('components ready:', components.status());
if (app.isQuiting) {
app.quit();
return;
} }
app.commandLine.appendSwitch('high-dpi-support', 1) CreateWindow()
app.commandLine.appendSwitch('force-device-scale-factor', 1) })
app.commandLine.appendSwitch('disable-pinch'); return
}
await comps.whenReady();
console.log('components ready:', comps.status());
console.log('[Cider] Application is Ready. Creating Window.') console.log('[Cider] Application is Ready. Creating Window.')
if (!app.isPackaged) { if (!app.isPackaged) {
@ -156,13 +160,10 @@ app.on('ready', () => {
require('vue-devtools').install() require('vue-devtools').install()
} }
CreateWindow() CreateWindow()
} catch (e) {componentsFail = true} })
} else {componentsFail = true}
})
});
app.on('before-quit', () => {s
app.isQuiting = true; app.on('before-quit', () => {
console.warn(`${app.getName()} exited.`); console.warn(`${app.getName()} exited.`);
}); });
@ -173,23 +174,6 @@ 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) => {