mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
We don't need to pass these since the store knows
This commit is contained in:
parent
8bab7c2bf5
commit
96bb9679ab
@ -17,12 +17,7 @@ class MPDServerController {
|
||||
}
|
||||
|
||||
func connect() {
|
||||
App.store.dispatch(
|
||||
MPDConnectAction(
|
||||
host: App.store.state.preferencesState.mpdServer.hostOrDefault,
|
||||
port: App.store.state.preferencesState.mpdServer.portOrDefault
|
||||
)
|
||||
)
|
||||
App.store.dispatch(MPDConnectAction())
|
||||
}
|
||||
|
||||
func disconnect() {
|
||||
|
||||
@ -8,10 +8,7 @@
|
||||
|
||||
import ReSwift
|
||||
|
||||
struct MPDConnectAction: Action {
|
||||
let host: String
|
||||
let port: Int
|
||||
}
|
||||
struct MPDConnectAction: Action {}
|
||||
struct MPDDisconnectAction: Action {}
|
||||
|
||||
struct MPDPlayPauseAction: Action {}
|
||||
|
||||
@ -12,8 +12,12 @@ func mpdReducer(action: Action, state: MPDState?) -> MPDState {
|
||||
let state = state ?? MPDState()
|
||||
|
||||
switch action {
|
||||
case let action as MPDConnectAction:
|
||||
App.mpdClient.connect(host: action.host, port: action.port)
|
||||
case is MPDConnectAction:
|
||||
let mpdServer = App.store.state.preferencesState.mpdServer
|
||||
App.mpdClient.connect(
|
||||
host: mpdServer.hostOrDefault,
|
||||
port: mpdServer.portOrDefault
|
||||
)
|
||||
case is MPDDisconnectAction:
|
||||
App.mpdClient.disconnect()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user