diff --git a/Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift b/Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift index 6153fc33..236181d6 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift @@ -10,9 +10,20 @@ extension Account { let value: Substring } + public var safeDisplayName: String { + if displayName.isEmpty { + return username + } + return displayName + } + + @ViewBuilder public var displayNameWithEmojis: some View { + if displayName.isEmpty { + Text(safeDisplayName) + } let splittedDisplayName = displayName.split(separator: ":").map{ Part(value: $0) } - return HStack(spacing: 0) { + HStack(spacing: 0) { if displayName.isEmpty { Text(" ") } diff --git a/Packages/Notifications/Sources/Notifications/NotificationRowView.swift b/Packages/Notifications/Sources/Notifications/NotificationRowView.swift index 4722ec2f..527f9ea8 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationRowView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationRowView.swift @@ -50,7 +50,7 @@ struct NotificationRowView: View { private func makeMainLabel(type: Models.Notification.NotificationType) -> some View { VStack(alignment: .leading, spacing: 0) { HStack(spacing: 0) { - Text(notification.account.displayName) + Text(notification.account.safeDisplayName) .font(.subheadline) .fontWeight(.semibold) + Text(" ") +