Yandex Music client for Apple TV
tvOS 17+ SwiftUI client for the unofficial Yandex Music API: rotor stations with feedback, library, search, artist and album pages, synced lyrics, and system Now Playing integration.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct YaMusekApp: App {
|
||||
@StateObject private var state = AppState()
|
||||
@StateObject private var player = PlayerController.shared
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
Group {
|
||||
// The API client only learns the token inside boot(), so nothing
|
||||
// that makes requests may appear before it finishes.
|
||||
if state.isBooting {
|
||||
SplashView()
|
||||
} else if state.isAuthorized {
|
||||
RootView()
|
||||
} else {
|
||||
LoginView()
|
||||
}
|
||||
}
|
||||
.environmentObject(state)
|
||||
.environmentObject(player)
|
||||
.preferredColorScheme(.dark)
|
||||
.task { await state.boot() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SplashView: View {
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
VStack(spacing: 24) {
|
||||
Text("YaMusek")
|
||||
.font(.system(size: 72, weight: .heavy, design: .rounded))
|
||||
.foregroundStyle(Color.ymAccent)
|
||||
ProgressView()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user