1
1
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:
Daniel Barber 2019-04-30 20:55:32 -04:00
parent 8bab7c2bf5
commit 96bb9679ab
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
3 changed files with 8 additions and 12 deletions

View File

@ -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() {

View File

@ -8,10 +8,7 @@
import ReSwift
struct MPDConnectAction: Action {
let host: String
let port: Int
}
struct MPDConnectAction: Action {}
struct MPDDisconnectAction: Action {}
struct MPDPlayPauseAction: Action {}

View File

@ -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()