mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Fix room list heroes label format
- change from `Alice, Bob and Charlie` to `Alice, Bob, Charlie and 42 others` (when applicable)
This commit is contained in:
@@ -433,6 +433,10 @@ internal enum L10n {
|
||||
/// Loading more…
|
||||
internal static var commonLoadingMore: String { return L10n.tr("Localizable", "common_loading_more") }
|
||||
/// Plural format key: "%#@COUNT@"
|
||||
internal static func commonManyMembers(_ p1: Int) -> String {
|
||||
return L10n.tr("Localizable", "common_many_members", p1)
|
||||
}
|
||||
/// Plural format key: "%#@COUNT@"
|
||||
internal static func commonMemberCount(_ p1: Int) -> String {
|
||||
return L10n.tr("Localizable", "common_member_count", p1)
|
||||
}
|
||||
@@ -2311,10 +2315,6 @@ internal enum L10n {
|
||||
return L10n.tr("Localizable", "screen_room_typing_many_members_first_component_ios", String(describing: p1), String(describing: p2))
|
||||
}
|
||||
/// Plural format key: "%#@COUNT@"
|
||||
internal static func screenRoomTypingManyMembersSecondComponentIos(_ p1: Int) -> String {
|
||||
return L10n.tr("Localizable", "screen_room_typing_many_members_second_component_ios", p1)
|
||||
}
|
||||
/// Plural format key: "%#@COUNT@"
|
||||
internal static func screenRoomTypingNotification(_ p1: Int) -> String {
|
||||
return L10n.tr("Localizable", "screen_room_typing_notification", p1)
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ extension RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 0,
|
||||
@@ -101,6 +102,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 0,
|
||||
@@ -119,6 +121,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 2,
|
||||
@@ -137,6 +140,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 3,
|
||||
@@ -155,6 +159,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 2,
|
||||
@@ -173,6 +178,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: AttributedString("Clearly, if Earth is powerful enough to do that, it might also be capable of adjusting minds in order to force belief in its radioactivity"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 1,
|
||||
@@ -191,6 +197,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
||||
lastMessageDate: .mock,
|
||||
unreadMessagesCount: 6,
|
||||
@@ -209,6 +216,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
@@ -260,6 +268,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: false,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
@@ -278,6 +287,7 @@ extension Array where Element == RoomSummary {
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
|
||||
@@ -206,6 +206,7 @@ private extension HomeScreenRoom {
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
@@ -234,6 +235,7 @@ private extension HomeScreenRoom {
|
||||
isDirect: false,
|
||||
avatarURL: avatarURL,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
|
||||
@@ -151,6 +151,7 @@ private extension HomeScreenRoom {
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
@@ -179,6 +180,7 @@ private extension HomeScreenRoom {
|
||||
isDirect: false,
|
||||
avatarURL: avatarURL,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
activeMembersCount: 0,
|
||||
lastMessage: nil,
|
||||
lastMessageDate: nil,
|
||||
unreadMessagesCount: 0,
|
||||
|
||||
@@ -48,7 +48,7 @@ struct TypingIndicatorView: View {
|
||||
let lastMember = typingMembers.members[1]
|
||||
|
||||
Text(L10n.tr("Localizable", "screen_room_typing_many_members_first_component_ios", firstMember, lastMember)).bold() +
|
||||
Text(L10n.tr("Localizable", "screen_room_typing_many_members_second_component_ios", typingMembers.members.count - 2)).bold() +
|
||||
Text(L10n.tr("Localizable", "common_many_members", typingMembers.members.count - 2)).bold() +
|
||||
Text(L10n.screenRoomTypingNotificationPluralIos)
|
||||
default:
|
||||
if didShowTextOnce {
|
||||
|
||||
@@ -38,7 +38,10 @@ struct RoomSummary {
|
||||
let name: String
|
||||
let isDirect: Bool
|
||||
let avatarURL: URL?
|
||||
|
||||
let heroes: [UserProfileProxy]
|
||||
let activeMembersCount: UInt
|
||||
|
||||
let lastMessage: AttributedString?
|
||||
let lastMessageDate: Date?
|
||||
let unreadMessagesCount: UInt
|
||||
@@ -81,7 +84,18 @@ extension RoomSummary: CustomStringConvertible {
|
||||
return alias
|
||||
}
|
||||
|
||||
return heroes.compactMap(\.displayName).formatted(.list(type: .and))
|
||||
guard heroes.count > 0 else {
|
||||
return ""
|
||||
}
|
||||
|
||||
var heroComponents = heroes.compactMap(\.displayName)
|
||||
|
||||
let othersCount = Int(activeMembersCount) - heroes.count
|
||||
if othersCount > 0 {
|
||||
heroComponents.append(L10n.commonManyMembers(othersCount))
|
||||
}
|
||||
|
||||
return heroComponents.formatted(.list(type: .and))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +107,10 @@ extension RoomSummary {
|
||||
name = string
|
||||
isDirect = true
|
||||
avatarURL = nil
|
||||
|
||||
heroes = []
|
||||
activeMembersCount = 0
|
||||
|
||||
lastMessage = AttributedString(string)
|
||||
lastMessageDate = .mock
|
||||
unreadMessagesCount = hasUnreadMessages ? 1 : 0
|
||||
|
||||
@@ -270,6 +270,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
isDirect: roomInfo.isDirect,
|
||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
||||
activeMembersCount: UInt(roomInfo.activeMembersCount),
|
||||
lastMessage: attributedLastMessage,
|
||||
lastMessageDate: lastMessageDate,
|
||||
unreadMessagesCount: UInt(roomInfo.numUnreadMessages),
|
||||
|
||||
Reference in New Issue
Block a user