Files
Iris/src/js/services/pusher/actions.js

284 lines
4.5 KiB
JavaScript
Raw Normal View History

2016-10-27 16:58:11 +13:00
/**
* Actions and Action Creators
**/
2017-10-10 13:05:28 +13:00
export function setPort(port){
2016-10-27 16:58:11 +13:00
return {
2016-10-31 09:25:15 +13:00
type: 'PUSHER_SET_PORT',
port: port
2016-10-27 16:58:11 +13:00
}
}
2017-10-10 13:05:28 +13:00
export function setUsername(username){
return {
type: 'PUSHER_SET_USERNAME',
username: username.replace(/[\W_]+/g,'')
}
}
2016-10-27 16:58:11 +13:00
export function connect(){
return {
type: 'PUSHER_CONNECT'
}
}
export function disconnect(){
return {
type: 'PUSHER_DISCONNECT'
}
}
export function upgrade(){
return {
type: 'PUSHER_UPGRADE'
2018-04-16 09:01:42 +12:00
}
}
export function reload(){
2018-04-16 09:01:42 +12:00
return {
type: 'PUSHER_RELOAD'
}
}
export function restart(){
return {
type: 'PUSHER_RESTART'
}
}
export function getConnections(){
return {
2017-02-19 21:27:43 +13:00
type: 'PUSHER_GET_CONNECTIONS'
}
}
export function connectionAdded(connection){
return {
type: 'PUSHER_CONNECTION_ADDED',
connection: connection
}
}
export function connectionChanged(connection){
return {
type: 'PUSHER_CONNECTION_CHANGED',
connection: connection
}
}
export function connectionRemoved(connection){
return {
type: 'PUSHER_CONNECTION_REMOVED',
connection: connection
}
}
2017-10-10 13:05:28 +13:00
export function instruct(data = null){
2016-10-27 16:58:11 +13:00
return {
type: 'PUSHER_INSTRUCT',
data: data
2016-10-27 16:58:11 +13:00
}
}
export function getConfig(){
return {
type: 'PUSHER_GET_CONFIG'
}
}
export function getVersion(){
return {
type: 'PUSHER_GET_VERSION'
}
}
export function deliverBroadcast(method, params){
2017-03-09 08:04:23 +13:00
return {
type: 'PUSHER_DELIVER_BROADCAST',
data: {
method: method,
params: params
}
2017-03-09 08:04:23 +13:00
}
}
export function deliverMessage(recipient, method, params){
return {
type: 'PUSHER_DELIVER_MESSAGE',
data: {
recipient: recipient,
method: method,
params: params
}
}
}
export function getRadio(){
return {
type: 'PUSHER_GET_RADIO'
}
}
2017-10-10 13:05:28 +13:00
export function startRadio(uris){
2016-12-20 16:58:20 +13:00
return {
type: 'PUSHER_START_RADIO',
2016-12-20 16:58:20 +13:00
uris: uris
}
}
2017-10-10 13:05:28 +13:00
export function updateRadio(uris){
2017-04-18 04:44:39 +12:00
return {
type: 'PUSHER_UPDATE_RADIO',
uris: uris
}
}
2016-12-20 19:54:19 +13:00
export function stopRadio(){
2016-12-20 16:58:20 +13:00
return {
type: 'PUSHER_STOP_RADIO'
2016-12-20 16:58:20 +13:00
}
}
export function radioStarted(radio){
return {
type: 'PUSHER_RADIO_STARTED',
radio: radio
}
}
export function radioChanged(radio){
return {
type: 'PUSHER_RADIO_CHANGED',
radio: radio
}
}
export function radioStopped(){
return {
type: 'PUSHER_RADIO_STOPPED'
}
}
2017-10-10 13:05:28 +13:00
export function debug(message = null){
return {
type: 'PUSHER_DEBUG',
message: message
}
2017-02-14 12:13:07 +13:00
}
export function getQueueMetadata(){
return {
type: 'PUSHER_GET_QUEUE_METADATA'
}
}
export function queueMetadataChanged(queue_metadata){
return {
type: 'PUSHER_QUEUE_METADATA_CHANGED',
queue_metadata: queue_metadata
}
}
2017-10-10 13:05:28 +13:00
export function addQueueMetadata(tlids = [], from_uri = null){
2017-02-14 12:13:07 +13:00
return {
type: 'PUSHER_ADD_QUEUE_METADATA',
tlids: tlids,
from_uri: from_uri
}
}
/**
* Snapcast actions
* TODO: Figure out how to cleanly split this out to it's own service
* but still share the pusher middleware connection
**/
export function getSnapcast(){
return {
type: 'PUSHER_GET_SNAPCAST',
data: {
method: 'Server.GetStatus'
}
}
}
2018-04-29 21:10:57 +12:00
export function snapcastServerLoaded(server){
return {
type: 'PUSHER_SNAPCAST_SERVER_LOADED',
server: server
}
}
2018-04-18 17:01:57 +12:00
export function setSnapcastClientName(id, name){
return {
2018-04-18 17:01:57 +12:00
type: 'PUSHER_SET_SNAPCAST_CLIENT_NAME',
id: id,
name: name
}
}
2018-04-18 17:01:57 +12:00
export function setSnapcastClientMute(id, mute){
2018-03-23 16:54:56 +13:00
return {
2018-04-18 17:01:57 +12:00
type: 'PUSHER_SET_SNAPCAST_CLIENT_MUTE',
id: id,
mute: mute
}
}
export function setSnapcastClientVolume(id, percent){
return {
type: 'PUSHER_SET_SNAPCAST_CLIENT_VOLUME',
id: id,
percent: percent
2018-03-23 16:54:56 +13:00
}
}
export function setSnapcastClientLatency(id, latency){
return {
type: 'PUSHER_SET_SNAPCAST_CLIENT_LATENCY',
2018-04-18 17:01:57 +12:00
id: id,
latency: latency
}
}
2018-04-29 21:10:57 +12:00
export function setSnapcastClientGroup(id, group_id){
return {
type: 'PUSHER_SET_SNAPCAST_CLIENT_GROUP',
id: id,
group_id: group_id
}
}
export function deleteSnapcastClient(id){
return {
type: 'PUSHER_DELETE_SNAPCAST_CLIENT',
2018-04-18 17:01:57 +12:00
id: id
}
}
2018-04-29 21:10:57 +12:00
export function setSnapcastGroupStream(id, stream_id){
return {
type: 'PUSHER_SET_SNAPCAST_GROUP_STREAM',
id: id,
stream_id: stream_id
}
}
2018-05-01 21:03:05 +12:00
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
}
}