damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 209b23674d0a668304fc9b6a6c1f2255c993ba59
parent 02fc065005738abbc84fe8102a48a0e0903f8624
Author: Swift <scoder1747@gmail.com>
Date:   Sat, 15 Apr 2023 18:14:07 -0400

Add ability to copy url from post media previews

Diffstat:
Mdamus/ContentView.swift | 4++--
Mdamus/Views/PostView.swift | 11++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -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 } diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift @@ -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 {