Fixing missing currenttrackicon for browser alerts
This commit is contained in:
@ -93,11 +93,15 @@ export let getCurrentPusherConnection = function( connections, connectionid ){
|
|||||||
* @param track object
|
* @param track object
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
export let getTrackIcon = function( track = false ){
|
export let getTrackIcon = function(current_track = false, ui = false){
|
||||||
if( !track ) return false
|
if (!ui) return false
|
||||||
if( !track.album ) return false
|
if (!current_track) return false
|
||||||
if( !track.album.images ) return false
|
if (typeof(current_track.uri) == 'undefined') return false
|
||||||
return sizedImages( track.album.images ).small
|
if (typeof(ui.tracks[current_track.uri]) === 'undefined') return false
|
||||||
|
var track = ui.tracks[current_track.uri]
|
||||||
|
if (!track.album) return false
|
||||||
|
if (!track.album.images) return false
|
||||||
|
return sizedImages(track.album.images).small
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -237,7 +237,7 @@ const MopidyMiddleware = (function(){
|
|||||||
type: 'browser_notification',
|
type: 'browser_notification',
|
||||||
title: 'Track skipped',
|
title: 'Track skipped',
|
||||||
body: store.getState().pusher.username +' skipped this track',
|
body: store.getState().pusher.username +' skipped this track',
|
||||||
icon: (store.getState().ui.current_track ? helpers.getTrackIcon( store.getState().ui.current_track ) : false)
|
icon: (store.getState().ui.current_track ? helpers.getTrackIcon(store.getState().ui.current_track, store.getState().ui) : false)
|
||||||
}
|
}
|
||||||
store.dispatch( pusherActions.deliverBroadcast(data) )
|
store.dispatch( pusherActions.deliverBroadcast(data) )
|
||||||
break
|
break
|
||||||
@ -247,7 +247,7 @@ const MopidyMiddleware = (function(){
|
|||||||
type: 'browser_notification',
|
type: 'browser_notification',
|
||||||
title: 'Playback stopped',
|
title: 'Playback stopped',
|
||||||
body: store.getState().pusher.username +' stopped playback',
|
body: store.getState().pusher.username +' stopped playback',
|
||||||
icon: (store.getState().ui.current_track ? helpers.getTrackIcon( store.getState().ui.current_track ) : false)
|
icon: (store.getState().ui.current_track ? helpers.getTrackIcon(store.getState().ui.current_track, store.getState().ui) : false)
|
||||||
}
|
}
|
||||||
store.dispatch( pusherActions.deliverBroadcast(data) )
|
store.dispatch( pusherActions.deliverBroadcast(data) )
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user