Search settings; Search action now uiAction
This commit is contained in:
@ -29,10 +29,12 @@ export function hideTouchContextMenu(){
|
||||
}
|
||||
}
|
||||
|
||||
export function startSearch( query ){
|
||||
export function startSearch(search_type, query, only_mopidy = false){
|
||||
return {
|
||||
type: 'SEARCH_STARTED',
|
||||
query: query
|
||||
search_type: search_type,
|
||||
query: query,
|
||||
only_mopidy: only_mopidy
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,26 @@ const UIMiddleware = (function(){
|
||||
break
|
||||
|
||||
case 'SEARCH_STARTED':
|
||||
ReactGA.event({ category: 'Search', action: 'Started', label: action.query })
|
||||
ReactGA.event({ category: 'Search', action: 'Started', label: action.type+': '+action.query })
|
||||
var state = store.getState()
|
||||
|
||||
// initiate spotify searching
|
||||
if (!action.only_mopidy){
|
||||
if (!state.ui.search_settings || state.ui.search_settings.spotify){
|
||||
store.dispatch(spotifyActions.getSearchResults(action.query))
|
||||
}
|
||||
}
|
||||
|
||||
// backend searching (mopidy)
|
||||
if (state.mopidy.connected){
|
||||
if (state.ui.search_settings){
|
||||
var uri_schemes = state.ui.search_settings.uri_schemes
|
||||
} else {
|
||||
var uri_schemes = state.mopidy.uri_schemes
|
||||
}
|
||||
store.dispatch(mopidyActions.getSearchResults(action.query, uri_schemes))
|
||||
}
|
||||
|
||||
next(action)
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user