Version 1.4 - Translations, Like toasts Queue redesign.

This commit is contained in:
2026-04-09 16:54:41 +02:00
parent ec1ffcb0b1
commit 5f3902cb54
30 changed files with 3472 additions and 654 deletions
@@ -10,9 +10,12 @@ import SwiftUI
/// Reusable heart button for toggling favorites on artists, albums, and tracks.
struct FavoriteButton: View {
@Environment(MAService.self) private var service
@Environment(MAToastManager.self) private var toastManager
let uri: String
var size: CGFloat = 22
var showInLight: Bool = false
/// Display name shown in the toast when the item is liked. Pass nil to suppress the toast.
var itemName: String? = nil
private var isFavorite: Bool {
service.libraryManager.isFavorite(uri: uri)
@@ -20,11 +23,19 @@ struct FavoriteButton: View {
var body: some View {
Button {
let wasAlreadyFavorite = isFavorite
Task {
await service.libraryManager.toggleFavorite(
uri: uri,
currentlyFavorite: isFavorite
currentlyFavorite: wasAlreadyFavorite
)
if let name = itemName {
if wasAlreadyFavorite {
toastManager.show(name, icon: "heart.slash", iconColor: .secondary)
} else {
toastManager.show(name, icon: "heart.fill", iconColor: .red)
}
}
}
} label: {
Image(systemName: isFavorite ? "heart.fill" : "heart")