Remove ‘copy’ action for "media like" types (#1889)

* Remove ‘copy’ action when useless

* Delete unused property
This commit is contained in:
Alfonso Grillo
2023-10-13 12:52:30 +02:00
committed by GitHub
parent b191f80dea
commit 681565ee55
2 changed files with 14 additions and 9 deletions

View File

@@ -558,7 +558,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
actions.append(.edit)
}
if item.isMessage, !item.isLocation {
if item.isCopyable {
actions.append(.copy)
}

View File

@@ -43,14 +43,6 @@ extension EventBasedTimelineItemProtocol {
properties.deliveryStatus == .sendingFailed
}
var isMessage: Bool {
self is EventBasedMessageTimelineItemProtocol
}
var isLocation: Bool {
self is LocationRoomTimelineItem
}
var pollIfAvailable: Poll? {
(self as? PollRoomTimelineItem)?.poll
}
@@ -89,4 +81,17 @@ extension EventBasedTimelineItemProtocol {
}
return start + timestamp
}
var isCopyable: Bool {
guard let messageBasedItem = self as? EventBasedMessageTimelineItemProtocol else {
return false
}
switch messageBasedItem.contentType {
case .audio, .file, .image, .video, .location, .voice:
return false
case .text, .emote, .notice:
return true
}
}
}