Restructure

This commit is contained in:
Core 2022-06-16 14:01:04 +01:00
parent 2fc4005b6c
commit bbcae012b8
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6

View file

@ -2,18 +2,36 @@ import * as fs from "fs";
import * as path from "path"; import * as path from "path";
import {Store} from "./store"; import {Store} from "./store";
import {BrowserWindow as bw} from "./browserwindow"; import {BrowserWindow as bw} from "./browserwindow";
import {app, dialog, ipcMain, Notification, shell, BrowserWindow} from "electron"; import {app, BrowserWindow, ipcMain} from "electron";
import fetch from "electron-fetch"; import fetch from "electron-fetch";
import {AppImageUpdater, NsisUpdater} from "electron-updater";
import * as log from "electron-log";
import ElectronStore from "electron-store"; import ElectronStore from "electron-store";
export class utils { export class utils {
/**
* Playback Functions
*/
static playback = {
pause: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.pause()")
},
play: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.play()")
},
playPause: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.playPause()")
},
next: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.next()")
},
previous: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.previous()")
}
}
/** /**
* Paths for the application to use * Paths for the application to use
*/ */
private static paths: any = { static paths: any = {
srcPath: path.join(__dirname, "../../src"), srcPath: path.join(__dirname, "../../src"),
rendererPath: path.join(__dirname, "../../src/renderer"), rendererPath: path.join(__dirname, "../../src/renderer"),
mainPath: path.join(__dirname, "../../src/main"), mainPath: path.join(__dirname, "../../src/main"),
@ -71,7 +89,7 @@ export class utils {
} else { } else {
i18n = Object.assign(i18n, JSON.parse(fs.readFileSync(path.join(this.paths.i18nPath, `en_US.json`), "utf8"))); i18n = Object.assign(i18n, JSON.parse(fs.readFileSync(path.join(this.paths.i18nPath, `en_US.json`), "utf8")));
} }
}) })
} }
if (key) { if (key) {
return i18n[key] return i18n[key]
@ -97,7 +115,6 @@ export class utils {
return Store.cfg.store return Store.cfg.store
} }
/** /**
* Get the store instance * Get the store instance
* @returns {Store} * @returns {Store}
@ -123,10 +140,6 @@ export class utils {
return Store.pushToCloud return Store.pushToCloud
} }
/** /**
* Gets the browser window * Gets the browser window
*/ */
@ -145,25 +158,4 @@ export class utils {
static loadJSFrontend(path: string): void { static loadJSFrontend(path: string): void {
bw.win.webContents.executeJavaScript(fs.readFileSync(path, "utf8")); bw.win.webContents.executeJavaScript(fs.readFileSync(path, "utf8"));
} }
/**
* Playback Functions
*/
static playback = {
pause: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.pause()")
},
play: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.play()")
},
playPause: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.playPause()")
},
next: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.next()")
},
previous: () => {
bw.win.webContents.executeJavaScript("MusicKitInterop.previous()")
}
}
} }