Add ability to copy url from post media previews

This commit is contained in:
Swift
2023-04-15 18:14:07 -04:00
committed by William Casarin
parent 02fc065005
commit 209b23674d
2 changed files with 12 additions and 3 deletions

View File

@@ -474,9 +474,9 @@ struct ContentView: View {
home.filter_muted()
}
.onReceive(handle_notify(.local_notification)) { notif in
let local = notif.object as! LossyLocalNotification
guard let damus_state else {
guard let local = notif.object as? LossyLocalNotification,
let damus_state else {
return
}

View File

@@ -362,9 +362,19 @@ struct PVImageCarouselView: View {
.frame(width: media.count == 1 ? deviceWidth*0.8 : 250, height: media.count == 1 ? 400 : 250)
.cornerRadius(10)
.padding()
.contextMenu {
if let uploadedURL = media.first(where: { $0.representingImage == image })?.uploadedURL {
Button(action: {
UIPasteboard.general.string = uploadedURL.absoluteString
}) {
Label("Copy URL", systemImage: "doc.on.doc")
}
}
}
Image(systemName: "xmark.circle.fill")
.foregroundColor(.white)
.padding(20)
.shadow(radius: 5)
.onTapGesture {
if let index = media.map({$0.representingImage}).firstIndex(of: image) {
media.remove(at: index)
@@ -378,7 +388,6 @@ struct PVImageCarouselView: View {
}
}
fileprivate func getImage(media: MediaUpload) -> UIImage {
var uiimage: UIImage = UIImage()
if media.is_image {