Create BearWave macOS radio-first app
This commit is contained in:
38
Sources/BearWaveCore/Models/PlaybackStatus.swift
Normal file
38
Sources/BearWaveCore/Models/PlaybackStatus.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
import Foundation
|
||||
|
||||
enum PlaybackStatus: Equatable {
|
||||
case stopped
|
||||
case connecting
|
||||
case buffering
|
||||
case playing
|
||||
case paused
|
||||
case failed(PlaybackError)
|
||||
|
||||
var isPlaying: Bool {
|
||||
self == .playing || self == .connecting || self == .buffering
|
||||
}
|
||||
|
||||
var title: String {
|
||||
switch self {
|
||||
case .stopped:
|
||||
String(localized: "Stopped")
|
||||
case .connecting:
|
||||
String(localized: "Connecting...")
|
||||
case .buffering:
|
||||
String(localized: "Buffering...")
|
||||
case .playing:
|
||||
String(localized: "Playing")
|
||||
case .paused:
|
||||
String(localized: "Paused")
|
||||
case let .failed(error):
|
||||
error.title
|
||||
}
|
||||
}
|
||||
|
||||
var detail: String? {
|
||||
if case let .failed(error) = self {
|
||||
return error.detail
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user