mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
tombstoned and upgraded rooms implementation
added tests tombstoned room avatar
This commit is contained in:
@@ -12,6 +12,7 @@ struct PlaceholderAvatarImage: View {
|
||||
@Environment(\.redactionReasons) private var redactionReasons
|
||||
|
||||
private let textForImage: String
|
||||
/// When `nil` the tombstoned colors will be used
|
||||
private let contentID: String?
|
||||
|
||||
var body: some View {
|
||||
@@ -22,7 +23,9 @@ struct PlaceholderAvatarImage: View {
|
||||
// This text's frame doesn't look right when redacted
|
||||
if redactionReasons != .placeholder {
|
||||
Text(textForImage)
|
||||
.foregroundColor(avatarColor?.text ?? .white)
|
||||
.foregroundColor(avatarColor?.text ??
|
||||
// tombstoned room foreground
|
||||
.compound.iconTertiary)
|
||||
.font(.system(size: geometry.size.width * 0.5625, weight: .semibold))
|
||||
.minimumScaleFactor(0.001)
|
||||
.frame(alignment: .center)
|
||||
@@ -43,7 +46,9 @@ struct PlaceholderAvatarImage: View {
|
||||
return Color(.systemGray4) // matches the default text redaction
|
||||
}
|
||||
|
||||
return avatarColor?.background ?? .compound.iconPrimary
|
||||
return avatarColor?.background ??
|
||||
// tombstoned room background
|
||||
.compound.bgSubtlePrimary
|
||||
}
|
||||
|
||||
private var avatarColor: DecorativeColor? {
|
||||
@@ -70,6 +75,10 @@ struct PlaceholderAvatarImage_Previews: PreviewProvider, TestablePreview {
|
||||
.clipShape(Circle())
|
||||
.frame(width: 150, height: 100)
|
||||
|
||||
PlaceholderAvatarImage(name: "!", contentID: nil)
|
||||
.clipShape(Circle())
|
||||
.frame(width: 100, height: 100)
|
||||
|
||||
PlaceholderAvatarImage(name: nil, contentID: "@fooserid:matrix.org")
|
||||
.clipShape(Circle())
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
Reference in New Issue
Block a user