From 5acbd55b416cfa80f43f8ee8397192c610788754 Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Tue, 19 Dec 2023 02:14:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E9=AB=98=E5=9B=BE=E7=89=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=B8=85=E6=99=B0=E5=BA=A6=20(#40)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update VideoDetailView.swift * Update VideoDetailView.swift * Update VideoDetailView.swift --- .../Video/VideoDetailView.swift | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/DarockBili Watch App/Video/VideoDetailView.swift b/DarockBili Watch App/Video/VideoDetailView.swift index 351474ded..218551ac3 100644 --- a/DarockBili Watch App/Video/VideoDetailView.swift +++ b/DarockBili Watch App/Video/VideoDetailView.swift @@ -408,40 +408,23 @@ struct VideoDetailView: View { var body: some View { VStack { Spacer() - CachedAsyncImage(url: URL(string: videoDetails["Pic"]! + "@240w_160h")) { phase in - switch phase { - case .empty: - Image("Placeholder") - .fixedSize() - .frame(width: 120, height: 80) - .redacted(reason: .placeholder) - case .success(let image): - image - .resizable() - .fixedSize() - .frame(width: 120, height: 80) - case .failure(let error): - Image("Placeholder") - .fixedSize() - .frame(width: 120, height: 80) - .redacted(reason: .placeholder) - .onAppear { - debugPrint(error) - } - @unknown default: - Image("Placeholder") - .fixedSize() + WebImage(url: URL(string: videoDetails["Pic"]! + "@240w_160h")!, options: [.progressiveLoad, .scaleDownLargeImages]) + .placeholder { + RoundedRectangle(cornerRadius: 14) .frame(width: 120, height: 80) + .foregroundColor(Color(hex: 0x3D3D3D)) .redacted(reason: .placeholder) } - } - .cornerRadius(5) - .shadow(color: .black.opacity(0.5), radius: 5, x: 1, y: 2) - .offset(y: 8) - .sheet(isPresented: $isCoverImageViewPresented, content: {ImageViewerView(url: videoDetails["Pic"]!)}) - .onTapGesture { - isCoverImageViewPresented = true - } + .resizable() + .scaledToFit() + .frame(width: 120, height: 80) + .cornerRadius(14) + .shadow(color: .black.opacity(0.5), radius: 5, x: 1, y: 2) + .offset(y: 8) + .sheet(isPresented: $isCoverImageViewPresented, content: {ImageViewerView(url: videoDetails["Pic"]!)}) + .onTapGesture { + isCoverImageViewPresented = true + } Spacer() .frame(height: 20) HStack { @@ -766,7 +749,7 @@ struct VideoDetailView: View { Text(publishTime) Spacer() } - .offset(x: -1, y: publishTimeTextOffset) + .offset(y: publishTimeTextOffset) .animation(.easeOut(duration: 0.85), value: publishTimeTextOffset) .onAppear { publishTimeTextOffset = 0