diff --git a/Nostur/LiveEvents/LiveEventDetail.swift b/Nostur/LiveEvents/LiveEventDetail.swift index 21f797fa..2362dd8b 100644 --- a/Nostur/LiveEvents/LiveEventDetail.swift +++ b/Nostur/LiveEvents/LiveEventDetail.swift @@ -305,6 +305,19 @@ struct LiveEventDetail: View { .lineLimit(1) .truncationMode(.tail) .frame(maxWidth: 140) + .toolbar { + ToolbarItem(placement: .topBarTrailing) { + Button("Share", systemImage: "square.and.arrow.up") { + if !IS_CATALYST && !IS_IPAD { + LiveKitVoiceSession.shared.visibleNest = nil + } + NRState.shared.draft = "\(liveEvent.title ?? "Join") 👇\n\n" + "nostr:" + roomAddress + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + sendNotification(.newTemplatePost) + } + } + } + } } #if DEBUG Text("copy event json") diff --git a/Nostur/Localizable.xcstrings b/Nostur/Localizable.xcstrings index eeb81930..ebd117c0 100644 --- a/Nostur/Localizable.xcstrings +++ b/Nostur/Localizable.xcstrings @@ -6923,6 +6923,9 @@ } } } + }, + "Share" : { + }, "Share highlight" : { "comment" : "Navigation title for screen to Share a Highlighted Text", diff --git a/Nostur/Screens/MainView.swift b/Nostur/Screens/MainView.swift index 6a0151ca..28c7cb5d 100644 --- a/Nostur/Screens/MainView.swift +++ b/Nostur/Screens/MainView.swift @@ -162,6 +162,10 @@ struct MainView: View { UserDefaults.standard.setValue("Following", forKey: "selected_subtab") } } + .onReceive(receiveNotification(.newTemplatePost)) { _ in + // Note: use NRState.shared.draft = ... + showingNewNote = true + } .onReceive(receiveNotification(.navigateTo)) { notification in let destination = notification.object as! NavigationDestination guard !IS_IPAD || horizontalSizeClass == .compact else { return } diff --git a/Nostur/Utils/Notifications.swift b/Nostur/Utils/Notifications.swift index 5ee61e05..3add2126 100644 --- a/Nostur/Utils/Notifications.swift +++ b/Nostur/Utils/Notifications.swift @@ -385,4 +385,8 @@ extension Notification.Name { static var hideCreateNestsSheet: Notification.Name { return Notification.Name("hideCreateNestsSheet") } + + static var newTemplatePost: Notification.Name { + return Notification.Name("newTemplatePost") + } }