Add Encryption Authenticity explanations. (#3116)

This commit is contained in:
Doug
2024-08-06 10:45:46 +01:00
committed by GitHub
parent 6a45ffc939
commit e667be0f43
24 changed files with 224 additions and 103 deletions
@@ -14,8 +14,9 @@
// limitations under the License.
//
import Foundation
import Compound
import MatrixRustSDK
import SwiftUI
/// Represents and issue with a timeline item's authenticity such as coming from an
/// unsigned session or being sent unencrypted in an encrypted room. See Rust's
@@ -43,6 +44,25 @@ enum EncryptionAuthenticity: Hashable {
L10n.eventShieldReasonSentInClear
}
}
var color: Color {
switch self {
case .notGuaranteed(let color),
.unknownDevice(let color),
.unsignedDevice(let color),
.unverifiedIdentity(let color),
.sentInClear(let color):
color
}
}
var icon: KeyPath<CompoundIcons, Image> {
// TODO: Should sentInClear have a dedicated icon???
switch color {
case .red: \.error
case .gray: \.info
}
}
}
extension EncryptionAuthenticity {