mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +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.
|
// Don't show a context menu for non-event based items.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if timelineItem is StateRoomTimelineItem {
|
if timelineItem is StateRoomTimelineItem {
|
||||||
// Don't show a context menu for state events.
|
// Don't show a context menu for state events.
|
||||||
return nil
|
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] = [
|
var actions: [TimelineItemMenuAction] = [
|
||||||
.reply
|
.reply
|
||||||
@@ -382,13 +390,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
} else {
|
} else {
|
||||||
actions.append(.report)
|
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 {
|
if item.hasFailedToSend {
|
||||||
actions = actions.filter(\.canAppearInFailedEcho)
|
actions = actions.filter(\.canAppearInFailedEcho)
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ public struct TimelineItemMenu: View {
|
|||||||
|
|
||||||
let item: EventBasedTimelineItemProtocol
|
let item: EventBasedTimelineItemProtocol
|
||||||
let actions: TimelineItemMenuActions
|
let actions: TimelineItemMenuActions
|
||||||
|
|
||||||
|
private var canShowReactions: Bool {
|
||||||
|
!item.isRedacted &&
|
||||||
|
!item.hasFailedToSend &&
|
||||||
|
!item.hasFailedDecryption
|
||||||
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
@@ -88,7 +94,7 @@ public struct TimelineItemMenu: View {
|
|||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(alignment: .leading, spacing: 0.0) {
|
VStack(alignment: .leading, spacing: 0.0) {
|
||||||
if !item.isRedacted, !item.hasFailedToSend {
|
if canShowReactions {
|
||||||
reactionsSection
|
reactionsSection
|
||||||
.padding(.top, 4.0)
|
.padding(.top, 4.0)
|
||||||
.padding(.bottom, 8.0)
|
.padding(.bottom, 8.0)
|
||||||
|
|||||||
@@ -45,4 +45,8 @@ extension EventBasedTimelineItemProtocol {
|
|||||||
var isRedacted: Bool {
|
var isRedacted: Bool {
|
||||||
self is RedactedRoomTimelineItem
|
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