Update from NavidromePlayer.zip (2026-04-03 19:27)
This commit is contained in:
parent
cab5273310
commit
51714946d8
1 changed files with 40 additions and 1 deletions
|
|
@ -266,7 +266,7 @@ struct WatchAlbumsView: View {
|
|||
List(albums) { album in
|
||||
NavigationLink(destination: WatchAlbumDetailView(albumId: album.id)) {
|
||||
HStack(spacing: 8) {
|
||||
AsyncCoverArt(coverArtId: album.coverArt, size: 40)
|
||||
WatchCoverArt(coverArtId: album.coverArt, size: 36)
|
||||
.frame(width: 36, height: 36).cornerRadius(4)
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text(album.name).font(.caption).foregroundColor(.white).lineLimit(1)
|
||||
|
|
@ -724,3 +724,42 @@ struct WatchSettingsView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Watch Cover Art (lightweight async image for watchOS)
|
||||
|
||||
struct WatchCoverArt: View {
|
||||
let coverArtId: String?
|
||||
let size: CGFloat
|
||||
|
||||
@State private var image: UIImage?
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if let img = image {
|
||||
Image(uiImage: img)
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
} else {
|
||||
ZStack {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.fill(Color(white: 0.2))
|
||||
Image(systemName: "music.note")
|
||||
.font(.system(size: max(8, size * 0.3)))
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: size, height: size)
|
||||
.cornerRadius(4)
|
||||
.task {
|
||||
guard let id = coverArtId,
|
||||
let url = WatchSessionManager.shared.coverArtURL(id: id, size: Int(size) * 2) else { return }
|
||||
do {
|
||||
let (data, _) = try await URLSession.shared.data(from: url)
|
||||
if let img = UIImage(data: data) {
|
||||
await MainActor.run { image = img }
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue