Fully-functional proof-of-concept
This commit is contained in:
@ -30,18 +30,6 @@ export function connecting(){
|
||||
}
|
||||
}
|
||||
|
||||
export function upgrading(){
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADING'
|
||||
}
|
||||
}
|
||||
|
||||
export function restarting(){
|
||||
return {
|
||||
type: 'MOPIDY_RESTARTING'
|
||||
}
|
||||
}
|
||||
|
||||
export function disconnect(){
|
||||
return {
|
||||
type: 'MOPIDY_DISCONNECT'
|
||||
@ -56,6 +44,42 @@ export function debug(call, value){
|
||||
}
|
||||
}
|
||||
|
||||
export function restartStarted(){
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_STARTED'
|
||||
}
|
||||
}
|
||||
|
||||
export function restartFinished(){
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_FINISHED'
|
||||
}
|
||||
}
|
||||
|
||||
export function upgradeStarted(){
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_STARTED'
|
||||
}
|
||||
}
|
||||
|
||||
export function upgradeFinished(){
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_FINISHED'
|
||||
}
|
||||
}
|
||||
|
||||
export function localScanStarted(){
|
||||
return {
|
||||
type: 'MOPIDY_LOCAL_SCAN_STARTED'
|
||||
}
|
||||
}
|
||||
|
||||
export function localScanFinished(){
|
||||
return {
|
||||
type: 'MOPIDY_LOCAL_SCAN_FINISHED'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Core play actions
|
||||
**/
|
||||
|
||||
@ -4,21 +4,29 @@ import * as helpers from '../../helpers';
|
||||
export default function reducer(mopidy = {}, action){
|
||||
switch (action.type){
|
||||
|
||||
case 'MOPIDY_SET':
|
||||
return Object.assign({}, mopidy, action.data);
|
||||
|
||||
case 'MOPIDY_CONNECT':
|
||||
case 'MOPIDY_CONNECTING':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: true });
|
||||
|
||||
case 'MOPIDY_RESTARTING':
|
||||
return Object.assign({}, mopidy, { restarting: true });
|
||||
|
||||
case 'MOPIDY_UPGRADING':
|
||||
return Object.assign({}, mopidy, { upgrading: true });
|
||||
return Object.assign({}, mopidy, {
|
||||
connected: false,
|
||||
connecting: true
|
||||
});
|
||||
|
||||
case 'MOPIDY_CONNECTED':
|
||||
return Object.assign({}, mopidy, { connected: true, connecting: false, restarting: false, upgrading: false });
|
||||
return Object.assign({}, mopidy, {
|
||||
connected: true,
|
||||
connecting: false,
|
||||
restart_running: false,
|
||||
upgrade_running: false
|
||||
});
|
||||
|
||||
case 'MOPIDY_DISCONNECTED':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: false });
|
||||
return Object.assign({}, mopidy, {
|
||||
connected: false,
|
||||
connecting: false
|
||||
});
|
||||
|
||||
case 'MOPIDY_CHANGE_TRACK':
|
||||
return Object.assign({}, mopidy, {
|
||||
@ -30,8 +38,23 @@ export default function reducer(mopidy = {}, action){
|
||||
uri_schemes: action.uri_schemes
|
||||
});
|
||||
|
||||
case 'MOPIDY_SET':
|
||||
return Object.assign({}, mopidy, action.data);
|
||||
case 'MOPIDY_RESTART_STARTED':
|
||||
return Object.assign({}, mopidy, { restart_running: true });
|
||||
|
||||
case 'MOPIDY_RESTART_FINISHED':
|
||||
return Object.assign({}, mopidy, { restart_running: false });
|
||||
|
||||
case 'MOPIDY_UPGRADE_STARTED':
|
||||
return Object.assign({}, mopidy, { upgrade_running: true });
|
||||
|
||||
case 'MOPIDY_UPGRADE_FINISHED':
|
||||
return Object.assign({}, mopidy, { upgrade_running: false });
|
||||
|
||||
case 'MOPIDY_LOCAL_SCAN_STARTED':
|
||||
return Object.assign({}, mopidy, { local_scan_running: true });
|
||||
|
||||
case 'MOPIDY_LOCAL_SCAN_FINISHED':
|
||||
return Object.assign({}, mopidy, { local_scan_running: false });
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user