Add on tap gesture to blurhash images.
This commit is contained in:
parent
f8b996dae9
commit
c0566e5ec9
|
@ -92,7 +92,7 @@ struct HomeFeedView: View {
|
|||
self.calculateOpacity(offset: offset)
|
||||
}
|
||||
|
||||
self.newPahotosView()
|
||||
self.newPhotosView()
|
||||
.offset(y: self.offset)
|
||||
.opacity(self.opacity)
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ struct HomeFeedView: View {
|
|||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func newPahotosView() -> some View {
|
||||
private func newPhotosView() -> some View {
|
||||
VStack(alignment: .trailing, spacing: 4) {
|
||||
HStack {
|
||||
Image(systemName: "arrow.up")
|
||||
|
|
|
@ -50,7 +50,9 @@ struct ImageRow: View {
|
|||
Image(uiImage: uiImage)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.transition(.opacity)
|
||||
.onTapGesture{
|
||||
self.navigateToStatus()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ZStack {
|
||||
|
@ -58,13 +60,7 @@ struct ImageRow: View {
|
|||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.onTapGesture{
|
||||
self.routerPath.navigate(to: .status(
|
||||
id: status.rebloggedStatusId ?? status.id,
|
||||
blurhash: status.attachments().first?.blurhash,
|
||||
highestImageUrl: status.attachments().getHighestImage()?.url,
|
||||
metaImageWidth: status.attachments().first?.metaImageWidth,
|
||||
metaImageHeight: status.attachments().first?.metaImageHeight
|
||||
))
|
||||
self.navigateToStatus()
|
||||
}
|
||||
.onLongPressGesture(minimumDuration: 0.2) {
|
||||
Task {
|
||||
|
@ -110,6 +106,9 @@ struct ImageRow: View {
|
|||
} else {
|
||||
BlurredImage(blurhash: attachmentData.blurhash)
|
||||
.frame(width: self.imageWidth, height: self.imageHeight)
|
||||
.onTapGesture{
|
||||
self.navigateToStatus()
|
||||
}
|
||||
.task {
|
||||
await self.downloadImage(attachmentData: attachmentData)
|
||||
}
|
||||
|
@ -137,4 +136,14 @@ struct ImageRow: View {
|
|||
self.error = error
|
||||
}
|
||||
}
|
||||
|
||||
private func navigateToStatus() {
|
||||
self.routerPath.navigate(to: .status(
|
||||
id: status.rebloggedStatusId ?? status.id,
|
||||
blurhash: status.attachments().first?.blurhash,
|
||||
highestImageUrl: status.attachments().getHighestImage()?.url,
|
||||
metaImageWidth: status.attachments().first?.metaImageWidth,
|
||||
metaImageHeight: status.attachments().first?.metaImageHeight
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue