Who tf done this
This commit is contained in:
parent
ed8e977786
commit
ba6f89362d
9 changed files with 44 additions and 37 deletions
|
@ -289,10 +289,9 @@ export default class ChromecastPlugin {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
constructor(app: any, store: any) {
|
||||
this._app = app;
|
||||
this._store = store
|
||||
|
||||
constructor(utils: { getApp: () => any; getStore: () => any; }) {
|
||||
this._app = utils.getApp();
|
||||
this._store = utils.getStore()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,10 +193,10 @@ export default class DiscordRichPresence {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
constructor(app: any, store: any) {
|
||||
DiscordRichPresence._store = store
|
||||
constructor(utils: { getStore: () => any; getApp: () => any; }) {
|
||||
DiscordRichPresence._store = utils.getStore();
|
||||
console.debug(`[Plugin][${this.name}] Loading Complete.`);
|
||||
this._app = app;
|
||||
this._app = utils.getApp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -207,10 +207,10 @@ export default class LastFMPlugin {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
constructor(app: any, store: any) {
|
||||
this._app = app;
|
||||
this._store = store
|
||||
electron.app.on('second-instance', (_e: any, argv: any) => {
|
||||
constructor(utils: { getApp: () => any; getStore: () => any; }) {
|
||||
this._app = utils.getApp();
|
||||
this._store = utils.getStore()
|
||||
utils.getApp().on('second-instance', (_e: any, argv: any) => {
|
||||
// Checks if first instance is authorized and if second instance has protocol args
|
||||
argv.forEach((value: any) => {
|
||||
if (value.includes('auth')) {
|
||||
|
|
|
@ -214,9 +214,9 @@ export default class Thumbar {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
constructor(app: any, store: any) {
|
||||
this._app = app;
|
||||
this._store = store
|
||||
constructor(utils: { getApp: () => any; getStore: () => any; }) {
|
||||
this._app = utils.getApp();
|
||||
this._store = utils.getStore();
|
||||
console.debug(`[Plugin][${this.name}] Loading Complete.`);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ export default class MPRIS {
|
|||
*/
|
||||
private _win: any;
|
||||
private _app: any;
|
||||
private static utils: any;
|
||||
|
||||
/**
|
||||
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
||||
|
@ -37,10 +38,8 @@ export default class MPRIS {
|
|||
* @param type - pausePlay, nextTrack, PreviousTrack
|
||||
* @private
|
||||
*/
|
||||
private runMediaEvent(type: string) {
|
||||
if (this._win) {
|
||||
this._win.webContents.executeJavaScript(`MusicKitInterop.${type}()`).catch(console.error)
|
||||
}
|
||||
private static runMediaEvent(type: string) {
|
||||
MPRIS.utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.${type}()`).catch(console.error)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +87,7 @@ export default class MPRIS {
|
|||
|
||||
for (const [key, value] of Object.entries(this.mprisEvents)) {
|
||||
this.mpris.on(key, () => {
|
||||
this.runMediaEvent(value)
|
||||
MPRIS.runMediaEvent(value)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -113,8 +112,7 @@ export default class MPRIS {
|
|||
return
|
||||
}
|
||||
|
||||
this.mpris.metadata = MetaData
|
||||
|
||||
this.mpris.metadata = MetaData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,8 +153,9 @@ export default class MPRIS {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
constructor(app: any, _store: any) {
|
||||
this._app = app;
|
||||
constructor(utils: { getApp: () => any; }) {
|
||||
MPRIS.utils = utils
|
||||
this._app = utils.getApp();
|
||||
console.debug(`[Plugin][${this.name}] Loading Complete.`);
|
||||
}
|
||||
|
||||
|
@ -176,7 +175,7 @@ export default class MPRIS {
|
|||
console.debug(`[Plugin][${this.name}] Stopped.`);
|
||||
try {
|
||||
this.clearState()
|
||||
}catch(e) {
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ export default class Thumbar {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
constructor(app: any, _store: any) {
|
||||
this._app = app;
|
||||
constructor(utils: { getApp: () => any; }) {
|
||||
this._app = utils.getApp();
|
||||
console.debug(`[Plugin][${this.name}] Loading Complete.`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue