feat(*): subsonic client with avfoundation playback and apple music ui
This commit is contained in:
commit
e5bb559d7f
93 files changed
+7517
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import Domain
|
||||
import Observation
|
||||
|
||||
enum AppTab: Hashable {
|
||||
case home, radio, library, search
|
||||
}
|
||||
|
||||
enum LibrarySection: Hashable, CaseIterable {
|
||||
case playlists, artists, albums, songs, genres
|
||||
}
|
||||
|
||||
enum Route: Hashable {
|
||||
case album(EntityID)
|
||||
case artist(EntityID)
|
||||
case playlist(EntityID)
|
||||
case genre(String)
|
||||
case favorites
|
||||
case section(LibrarySection)
|
||||
}
|
||||
|
||||
@Observable
|
||||
final class Router {
|
||||
var tab: AppTab = .home
|
||||
var paths: [AppTab: [Route]] = [:]
|
||||
var showsNowPlaying = false
|
||||
var showsQueue = false {
|
||||
didSet {
|
||||
if showsQueue {
|
||||
showsLyrics = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var showsLyrics = false {
|
||||
didSet {
|
||||
if showsLyrics {
|
||||
showsQueue = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func path(for tab: AppTab) -> [Route] {
|
||||
paths[tab] ?? []
|
||||
}
|
||||
|
||||
func open(_ route: Route) {
|
||||
showsNowPlaying = false
|
||||
paths[tab, default: []].append(route)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user