initial playback notification implementation
This commit is contained in:
parent
9d7251f20c
commit
bb431c7282
2 changed files with 23 additions and 9 deletions
|
@ -53,6 +53,7 @@ const app = new Vue({
|
||||||
el: "#app",
|
el: "#app",
|
||||||
data: {
|
data: {
|
||||||
drawertest: false,
|
drawertest: false,
|
||||||
|
platform: "",
|
||||||
mk: {},
|
mk: {},
|
||||||
quickPlayQuery: "",
|
quickPlayQuery: "",
|
||||||
search: {
|
search: {
|
||||||
|
@ -139,6 +140,7 @@ const app = new Vue({
|
||||||
end: 0
|
end: 0
|
||||||
},
|
},
|
||||||
tmpVar: [],
|
tmpVar: [],
|
||||||
|
notification: {},
|
||||||
chrome: {
|
chrome: {
|
||||||
hideUserInfo: false,
|
hideUserInfo: false,
|
||||||
artworkReady: false,
|
artworkReady: false,
|
||||||
|
@ -170,6 +172,7 @@ const app = new Vue({
|
||||||
this.mk.authorize()
|
this.mk.authorize()
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
this.mk.privateEnabled = true
|
this.mk.privateEnabled = true
|
||||||
|
this.platform = ipcRenderer.sendSync('cider-platform');
|
||||||
// Set profile name
|
// Set profile name
|
||||||
this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "")
|
this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "")
|
||||||
// API Fallback
|
// API Fallback
|
||||||
|
@ -270,15 +273,21 @@ const app = new Vue({
|
||||||
app.getNowPlayingArtwork(42);
|
app.getNowPlayingArtwork(42);
|
||||||
app.getNowPlayingArtworkBG(32);
|
app.getNowPlayingArtworkBG(32);
|
||||||
app.loadLyrics()
|
app.loadLyrics()
|
||||||
|
|
||||||
// Playback Notifications
|
// Playback Notifications
|
||||||
// if (platform == "darwin" || platform == "linux") {
|
if (app.platform == "darwin" || app.platform == "linux") {
|
||||||
// new Notification(a.title, {
|
self.notification = new Notification(a.title, {
|
||||||
// body: a.artistName,
|
body: a.artistName,
|
||||||
// icon: a.artwork.url,
|
icon: a.artwork.url,
|
||||||
// silent: true
|
actions: [{"skip": "Skip"}],
|
||||||
// })
|
silent: true
|
||||||
// }
|
})
|
||||||
|
// self.notification.addEventListener('notificationclick', function(event) {
|
||||||
|
// event.notification.close();
|
||||||
|
// if (event.action !== 'skip') return;
|
||||||
|
// this.mk.skipToNext
|
||||||
|
// }, false);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.apiCall('https://api.music.apple.com/v1/me/library/playlists', res => {
|
this.apiCall('https://api.music.apple.com/v1/me/library/playlists', res => {
|
||||||
|
|
|
@ -80,7 +80,12 @@ const CiderBase = {
|
||||||
// Register listeners on Window to track size and position of the Window.
|
// Register listeners on Window to track size and position of the Window.
|
||||||
mainWindowState.manage(win);
|
mainWindowState.manage(win);
|
||||||
|
|
||||||
// IPC stuff
|
// IPC stuff (senders)
|
||||||
|
ipcMain.once("cider-platform", (event) => {
|
||||||
|
event.returnValue = process.platform
|
||||||
|
})
|
||||||
|
|
||||||
|
// IPC stuff (listeners)
|
||||||
|
|
||||||
ipcMain.on('close', () => { // listen for close event
|
ipcMain.on('close', () => { // listen for close event
|
||||||
win.close();
|
win.close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue