mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:11:45 +00:00
Display a badge for messages decrypted using shared keys. (#4937)
* feat: Show info badge for messages decrypted with shared keys * tests: Add snapshots and tests for forwarder icon. * fix: Update `EventBasedTimelineItemProtocol.hasStatusIcon` * fix: Address review comments. * fix: Use two translations for key forwarded dialog content. * refactor: Rename `TimelineItemForwarder` to `TimelineItemKeyForwarder`. Additionally adds a `[weak self]` guard to `encryptionForwarder` alert handler. * tests: Add `previewLayout` directive to `encryptionForwarder` previews * refactor: Remove unused translations, use short-circuiting condition.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import MatrixRustSDK
|
||||
import SwiftUI
|
||||
|
||||
struct TimelineItemKeyForwarder: Identifiable, Hashable {
|
||||
let id: String
|
||||
let displayName: String?
|
||||
|
||||
init(id: String, displayName: String? = nil) {
|
||||
self.id = id
|
||||
self.displayName = displayName
|
||||
}
|
||||
|
||||
init(forwarderID: String, forwarderProfile: ProfileDetails) {
|
||||
switch forwarderProfile {
|
||||
case let .ready(displayName, _, _):
|
||||
self.init(id: forwarderID,
|
||||
displayName: displayName)
|
||||
default:
|
||||
self.init(id: forwarderID,
|
||||
displayName: nil)
|
||||
}
|
||||
}
|
||||
|
||||
var message: String {
|
||||
if let displayName {
|
||||
L10n.cryptoEventKeyForwardedKnownProfileDialogContent(displayName, id)
|
||||
} else {
|
||||
L10n.cryptoEventKeyForwardedUnknownProfileDialogContent(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user