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() { func connect() {
App.store.dispatch( App.store.dispatch(MPDConnectAction())
MPDConnectAction(
host: App.store.state.preferencesState.mpdServer.hostOrDefault,
port: App.store.state.preferencesState.mpdServer.portOrDefault
)
)
} }
func disconnect() { func disconnect() {

View File

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

View File

@ -12,8 +12,12 @@ func mpdReducer(action: Action, state: MPDState?) -> MPDState {
let state = state ?? MPDState() let state = state ?? MPDState()
switch action { switch action {
case let action as MPDConnectAction: case is MPDConnectAction:
App.mpdClient.connect(host: action.host, port: action.port) let mpdServer = App.store.state.preferencesState.mpdServer
App.mpdClient.connect(
host: mpdServer.hostOrDefault,
port: mpdServer.portOrDefault
)
case is MPDDisconnectAction: case is MPDDisconnectAction:
App.mpdClient.disconnect() App.mpdClient.disconnect()