Revert "Add redaction menu (disabled)."
This reverts commit 453408dbe9.
This commit is contained in:
@@ -23,7 +23,6 @@ enum TimelineItemContextMenuAction: Hashable {
|
||||
case copy
|
||||
case quote
|
||||
case copyPermalink
|
||||
case redact
|
||||
}
|
||||
|
||||
enum RoomScreenViewAction {
|
||||
|
||||
@@ -116,16 +116,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
return []
|
||||
}
|
||||
|
||||
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
|
||||
return [.copy, .quote, .copyPermalink]
|
||||
}
|
||||
|
||||
private func processContentMenuAction(_ action: TimelineItemContextMenuAction, itemId: String) {
|
||||
@@ -146,8 +137,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
} catch {
|
||||
displayError(.alert(ElementL10n.roomTimelinePermalinkCreationFailure))
|
||||
}
|
||||
case .redact:
|
||||
redactItem(itemId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,10 +148,4 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
message: message)
|
||||
}
|
||||
}
|
||||
|
||||
private func redactItem(_ itemID: String) {
|
||||
Task {
|
||||
await timelineController.redactItem(itemID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,20 +25,16 @@ public struct TimelineItemContextMenu: View {
|
||||
ForEach(contextMenuActions, id: \.self) { item in
|
||||
switch item {
|
||||
case .copy:
|
||||
Button { callback(item) } label: {
|
||||
Label(ElementL10n.actionCopy, systemImage: "doc.on.doc")
|
||||
Button(ElementL10n.actionCopy) {
|
||||
callback(item)
|
||||
}
|
||||
case .quote:
|
||||
Button { callback(item) } label: {
|
||||
Label(ElementL10n.actionQuote, systemImage: "quote.bubble")
|
||||
Button(ElementL10n.actionQuote) {
|
||||
callback(item)
|
||||
}
|
||||
case .copyPermalink:
|
||||
Button { callback(item) } label: {
|
||||
Label(ElementL10n.permalink, systemImage: "link")
|
||||
}
|
||||
case .redact:
|
||||
Button(role: .destructive) { callback(item) } label: {
|
||||
Label(ElementL10n.messageActionItemRedact, systemImage: "trash")
|
||||
Button(ElementL10n.permalink) {
|
||||
callback(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,4 @@ struct MockRoomProxy: RoomProxyProtocol {
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError> {
|
||||
.failure(.failedSendingMessage)
|
||||
}
|
||||
|
||||
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError> {
|
||||
.failure(.failedRedactingEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,22 +194,6 @@ class RoomProxy: RoomProxyProtocol {
|
||||
.value
|
||||
}
|
||||
|
||||
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError> {
|
||||
return .failure(.failedRedactingEvent)
|
||||
#warning("Redactions to be enabled on next SDK release.")
|
||||
// let transactionID = genTransactionId()
|
||||
//
|
||||
// return await Task {
|
||||
// do {
|
||||
// try room.redact(eventId: itemId, reason: nil, txnId: transactionID)
|
||||
// return .success(())
|
||||
// } catch {
|
||||
// return .failure(.failedRedactingEvent)
|
||||
// }
|
||||
// }
|
||||
// .value
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
fileprivate func appendMessage(_ message: AnyMessage) {
|
||||
|
||||
@@ -24,7 +24,6 @@ enum RoomProxyError: Error {
|
||||
case failedRetrievingMemberAvatarURL
|
||||
case failedRetrievingMemberDisplayName
|
||||
case failedSendingMessage
|
||||
case failedRedactingEvent
|
||||
}
|
||||
|
||||
enum RoomProxyCallback {
|
||||
@@ -57,7 +56,5 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError>
|
||||
|
||||
var callbacks: PassthroughSubject<RoomProxyCallback, Never> { get }
|
||||
}
|
||||
|
||||
@@ -57,6 +57,4 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
func processItemDisappearance(_ itemId: String) async { }
|
||||
|
||||
func sendMessage(_ message: String) async { }
|
||||
|
||||
func redactItem(_ itemId: String) async { }
|
||||
}
|
||||
|
||||
@@ -104,13 +104,6 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func redactItem(_ itemId: String) async {
|
||||
switch await timelineProvider.redactItem(itemId) {
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@objc private func contentSizeCategoryDidChange() {
|
||||
|
||||
@@ -40,6 +40,4 @@ protocol RoomTimelineControllerProtocol {
|
||||
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineControllerError>
|
||||
|
||||
func sendMessage(_ message: String) async
|
||||
|
||||
func redactItem(_ itemId: String) async
|
||||
}
|
||||
|
||||
@@ -59,13 +59,4 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
return .failure(.failedSendingMessage)
|
||||
}
|
||||
}
|
||||
|
||||
func redactItem(_ itemID: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
switch await roomProxy.redactItem(itemID) {
|
||||
case .success:
|
||||
return .success(())
|
||||
case .failure:
|
||||
return .failure(.failedRedactingItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ enum RoomTimelineProviderCallback {
|
||||
|
||||
enum RoomTimelineProviderError: Error {
|
||||
case failedSendingMessage
|
||||
case failedRedactingItem
|
||||
case generic
|
||||
}
|
||||
|
||||
@@ -36,6 +35,4 @@ protocol RoomTimelineProviderProtocol {
|
||||
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func redactItem(_ itemID: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ include:
|
||||
|
||||
packages:
|
||||
MatrixRustSDK:
|
||||
# url: https://github.com/matrix-org/matrix-rust-components-swift.git
|
||||
# exactVersion: 1.0.11-alpha
|
||||
path: ../matrix-rust-components-swift
|
||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||
exactVersion: 1.0.13-alpha
|
||||
# path: ../matrix-rust-components-swift
|
||||
DesignKit:
|
||||
path: ./
|
||||
AnalyticsEvents:
|
||||
|
||||
Reference in New Issue
Block a user