mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add redaction menu (disabled).
This commit is contained in:
@@ -23,6 +23,7 @@ enum TimelineItemContextMenuAction: Hashable {
|
||||
case copy
|
||||
case quote
|
||||
case copyPermalink
|
||||
case redact
|
||||
}
|
||||
|
||||
enum RoomScreenViewAction {
|
||||
|
||||
@@ -116,7 +116,16 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
return []
|
||||
}
|
||||
|
||||
return [.copy, .quote, .copyPermalink]
|
||||
let actions: [TimelineItemContextMenuAction] = [
|
||||
.copy, .quote, .copyPermalink
|
||||
]
|
||||
|
||||
#warning("Outgoing actions to be handled with the new Timeline API.")
|
||||
// if timelineItem.isOutgoing {
|
||||
// actions.append(.redact)
|
||||
// }
|
||||
|
||||
return actions
|
||||
}
|
||||
|
||||
private func processContentMenuAction(_ action: TimelineItemContextMenuAction, itemId: String) {
|
||||
@@ -137,6 +146,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
} catch {
|
||||
displayError(.alert(ElementL10n.roomTimelinePermalinkCreationFailure))
|
||||
}
|
||||
case .redact:
|
||||
redactItem(itemId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,4 +159,10 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
message: message)
|
||||
}
|
||||
}
|
||||
|
||||
private func redactItem(_ itemID: String) {
|
||||
Task {
|
||||
await timelineController.redactItem(itemID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,16 +25,20 @@ public struct TimelineItemContextMenu: View {
|
||||
ForEach(contextMenuActions, id: \.self) { item in
|
||||
switch item {
|
||||
case .copy:
|
||||
Button(ElementL10n.actionCopy) {
|
||||
callback(item)
|
||||
Button { callback(item) } label: {
|
||||
Label(ElementL10n.actionCopy, systemImage: "doc.on.doc")
|
||||
}
|
||||
case .quote:
|
||||
Button(ElementL10n.actionQuote) {
|
||||
callback(item)
|
||||
Button { callback(item) } label: {
|
||||
Label(ElementL10n.actionQuote, systemImage: "quote.bubble")
|
||||
}
|
||||
case .copyPermalink:
|
||||
Button(ElementL10n.permalink) {
|
||||
callback(item)
|
||||
Button { callback(item) } label: {
|
||||
Label(ElementL10n.permalink, systemImage: "link")
|
||||
}
|
||||
case .redact:
|
||||
Button(role: .destructive) { callback(item) } label: {
|
||||
Label(ElementL10n.messageActionItemRedact, systemImage: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user