Version 1.1 App Store

This commit is contained in:
Scarriffle
2026-05-25 10:21:11 +02:00
parent 7ca511d37f
commit 15d8e71d09
17 changed files with 478 additions and 71 deletions

View File

@@ -45,17 +45,44 @@ struct LibraryItemCell: View {
#if os(iOS)
private var iOSCover: some View {
Color(.systemGray6) // neutral bg for PNG transparent areas
.frame(maxWidth: .infinity) // explicitly fill the column width
coverContainer(background: AnyShapeStyle(Color(.systemGray6)))
}
#endif
#if os(macOS)
private var macosCover: some View {
coverContainer(background: AnyShapeStyle(.quaternary))
}
#endif
/// Quadratischer Cover-Container: füllt die Spaltenbreite, behält 1:1-Aspektverhältnis
/// und zeigt das Bild **ohne Verzerrung** (`.scaledToFit`). Nicht-quadratische Cover
/// bekommen Letterbox-/Pillarbox-Ränder im neutralen Hintergrund.
private func coverContainer(background: AnyShapeStyle) -> some View {
Rectangle()
.fill(background)
.frame(maxWidth: .infinity)
.aspectRatio(1, contentMode: .fit)
.overlay {
if let url = app.client.coverURL(itemId: item.id) {
AsyncImage(url: url) { image in
image.resizable().scaledToFill()
} placeholder: {
ProgressView().tint(.accentColor)
AsyncImage(url: url) { phase in
switch phase {
case .success(let img):
img.resizable().scaledToFit()
case .empty:
ProgressView()
#if os(macOS)
.controlSize(.small)
#else
.tint(.accentColor)
#endif
case .failure:
Image(systemName: "book.closed")
.foregroundStyle(.secondary)
@unknown default:
EmptyView()
}
}
.clipped() // clip image overflow before rounding
} else {
Image(systemName: "book.closed")
.foregroundStyle(.secondary)
@@ -63,34 +90,6 @@ struct LibraryItemCell: View {
}
.clipShape(RoundedRectangle(cornerRadius: 8))
}
#endif
#if os(macOS)
private var macosCover: some View {
Group {
if let url = app.client.coverURL(itemId: item.id) {
AsyncImage(url: url) { phase in
switch phase {
case .empty:
Rectangle().fill(.quaternary)
.overlay(ProgressView().controlSize(.small))
case .success(let img):
img.resizable().aspectRatio(contentMode: .fill)
case .failure:
Rectangle().fill(.quaternary)
.overlay(Image(systemName: "book.closed").foregroundStyle(.secondary))
@unknown default:
Rectangle().fill(.quaternary)
}
}
} else {
Rectangle().fill(.quaternary)
}
}
.frame(width: 180, height: 180)
.clipShape(RoundedRectangle(cornerRadius: 8))
}
#endif
// MARK: - Download badge