Remove now unnecessary RoomListSummary lastMessageFormattedTimestamp

This commit is contained in:
Stefan Ceriu
2025-04-28 16:24:22 +03:00
committed by Stefan Ceriu
parent 5a56abcfc7
commit 68b95764f9
27 changed files with 46 additions and 68 deletions

View File

@@ -79,8 +79,7 @@ extension RoomSummary {
avatarURL: nil, avatarURL: nil,
heroes: [], heroes: [],
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"), lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "14:56",
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -103,8 +102,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil, avatarURL: nil,
heroes: [], heroes: [],
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"), lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "14:56",
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -122,8 +120,7 @@ extension Array where Element == RoomSummary {
avatarURL: .mockMXCAvatar, avatarURL: .mockMXCAvatar,
heroes: [], heroes: [],
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"), lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "2:56 PM",
unreadMessagesCount: 2, unreadMessagesCount: 2,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 2, unreadNotificationsCount: 2,
@@ -141,8 +138,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil, avatarURL: nil,
heroes: [], heroes: [],
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"), lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "Some time ago",
unreadMessagesCount: 3, unreadMessagesCount: 3,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -160,8 +156,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil, avatarURL: nil,
heroes: [], heroes: [],
lastMessage: AttributedString("There's an archaic measure of time that's called the month"), lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "Just now",
unreadMessagesCount: 2, unreadMessagesCount: 2,
unreadMentionsCount: 2, unreadMentionsCount: 2,
unreadNotificationsCount: 2, unreadNotificationsCount: 2,
@@ -179,8 +174,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil, avatarURL: nil,
heroes: [], heroes: [],
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"), 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: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "1986",
unreadMessagesCount: 1, unreadMessagesCount: 1,
unreadMentionsCount: 1, unreadMentionsCount: 1,
unreadNotificationsCount: 1, unreadNotificationsCount: 1,
@@ -198,8 +192,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil, avatarURL: nil,
heroes: [], heroes: [],
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"), lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
unreadMessagesCount: 6, unreadMessagesCount: 6,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -218,7 +211,6 @@ extension Array where Element == RoomSummary {
heroes: [], heroes: [],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -270,7 +262,6 @@ extension Array where Element == RoomSummary {
heroes: [], heroes: [],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -289,7 +280,6 @@ extension Array where Element == RoomSummary {
heroes: [], heroes: [],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,

View File

@@ -243,7 +243,7 @@ extension HomeScreenRoom {
isDirect: summary.isDirect, isDirect: summary.isDirect,
isHighlighted: isHighlighted, isHighlighted: isHighlighted,
isFavourite: summary.isFavourite, isFavourite: summary.isFavourite,
timestamp: summary.lastMessageFormattedTimestamp, timestamp: summary.lastMessageDate?.formattedMinimal(),
lastMessage: summary.lastMessage, lastMessage: summary.lastMessage,
avatar: summary.avatar, avatar: summary.avatar,
canonicalAlias: summary.canonicalAlias) canonicalAlias: summary.canonicalAlias)

View File

@@ -208,7 +208,6 @@ private extension HomeScreenRoom {
heroes: [.init(userID: "@someone:somewhere.com")], heroes: [.init(userID: "@someone:somewhere.com")],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -237,7 +236,6 @@ private extension HomeScreenRoom {
heroes: [.init(userID: "@someone:somewhere.com")], heroes: [.init(userID: "@someone:somewhere.com")],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,

View File

@@ -153,7 +153,6 @@ private extension HomeScreenRoom {
heroes: [.init(userID: "@someone:somewhere.com")], heroes: [.init(userID: "@someone:somewhere.com")],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
@@ -182,7 +181,6 @@ private extension HomeScreenRoom {
heroes: [.init(userID: "@someone:somewhere.com")], heroes: [.init(userID: "@someone:somewhere.com")],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,

View File

@@ -41,7 +41,6 @@ struct RoomSummary {
let heroes: [UserProfileProxy] let heroes: [UserProfileProxy]
let lastMessage: AttributedString? let lastMessage: AttributedString?
let lastMessageDate: Date? let lastMessageDate: Date?
let lastMessageFormattedTimestamp: String?
let unreadMessagesCount: UInt let unreadMessagesCount: UInt
let unreadMentionsCount: UInt let unreadMentionsCount: UInt
let unreadNotificationsCount: UInt let unreadNotificationsCount: UInt
@@ -96,8 +95,7 @@ extension RoomSummary {
avatarURL = nil avatarURL = nil
heroes = [] heroes = []
lastMessage = AttributedString(string) lastMessage = AttributedString(string)
lastMessageDate = .now lastMessageDate = .mock
lastMessageFormattedTimestamp = "Now"
unreadMessagesCount = hasUnreadMessages ? 1 : 0 unreadMessagesCount = hasUnreadMessages ? 1 : 0
unreadMentionsCount = hasUnreadMentions ? 1 : 0 unreadMentionsCount = hasUnreadMentions ? 1 : 0
unreadNotificationsCount = hasUnreadNotifications ? 1 : 0 unreadNotificationsCount = hasUnreadNotifications ? 1 : 0

View File

@@ -243,12 +243,10 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
var attributedLastMessage: AttributedString? var attributedLastMessage: AttributedString?
var lastMessageDate: Date? var lastMessageDate: Date?
var lastMessageFormattedTimestamp: String?
if let latestRoomMessage = roomDetails.latestEvent { if let latestRoomMessage = roomDetails.latestEvent {
let lastMessage = EventTimelineItemProxy(item: latestRoomMessage, uniqueID: .init("0")) let lastMessage = EventTimelineItemProxy(item: latestRoomMessage, uniqueID: .init("0"))
lastMessageDate = lastMessage.timestamp lastMessageDate = lastMessage.timestamp
lastMessageFormattedTimestamp = lastMessage.timestamp.formattedMinimal()
attributedLastMessage = eventStringBuilder.buildAttributedString(for: lastMessage) attributedLastMessage = eventStringBuilder.buildAttributedString(for: lastMessage)
} }
@@ -274,7 +272,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
heroes: roomInfo.heroes.map(UserProfileProxy.init), heroes: roomInfo.heroes.map(UserProfileProxy.init),
lastMessage: attributedLastMessage, lastMessage: attributedLastMessage,
lastMessageDate: lastMessageDate, lastMessageDate: lastMessageDate,
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
unreadMessagesCount: UInt(roomInfo.numUnreadMessages), unreadMessagesCount: UInt(roomInfo.numUnreadMessages),
unreadMentionsCount: UInt(roomInfo.numUnreadMentions), unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications), unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:565e64e7517453e0a6e48bbd390db7b1a5ce37d9d79872f2e46926aa95696e3c oid sha256:4e891998fd95aa30f8c191deab533a059a9c1feb815ae5bf0852540c9b1e9ab4
size 253182 size 251107

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:8f28dd104e527d7b1a2f51f894e2e5859de52e84ecee25477303a017a541cf9d oid sha256:ecf700e5999db8abed896b329e74903335c481cce0e06dc7d6568561168c45ad
size 256291 size 255196

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:3353d26ab3b1614883d67ebf9cf12e0e1ab6bf20980ed9c0b4ef5b1735d6960c oid sha256:28f525c2f84acf155af7b5eaa7d3c9726a7d0861fad83c7e5249925d57fefd81
size 189632 size 188085

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b079b832c36fa47a3b5ddfc70dcd204b2be0f7ac2e0d97ae96f4d69f5841ac43 oid sha256:2582a1c209166a3488335a70697fb0be7c7c81228db2ca2198e4a959b9cff3f7
size 192431 size 190520

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:33317db33390eb64018ae78b6e4c38f3e510969cba83f02d1e46130300f6e07c oid sha256:511bbebdefd00ca3169790a06c4286fda86e90a0c814b6327dbcd3b54aa9fa95
size 230470 size 228009

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:33317db33390eb64018ae78b6e4c38f3e510969cba83f02d1e46130300f6e07c oid sha256:79a8204c246186be948bfd1d1ac0ccf87edf3a047304705b077436540fad299a
size 230470 size 229275

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:d2628e5ceec674b3990ac4200ae9fefd6161947032ded834a1ac8d2a54164f9d oid sha256:fba85304ab17f100b391904278da5b82fbaa458e3b53de446ba98d088c0908a1
size 170879 size 169063

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:d2628e5ceec674b3990ac4200ae9fefd6161947032ded834a1ac8d2a54164f9d oid sha256:0586a60dc2d7cbc8d0679015b11e88e163c4ab2749233db1948685f52c69b8c0
size 170879 size 168689

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:641fcfd9cb6f688aee22aebcd7401e371c8136c93ae01c7f9cf599889e7edac0 oid sha256:74fe3e6464e17d2e966cacd4d6fb06a9738a8d097ff19c354ebf1573a4e4290e
size 403620 size 392164

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:df1b0d57a7c3e2094cb506f0d4e296bc948fc722ed88fd237fe94e241d811475 oid sha256:fc1c8e79b2417b48c5a4010b1c99dd91bfe97f3d8a2f83c30ac4f249b1868e4a
size 467930 size 456244

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:dd9df05fe2b178e18c8ccceb1f81c9f247b6a210be3d427a734d0f290a77ba6c oid sha256:c64bf07906a6e3497913c4f49a24140e11d6e90983d9b35d7fdc009a4d503843
size 752407 size 740216

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:efed1ac06f38b65d4985f5c8e0b6496d1365519f5ac30c04696d170ad5a0eaf1 oid sha256:9a6811c53c8ee5cc8fc0d77a3c498b8fe3624b414d480492af15093b3d9a1a65
size 333024 size 327426

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7fef8349d83cd4670207d898e3703052ee2a7df726fb9d35920e65a080f0d1fc oid sha256:6ba80b5b8665b78e0d54458274242d8f1437fe7f164e36d655a86af51491be01
size 470214 size 459905

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:9cc5de6816de5e73c3e3741c360149922fe64c4a23b1f500a9c30b606ffc7ee3 oid sha256:d5749b253752706df6d50b5678fa7514e84e1666fd05a08279f01ce2c4bf157e
size 335716 size 331941

View File

@@ -29,7 +29,6 @@ class HomeScreenRoomTests: XCTestCase {
heroes: [], heroes: [],
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: unreadMessagesCount, unreadMessagesCount: unreadMessagesCount,
unreadMentionsCount: unreadMentionsCount, unreadMentionsCount: unreadMentionsCount,
unreadNotificationsCount: unreadNotificationsCount, unreadNotificationsCount: unreadNotificationsCount,

View File

@@ -86,8 +86,7 @@ class LoggingTests: XCTestCase {
avatarURL: nil, avatarURL: nil,
heroes: [.init(userID: "", displayName: heroName)], heroes: [.init(userID: "", displayName: heroName)],
lastMessage: AttributedString(lastMessage), lastMessage: AttributedString(lastMessage),
lastMessageDate: nil, lastMessageDate: .mock,
lastMessageFormattedTimestamp: "Now",
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,

View File

@@ -63,7 +63,6 @@ class RoomSummaryTests: XCTestCase {
heroes: heroes, heroes: heroes,
lastMessage: nil, lastMessage: nil,
lastMessageDate: nil, lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0, unreadMessagesCount: 0,
unreadMentionsCount: 0, unreadMentionsCount: 0,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,