Media: Cleanup unused context menu

This commit is contained in:
Thomas Ricouard 2023-02-28 08:09:13 +01:00
parent f93e4063f2
commit 23fe7d3373

View File

@ -6,7 +6,6 @@ import NukeUI
import SwiftUI
public struct StatusRowMediaPreviewView: View {
@Environment(\.openURL) private var openURL
@Environment(\.isSecondaryColumn) private var isSecondaryColumn: Bool
@Environment(\.extraLeadingInset) private var extraLeadingInset: CGFloat
@Environment(\.isInCaptureMode) private var isInCaptureMode: Bool
@ -91,9 +90,6 @@ public struct StatusRowMediaPreviewView: View {
await quickLook.prepareFor(urls: attachments.compactMap { $0.url }, selectedURL: attachment.url!)
}
}
.contextMenu {
contextMenuForMedia(mediaAttachement: attachment)
}
} else {
if isNotifications || theme.statusDisplayStyle == .compact {
HStack {
@ -272,9 +268,6 @@ public struct StatusRowMediaPreviewView: View {
await quickLook.prepareFor(urls: attachments.compactMap { $0.url }, selectedURL: attachment.url!)
}
}
.contextMenu {
contextMenuForMedia(mediaAttachement: attachment)
}
}
}
@ -333,37 +326,4 @@ public struct StatusRowMediaPreviewView: View {
Spacer()
}
}
@ViewBuilder
private func contextMenuForMedia(mediaAttachement: MediaAttachment) -> some View {
if let url = mediaAttachement.url {
ShareLink(item: url) {
Label("status.media.contextmenu.share", systemImage: "square.and.arrow.up")
}
Button { openURL(url) } label: {
Label("status.media.contextmenu.view-browser", systemImage: "safari")
}
Divider()
Button {
Task {
do {
let image = try await ImagePipeline.shared.image(for: url).image
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
} catch {}
}
} label: {
Label("status.media.contextmenu.save", systemImage: "square.and.arrow.down")
}
Button {
Task {
do {
let image = try await ImagePipeline.shared.image(for: url).image
UIPasteboard.general.image = image
} catch {}
}
} label: {
Label("status.media.contextmenu.copy", systemImage: "doc.on.doc")
}
}
}
}