diff --git a/IceCubesApp/App/AppRouteur.swift b/IceCubesApp/App/AppRouteur.swift index 92c4391d..c4b02b11 100644 --- a/IceCubesApp/App/AppRouteur.swift +++ b/IceCubesApp/App/AppRouteur.swift @@ -24,8 +24,8 @@ extension View { func withSheetDestinations(sheetDestinations: Binding) -> some View { self.sheet(item: sheetDestinations) { destination in switch destination { - case let .imageDetail(url): - ImageSheetView(url: url) + default: + EmptyView() } } } diff --git a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift index 2c0e3b6d..07bc49d1 100644 --- a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift +++ b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift @@ -4,6 +4,7 @@ import DesignSystem import Env struct AccountDetailHeaderView: View { + @EnvironmentObject private var quickLook: QuickLook @EnvironmentObject private var routeurPath: RouterPath @Environment(\.redactionReasons) private var reasons @@ -57,7 +58,9 @@ struct AccountDetailHeaderView: View { .offset(y: scrollOffset > 0 ? -scrollOffset : 0) .contentShape(Rectangle()) .onTapGesture { - routeurPath.presentedSheet = .imageDetail(url: account.header) + Task { + await quickLook.prepareFor(urls: [account.header], selectedURL: account.header) + } } } @@ -82,7 +85,9 @@ struct AccountDetailHeaderView: View { ) .contentShape(Rectangle()) .onTapGesture { - routeurPath.presentedSheet = .imageDetail(url: account.avatar) + Task { + await quickLook.prepareFor(urls: [account.avatar], selectedURL: account.avatar) + } } Spacer() Group { diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/ImageSheetView.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/ImageSheetView.swift deleted file mode 100644 index eb841761..00000000 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/ImageSheetView.swift +++ /dev/null @@ -1,22 +0,0 @@ -import SwiftUI - -public struct ImageSheetView: View { - let url: URL - - public init(url: URL) { - self.url = url - } - - public var body: some View { - AsyncImage( - url: url, - content: { image in - image.resizable() - .aspectRatio(contentMode: .fit) - }, - placeholder: { - ProgressView() - } - ) - } -} diff --git a/Packages/Env/Sources/Env/Routeur.swift b/Packages/Env/Sources/Env/Routeur.swift index f431573f..9ca7efaf 100644 --- a/Packages/Env/Sources/Env/Routeur.swift +++ b/Packages/Env/Sources/Env/Routeur.swift @@ -12,12 +12,10 @@ public enum RouteurDestinations: Hashable { public enum SheetDestinations: Identifiable { public var id: String { switch self { - case .imageDetail: - return "imageDetail" + default: + break } } - - case imageDetail(url: URL) } public class RouterPath: ObservableObject {