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 2f0b5a42f5
commit 293834cf94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

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

View File

@ -43,14 +43,6 @@ extension EventBasedTimelineItemProtocol {
properties.deliveryStatus == .sendingFailed properties.deliveryStatus == .sendingFailed
} }
var isMessage: Bool {
self is EventBasedMessageTimelineItemProtocol
}
var isLocation: Bool {
self is LocationRoomTimelineItem
}
var pollIfAvailable: Poll? { var pollIfAvailable: Poll? {
(self as? PollRoomTimelineItem)?.poll (self as? PollRoomTimelineItem)?.poll
} }
@ -89,4 +81,17 @@ extension EventBasedTimelineItemProtocol {
} }
return start + timestamp 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
}
}
} }