1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
persephone/Persephone/Controllers/NotificationsController.swift
2019-05-01 19:48:09 -04:00

56 lines
1.4 KiB
Swift

//
// NotificationsController.swift
// Persephone
//
// Created by Daniel Barber on 2019/2/02.
// Copyright © 2019 Dan Barber. All rights reserved.
//
import Foundation
class NotificationsController: MPDClientDelegate {
func didConnect(mpdClient: MPDClient) {}
func willDisconnect(mpdClient: MPDClient) {
DispatchQueue.main.async {
App.store.dispatch(UpdateAlbumListAction(albums: []))
}
}
func didUpdateStatus(mpdClient: MPDClient, status: MPDClient.MPDStatus) {
DispatchQueue.main.async {
App.store.dispatch(UpdateStatusAction(status: status))
}
}
func willStartDatabaseUpdate(mpdClient: MPDClient) {
DispatchQueue.main.async {
App.store.dispatch(StartedDatabaseUpdateAction())
}
}
func didFinishDatabaseUpdate(mpdClient: MPDClient) {
DispatchQueue.main.async {
App.store.dispatch(FinishedDatabaseUpdateAction())
}
}
func didUpdateQueue(mpdClient: MPDClient, queue: [MPDClient.MPDSong]) {
DispatchQueue.main.async {
App.store.dispatch(UpdateQueueAction(queue: queue))
}
}
func didUpdateQueuePos(mpdClient: MPDClient, song: Int) {
DispatchQueue.main.async {
App.store.dispatch(UpdateQueuePosAction(queuePos: song))
}
}
func didLoadAlbums(mpdClient: MPDClient, albums: [MPDClient.MPDAlbum]) {
DispatchQueue.main.async {
App.store.dispatch(UpdateAlbumListAction(albums: albums))
}
}
}