App loader; Snapcast group volume

This commit is contained in:
James Barnsley
2018-05-01 21:03:05 +12:00
parent 4249125b66
commit 781d46168a
7 changed files with 23564 additions and 25358 deletions

View File

@ -265,3 +265,19 @@ export function setSnapcastGroupStream(id, stream_id){
}
}
export function setSnapcastGroupMute(id, mute){
return {
type: 'PUSHER_SET_SNAPCAST_GROUP_MUTE',
id: id,
mute: mute
}
}
export function setSnapcastGroupVolume(id, percent){
return {
type: 'PUSHER_SET_SNAPCAST_GROUP_VOLUME',
id: id,
percent: percent
}
}

View File

@ -873,6 +873,37 @@ const PusherMiddleware = (function(){
);
break
case 'PUSHER_SET_SNAPCAST_GROUP_MUTE':
var group = store.getState().pusher.snapcast_groups[action.id];
var data = {
method: 'Group.SetMute',
params: {
id: action.id,
mute: action.mute
}
}
request(store, 'snapcast_instruct', data)
.then(
response => {
store.dispatch({
type: 'PUSHER_SNAPCAST_GROUP_UPDATED',
key: action.id,
group: {
muted: response.mute
}
})
},
error => {
store.dispatch(coreActions.handleException(
'Error',
error,
error.message
));
}
);
break
// This action is irrelevant to us, pass it on to the next middleware
default:
return next(action);