mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
The app would crash when connection settings were changed. This refactors the connection logic to be consistent with the rest of the mpdclient command structure. This ultimately fixes the bug.
30 lines
598 B
Swift
30 lines
598 B
Swift
//
|
|
// MPDClient.swift
|
|
// Persephone
|
|
//
|
|
// Created by Daniel Barber on 2019/1/25.
|
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import mpdclient
|
|
|
|
class MPDClient {
|
|
var connectionOperation: BlockOperation!
|
|
|
|
var delegate: MPDClientDelegate?
|
|
|
|
var connection: OpaquePointer?
|
|
var isConnected: Bool = false
|
|
var isIdle: Bool = false
|
|
var status: MPDStatus?
|
|
var queue: [MPDSong] = []
|
|
|
|
let commandQueue = OperationQueue()
|
|
|
|
init(withDelegate delegate: MPDClientDelegate?) {
|
|
commandQueue.maxConcurrentOperationCount = 1
|
|
self.delegate = delegate
|
|
}
|
|
}
|