mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-23 15:01:16 +00:00
* feat(ios): unify chat and voice experience * refactor(ios): finish unified chat ownership * fix(ios): unify chat and voice capture ownership * fix(ios): serialize Talk permission hydration * fix(ios): clear voice CI regressions * fix(ios): clear remaining unified chat CI failures * chore(i18n): sync native source inventory * refactor(ios): defer provider-only realtime voice * fix(ios): clean unified chat voice PR * fix(ios): localize unified voice controls * fix(ios): serialize composer audio controls * fix(ios): isolate dictation preparation lifecycle * fix(ios): key chat tab icons by appearance * fix(ios): preserve talk upgrade handshakes * fix(ios): refresh native i18n inventory * fix(ios): reconcile shared locale artifacts * fix(ios): satisfy chat view lint limit * fix(ios): reconcile shared composer implementation * test(apple): avoid XCTest actor deinit crash * fix(ios): satisfy SwiftFormat scope spacing * fix(ios): remove duplicate merged helper declarations
22 lines
879 B
Swift
22 lines
879 B
Swift
import Foundation
|
|
|
|
enum AgentIdentityPresentation {
|
|
nonisolated static func badge(avatarText: String?, displayName: String) -> String {
|
|
self.normalizedBadgeEmoji(avatarText) ?? self.initialsBadge(for: displayName)
|
|
}
|
|
|
|
nonisolated static func initialsBadge(for displayName: String) -> String {
|
|
let words = displayName
|
|
.split(whereSeparator: { $0.isWhitespace || $0 == "-" || $0 == "_" })
|
|
.prefix(2)
|
|
let initials = words.compactMap(\.first).map(String.init).joined()
|
|
return initials.isEmpty ? "OC" : initials.uppercased()
|
|
}
|
|
|
|
nonisolated static func normalizedBadgeEmoji(_ value: String?) -> String? {
|
|
guard let value else { return nil }
|
|
let normalized = value.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
return normalized.isEmpty || normalized == "?" ? nil : normalized
|
|
}
|
|
}
|