Simplifying broadcasts (removing silly action namespacing)

This commit is contained in:
James Barnsley
2018-03-21 08:45:22 +13:00
parent 4b5c8a4420
commit 1761456e76
10 changed files with 1966 additions and 1022 deletions

View File

@ -262,11 +262,13 @@ const MopidyMiddleware = (function(){
);
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +(store.getState().mopidy.play_state == 'paused' ? ' resumed' : ' started')+' playback',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
notification: {
type: 'info',
content: store.getState().pusher.username +(store.getState().mopidy.play_state == 'paused' ? ' resumed' : ' started')+' playback',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
}
}
));
break;
@ -283,7 +285,7 @@ const MopidyMiddleware = (function(){
);
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +' paused playback',
@ -296,11 +298,13 @@ const MopidyMiddleware = (function(){
instruct(socket, store, 'playback.next');
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +' skipped <em>'+store.getState().core.current_track.name+'</em>',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
notification: {
type: 'info',
content: store.getState().pusher.username +' skipped <em>'+store.getState().core.current_track.name+'</em>',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
}
}
));
break
@ -309,11 +313,13 @@ const MopidyMiddleware = (function(){
instruct(socket, store, 'playback.stop');
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +' stopped playback',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
notification: {
type: 'info',
content: store.getState().pusher.username +' stopped playback',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
}
}
));
break
@ -322,10 +328,12 @@ const MopidyMiddleware = (function(){
instruct(socket, store, 'playback.play', {tlid: action.tlid});
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +' changed track'
notification: {
type: 'info',
content: store.getState().pusher.username +' changed track'
}
}
));
break;
@ -333,10 +341,12 @@ const MopidyMiddleware = (function(){
case 'MOPIDY_REMOVE_TRACKS':
instruct(socket, store, 'tracklist.remove', {tlid: action.tlids});
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +' removed '+action.tlids.length+' tracks'
notification: {
type: 'info',
content: store.getState().pusher.username +' removed '+action.tlids.length+' tracks'
}
}
));
break;
@ -404,10 +414,12 @@ const MopidyMiddleware = (function(){
case 'MOPIDY_SET_MUTE':
instruct(socket, store, 'mixer.setMute', [action.mute]);
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +(action.mute ? ' muted' : ' unmuted')+' playback'
notification: {
type: 'info',
content: store.getState().pusher.username +(action.mute ? ' muted' : ' unmuted')+' playback'
}
}
));
break;
@ -559,11 +571,13 @@ const MopidyMiddleware = (function(){
}
store.dispatch(pusherActions.deliverBroadcast(
'ui.createNotification',
'notification',
{
type: 'info',
content: store.getState().pusher.username +' is adding '+action.uris.length+' URIs to queue',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
notification: {
type: 'info',
content: store.getState().pusher.username +' is adding '+action.uris.length+' URIs to queue',
icon: (store.getState().core.current_track ? helpers.getTrackIcon(store.getState().core.current_track, store.getState().core) : false)
}
}
));