ios: avoid message changing width when sent/received ticks appear (#4945)

This commit is contained in:
Evgeny
2024-09-26 17:28:14 +01:00
committed by GitHub
parent 65c7ecbddf
commit 4a39b481b1
2 changed files with 23 additions and 4 deletions

View File

@@ -75,9 +75,14 @@ enum MetaColorMode {
}
}
var statusSpacer: Text {
func statusSpacer(_ sent: Bool) -> Text {
switch self {
case .normal, .transparent: Text(Image(systemName: "circlebadge.fill")).foregroundColor(.clear)
case .normal, .transparent:
Text(
sent
? Image("checkmark.wide")
: Image(systemName: "circlebadge.fill")
).foregroundColor(.clear)
case .invertedMaterial: Text(" ").kerning(13)
}
}
@@ -130,10 +135,10 @@ func ciMetaText(
colorMode.resolve(statusColor)
}
r = r + colored(Text(image), metaColor)
space = Text(" ")
} else if !meta.disappearing {
space = colorMode.statusSpacer + Text(" ")
r = r + colorMode.statusSpacer(meta.itemStatus.sent)
}
space = Text(" ")
}
if let enc = encrypted {
appendSpace()

View File

@@ -2820,6 +2820,20 @@ public enum CIStatus: Decodable, Hashable {
case .invalid: return "invalid"
}
}
public var sent: Bool {
switch self {
case .sndNew: true
case .sndSent: true
case .sndRcvd: true
case .sndErrorAuth: true
case .sndError: true
case .sndWarning: true
case .rcvNew: false
case .rcvRead: false
case .invalid: false
}
}
public func statusIcon(_ metaColor: Color, _ paleMetaColor: Color, _ primaryColor: Color = .accentColor) -> (Image, Color)? {
switch self {