Revert "Add menu ellipsis button to notes"
This reverts commit 390c9162ae.
This commit is contained in:
@@ -24,7 +24,7 @@ struct ChatroomView: View {
|
|||||||
next_ev: ind == count-1 ? nil : thread.events[ind+1],
|
next_ev: ind == count-1 ? nil : thread.events[ind+1],
|
||||||
damus_state: damus
|
damus_state: damus
|
||||||
)
|
)
|
||||||
.contextMenu{MenuItems(event: ev, keypair: damus.keypair, target_pubkey: ev.pubkey)}
|
.event_context_menu(ev, keypair: damus.keypair, target_pubkey: ev.pubkey)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if thread.initial_event.id == ev.id {
|
if thread.initial_event.id == ev.id {
|
||||||
//dismiss()
|
//dismiss()
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ struct DMChatView: View {
|
|||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
ForEach(Array(zip(dms.events, dms.events.indices)), id: \.0.id) { (ev, ind) in
|
ForEach(Array(zip(dms.events, dms.events.indices)), id: \.0.id) { (ev, ind) in
|
||||||
DMView(event: dms.events[ind], damus_state: damus_state)
|
DMView(event: dms.events[ind], damus_state: damus_state)
|
||||||
.contextMenu{MenuItems(event: ev, keypair: damus_state.keypair, target_pubkey: ev.pubkey)}
|
.event_context_menu(ev, keypair: damus_state.keypair, target_pubkey: ev.pubkey)
|
||||||
}
|
}
|
||||||
EndBlock(height: 80)
|
EndBlock(height: 80)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,20 +18,12 @@ struct EmbeddedEventView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
let profile = damus_state.profiles.lookup(id: pubkey)
|
let profile = damus_state.profiles.lookup(id: pubkey)
|
||||||
HStack {
|
|
||||||
EventProfile(damus_state: damus_state, pubkey: pubkey, profile: profile, size: .small)
|
EventProfile(damus_state: damus_state, pubkey: pubkey, profile: profile, size: .small)
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
EventMenuContext(event: event, keypair: damus_state.keypair, target_pubkey: event.pubkey)
|
|
||||||
.padding([.bottom], 4)
|
|
||||||
|
|
||||||
}
|
|
||||||
.minimumScaleFactor(0.75)
|
|
||||||
.lineLimit(1)
|
|
||||||
|
|
||||||
EventBody(damus_state: damus_state, event: event, size: .small)
|
EventBody(damus_state: damus_state, event: event, size: .small)
|
||||||
}
|
}
|
||||||
|
.event_context_menu(event, keypair: damus_state.keypair, target_pubkey: pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,73 +13,50 @@ struct EventMenuContext: View {
|
|||||||
let target_pubkey: String
|
let target_pubkey: String
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack {
|
|
||||||
Menu {
|
|
||||||
|
|
||||||
MenuItems(event: event, keypair: keypair, target_pubkey: target_pubkey)
|
|
||||||
|
|
||||||
} label: {
|
|
||||||
Label(NSLocalizedString("", comment: "Context menu"), systemImage: "ellipsis")
|
|
||||||
.foregroundColor(Color.gray)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.contentShape(Rectangle())
|
|
||||||
.onTapGesture {}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MenuItems: View {
|
|
||||||
let event: NostrEvent
|
|
||||||
let keypair: Keypair
|
|
||||||
let target_pubkey: String
|
|
||||||
|
|
||||||
var body: some View {
|
Button {
|
||||||
Group {
|
UIPasteboard.general.string = event.get_content(keypair.privkey)
|
||||||
Button {
|
} label: {
|
||||||
UIPasteboard.general.string = event.get_content(keypair.privkey)
|
Label(NSLocalizedString("Copy Text", comment: "Context menu option for copying the text from an note."), systemImage: "doc.on.doc")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
UIPasteboard.general.string = bech32_pubkey(target_pubkey)
|
||||||
|
} label: {
|
||||||
|
Label(NSLocalizedString("Copy User Pubkey", comment: "Context menu option for copying the ID of the user who created the note."), systemImage: "person")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
UIPasteboard.general.string = bech32_note_id(event.id) ?? event.id
|
||||||
|
} label: {
|
||||||
|
Label(NSLocalizedString("Copy Note ID", comment: "Context menu option for copying the ID of the note."), systemImage: "note.text")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
UIPasteboard.general.string = event_to_json(ev: event)
|
||||||
|
} label: {
|
||||||
|
Label(NSLocalizedString("Copy Note JSON", comment: "Context menu option for copying the JSON text from the note."), systemImage: "square.on.square")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
NotificationCenter.default.post(name: .broadcast_event, object: event)
|
||||||
|
} label: {
|
||||||
|
Label(NSLocalizedString("Broadcast", comment: "Context menu option for broadcasting the user's note to all of the user's connected relay servers."), systemImage: "globe")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only allow reporting if logged in with private key and the currently viewed profile is not the logged in profile.
|
||||||
|
if keypair.pubkey != target_pubkey && keypair.privkey != nil {
|
||||||
|
Button(role: .destructive) {
|
||||||
|
let target: ReportTarget = .note(ReportNoteTarget(pubkey: target_pubkey, note_id: event.id))
|
||||||
|
notify(.report, target)
|
||||||
} label: {
|
} label: {
|
||||||
Label(NSLocalizedString("Copy Text", comment: "Context menu option for copying the text from an note."), systemImage: "doc.on.doc")
|
Label(NSLocalizedString("Report", comment: "Context menu option for reporting content."), systemImage: "exclamationmark.bubble")
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button(role: .destructive) {
|
||||||
UIPasteboard.general.string = bech32_pubkey(target_pubkey)
|
notify(.block, target_pubkey)
|
||||||
} label: {
|
} label: {
|
||||||
Label(NSLocalizedString("Copy User Pubkey", comment: "Context menu option for copying the ID of the user who created the note."), systemImage: "person")
|
Label(NSLocalizedString("Block", comment: "Context menu option for blocking users."), systemImage: "exclamationmark.octagon")
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
UIPasteboard.general.string = bech32_note_id(event.id) ?? event.id
|
|
||||||
} label: {
|
|
||||||
Label(NSLocalizedString("Copy Note ID", comment: "Context menu option for copying the ID of the note."), systemImage: "note.text")
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
UIPasteboard.general.string = event_to_json(ev: event)
|
|
||||||
} label: {
|
|
||||||
Label(NSLocalizedString("Copy Note JSON", comment: "Context menu option for copying the JSON text from the note."), systemImage: "square.on.square")
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
NotificationCenter.default.post(name: .broadcast_event, object: event)
|
|
||||||
} label: {
|
|
||||||
Label(NSLocalizedString("Broadcast", comment: "Context menu option for broadcasting the user's note to all of the user's connected relay servers."), systemImage: "globe")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only allow reporting if logged in with private key and the currently viewed profile is not the logged in profile.
|
|
||||||
if keypair.pubkey != target_pubkey && keypair.privkey != nil {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
let target: ReportTarget = .note(ReportNoteTarget(pubkey: target_pubkey, note_id: event.id))
|
|
||||||
notify(.report, target)
|
|
||||||
} label: {
|
|
||||||
Label(NSLocalizedString("Report", comment: "Context menu option for reporting content."), systemImage: "exclamationmark.bubble")
|
|
||||||
}
|
|
||||||
|
|
||||||
Button(role: .destructive) {
|
|
||||||
notify(.block, target_pubkey)
|
|
||||||
} label: {
|
|
||||||
Label(NSLocalizedString("Block", comment: "Context menu option for blocking users."), systemImage: "exclamationmark.octagon")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,18 +28,7 @@ struct SelectedEventView: View {
|
|||||||
let profile = damus.profiles.lookup(id: pubkey)
|
let profile = damus.profiles.lookup(id: pubkey)
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
HStack {
|
EventProfile(damus_state: damus, pubkey: pubkey, profile: profile, size: .normal)
|
||||||
EventProfile(damus_state: damus, pubkey: pubkey, profile: profile, size: .normal)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
EventMenuContext(event: event, keypair: damus.keypair, target_pubkey: event.pubkey)
|
|
||||||
.padding([.bottom], 4)
|
|
||||||
|
|
||||||
}
|
|
||||||
.minimumScaleFactor(0.75)
|
|
||||||
.lineLimit(1)
|
|
||||||
|
|
||||||
EventBody(damus_state: damus, event: event, size: .selected)
|
EventBody(damus_state: damus, event: event, size: .selected)
|
||||||
|
|
||||||
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
||||||
@@ -71,6 +60,7 @@ struct SelectedEventView: View {
|
|||||||
self.bar.update(damus: self.damus, evid: target)
|
self.bar.update(damus: self.damus, evid: target)
|
||||||
}
|
}
|
||||||
.padding([.leading], 2)
|
.padding([.leading], 2)
|
||||||
|
.event_context_menu(event, keypair: damus.keypair, target_pubkey: event.pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,7 @@ struct TextEvent: View {
|
|||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
EventMenuContext(event: event, keypair: damus.keypair, target_pubkey: event.pubkey)
|
|
||||||
.padding([.bottom], 4)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.minimumScaleFactor(0.75)
|
|
||||||
.lineLimit(1)
|
|
||||||
|
|
||||||
EventBody(damus_state: damus, event: event, size: .normal)
|
EventBody(damus_state: damus, event: event, size: .normal)
|
||||||
|
|
||||||
@@ -65,6 +59,7 @@ struct TextEvent: View {
|
|||||||
.id(event.id)
|
.id(event.id)
|
||||||
.frame(maxWidth: .infinity, minHeight: PFP_SIZE)
|
.frame(maxWidth: .infinity, minHeight: PFP_SIZE)
|
||||||
.padding([.bottom], 2)
|
.padding([.bottom], 2)
|
||||||
|
.event_context_menu(event, keypair: damus.keypair, target_pubkey: pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user