Retire SheetDestinations for now

This commit is contained in:
Thomas Ricouard 2022-12-22 10:56:24 +01:00
parent 1a85fa19f8
commit 66e314c2be
4 changed files with 11 additions and 30 deletions

View file

@ -24,8 +24,8 @@ extension View {
func withSheetDestinations(sheetDestinations: Binding<SheetDestinations?>) -> some View { func withSheetDestinations(sheetDestinations: Binding<SheetDestinations?>) -> some View {
self.sheet(item: sheetDestinations) { destination in self.sheet(item: sheetDestinations) { destination in
switch destination { switch destination {
case let .imageDetail(url): default:
ImageSheetView(url: url) EmptyView()
} }
} }
} }

View file

@ -4,6 +4,7 @@ import DesignSystem
import Env import Env
struct AccountDetailHeaderView: View { struct AccountDetailHeaderView: View {
@EnvironmentObject private var quickLook: QuickLook
@EnvironmentObject private var routeurPath: RouterPath @EnvironmentObject private var routeurPath: RouterPath
@Environment(\.redactionReasons) private var reasons @Environment(\.redactionReasons) private var reasons
@ -57,7 +58,9 @@ struct AccountDetailHeaderView: View {
.offset(y: scrollOffset > 0 ? -scrollOffset : 0) .offset(y: scrollOffset > 0 ? -scrollOffset : 0)
.contentShape(Rectangle()) .contentShape(Rectangle())
.onTapGesture { .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()) .contentShape(Rectangle())
.onTapGesture { .onTapGesture {
routeurPath.presentedSheet = .imageDetail(url: account.avatar) Task {
await quickLook.prepareFor(urls: [account.avatar], selectedURL: account.avatar)
}
} }
Spacer() Spacer()
Group { Group {

View file

@ -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()
}
)
}
}

View file

@ -12,12 +12,10 @@ public enum RouteurDestinations: Hashable {
public enum SheetDestinations: Identifiable { public enum SheetDestinations: Identifiable {
public var id: String { public var id: String {
switch self { switch self {
case .imageDetail: default:
return "imageDetail" break
} }
} }
case imageDetail(url: URL)
} }
public class RouterPath: ObservableObject { public class RouterPath: ObservableObject {