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 {
self.sheet(item: sheetDestinations) { destination in
switch destination {
case let .imageDetail(url):
ImageSheetView(url: url)
default:
EmptyView()
}
}
}

View file

@ -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 {

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 var id: String {
switch self {
case .imageDetail:
return "imageDetail"
default:
break
}
}
case imageDetail(url: URL)
}
public class RouterPath: ObservableObject {