mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Show Only Retry Decryption and View Source for Unencrypted messages (#1202)
* show only retryDecryption for unencrypted message * fix
This commit is contained in:
@@ -353,11 +353,19 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
// Don't show a context menu for non-event based items.
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
if timelineItem is StateRoomTimelineItem {
|
||||
// Don't show a context menu for state events.
|
||||
return nil
|
||||
}
|
||||
|
||||
var debugActions: [TimelineItemMenuAction] = appSettings.canShowDeveloperOptions ? [.viewSource] : []
|
||||
|
||||
if let encryptedItem = timelineItem as? EncryptedRoomTimelineItem,
|
||||
case let .megolmV1AesSha2(sessionID) = encryptedItem.encryptionType {
|
||||
debugActions.append(.retryDecryption(sessionID: sessionID))
|
||||
return .init(actions: [], debugActions: debugActions)
|
||||
}
|
||||
|
||||
var actions: [TimelineItemMenuAction] = [
|
||||
.reply
|
||||
@@ -382,13 +390,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
} else {
|
||||
actions.append(.report)
|
||||
}
|
||||
|
||||
var debugActions: [TimelineItemMenuAction] = appSettings.canShowDeveloperOptions ? [.viewSource] : []
|
||||
|
||||
if let item = timelineItem as? EncryptedRoomTimelineItem,
|
||||
case let .megolmV1AesSha2(sessionID) = item.encryptionType {
|
||||
debugActions.append(.retryDecryption(sessionID: sessionID))
|
||||
}
|
||||
|
||||
if item.hasFailedToSend {
|
||||
actions = actions.filter(\.canAppearInFailedEcho)
|
||||
|
||||
@@ -77,6 +77,12 @@ public struct TimelineItemMenu: View {
|
||||
|
||||
let item: EventBasedTimelineItemProtocol
|
||||
let actions: TimelineItemMenuActions
|
||||
|
||||
private var canShowReactions: Bool {
|
||||
!item.isRedacted &&
|
||||
!item.hasFailedToSend &&
|
||||
!item.hasFailedDecryption
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
VStack {
|
||||
@@ -88,7 +94,7 @@ public struct TimelineItemMenu: View {
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 0.0) {
|
||||
if !item.isRedacted, !item.hasFailedToSend {
|
||||
if canShowReactions {
|
||||
reactionsSection
|
||||
.padding(.top, 4.0)
|
||||
.padding(.bottom, 8.0)
|
||||
|
||||
@@ -45,4 +45,8 @@ extension EventBasedTimelineItemProtocol {
|
||||
var isRedacted: Bool {
|
||||
self is RedactedRoomTimelineItem
|
||||
}
|
||||
|
||||
var hasFailedDecryption: Bool {
|
||||
self is EncryptedRoomTimelineItem
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Messages that have failed to be decrypted are show only view source and retry decryptions as possible actions.
|
||||
Reference in New Issue
Block a user