Service tiles; Start handling disabled services
This commit is contained in:
@ -20,7 +20,11 @@ const CoreMiddleware = (function(){
|
||||
case 'CORE_START_SERVICES':
|
||||
store.dispatch(mopidyActions.connect())
|
||||
store.dispatch(pusherActions.connect())
|
||||
store.dispatch(spotifyActions.connect())
|
||||
|
||||
if (store.getState().spotify.enabled){
|
||||
store.dispatch(spotifyActions.connect())
|
||||
}
|
||||
|
||||
next(action)
|
||||
break
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ const MopidyMiddleware = (function(){
|
||||
|
||||
case 'MOPIDY_URISCHEMES':
|
||||
var uri_schemes = action.data
|
||||
var remove = ['http','https','mms','rtmp','rtmps','rtsp','sc','spotify']
|
||||
var remove = ['http','https','mms','rtmp','rtmps','rtsp','sc']
|
||||
|
||||
// remove all our ignored types
|
||||
for( var i = 0; i < remove.length; i++ ){
|
||||
@ -279,10 +279,12 @@ const MopidyMiddleware = (function(){
|
||||
|
||||
// it's a spotify playlist that we haven't loaded
|
||||
// we need to fetch via HTTP API to avoid timeout
|
||||
} else if (helpers.uriSource(action.uri) == 'spotify'){
|
||||
} else if (helpers.uriSource(action.uri) == 'spotify' && store.getState().spotify.enabled){
|
||||
store.dispatch(uiActions.startProcess('MOPIDY_ENQUEUE_URIS', 'Fetching tracks'))
|
||||
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri))
|
||||
break
|
||||
|
||||
// Not in index, and Spotify HTTP not enabled, so just play it as-is
|
||||
}
|
||||
|
||||
// fetch the playlist tracks via backend
|
||||
|
||||
@ -109,7 +109,7 @@ const PusherMiddleware = (function(){
|
||||
|
||||
response.type = 'PUSHER_CONFIG'
|
||||
store.dispatch(response)
|
||||
if (response.config.spotify_username){
|
||||
if (response.config.spotify_username && store.getState().spotify.enabled){
|
||||
store.dispatch(spotifyActions.getUser('spotify:user:'+response.config.spotify_username))
|
||||
}
|
||||
var spotify = store.getState().spotify
|
||||
@ -303,7 +303,7 @@ const PusherMiddleware = (function(){
|
||||
|
||||
case 'PUSHER_RADIO_STARTED':
|
||||
case 'PUSHER_RADIO_CHANGED':
|
||||
if (action.radio.enabled){
|
||||
if (action.radio.enabled && store.getState().spotify.enabled){
|
||||
store.dispatch(spotifyActions.resolveRadioSeeds(action.radio))
|
||||
}
|
||||
next(action)
|
||||
|
||||
@ -171,11 +171,6 @@ function refreshToken( dispatch, getState ){
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Actions and Action Creators
|
||||
**/
|
||||
|
||||
export function setConfig( config ){
|
||||
return {
|
||||
type: 'SPOTIFY_SET_CONFIG',
|
||||
|
||||
@ -16,10 +16,21 @@ const SpotifyMiddleware = (function(){
|
||||
|
||||
switch(action.type){
|
||||
|
||||
case 'SPOTIFY_CONNECT':
|
||||
store.dispatch( spotifyActions.getMe() )
|
||||
break
|
||||
|
||||
case 'SPOTIFY_CONNECTED':
|
||||
var label = null
|
||||
if (store.getState().spotify.me) label = store.getState().spotify.me.id
|
||||
ReactGA.event({ category: 'Spotify', action: 'Connected', label: label })
|
||||
|
||||
// TODO: remove this so we don't tap out our API limits before we even get started
|
||||
// Perhaps fire this on demand? Context menu, playlists loading or AddToPlaylistModal
|
||||
if (store.getState().spotify_authorized){
|
||||
store.dispatch(spotifyActions.getAllLibraryPlaylists())
|
||||
}
|
||||
|
||||
next(action)
|
||||
break
|
||||
|
||||
@ -56,10 +67,6 @@ const SpotifyMiddleware = (function(){
|
||||
next(action)
|
||||
break
|
||||
|
||||
case 'SPOTIFY_CONNECT':
|
||||
store.dispatch( spotifyActions.getMe() )
|
||||
break
|
||||
|
||||
case 'SPOTIFY_CREATE_PLAYLIST':
|
||||
if( !store.getState().spotify.authorized ){
|
||||
store.dispatch( uiActions.createNotification( "Must be logged in to Spotify to do that", 'bad' ) )
|
||||
|
||||
@ -3,7 +3,6 @@ import ReactGA from 'react-ga'
|
||||
|
||||
var uiActions = require('./actions.js')
|
||||
var mopidyActions = require('../mopidy/actions.js')
|
||||
var spotifyActions = require('../spotify/actions.js')
|
||||
var helpers = require('../../helpers.js')
|
||||
|
||||
const UIMiddleware = (function(){
|
||||
|
||||
Reference in New Issue
Block a user