mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-07 21:08:28 +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:
@@ -359,6 +359,14 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
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
|
||||
]
|
||||
@@ -383,13 +391,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -78,6 +78,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 {
|
||||
header
|
||||
@@ -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