mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Various performance tweaks (#474)
* Store and reuse room list placeholder avatars and last messages * Cache and reuse HomeScreenRooms * Reduce RoomSummaryProvider diff collection time * Promote more logs to info * Slighty tweak RustTracing to make it easier to configure * Move TimelineProvider and RoomTimelineController item processing to background queues * Prevent the timeline from stopping an ogoing decelerating scroll when starting backpaginating
This commit is contained in:
@@ -95,6 +95,9 @@ struct HomeScreenViewStateBindings {
|
||||
}
|
||||
|
||||
struct HomeScreenRoom: Identifiable, Equatable {
|
||||
private static let placeholderLastMessage = AttributedString("Last message")
|
||||
private static let placeholderAvatar = UIImage(systemName: "photo")
|
||||
|
||||
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
|
||||
/// or a completely unique one for empty items and skeletons
|
||||
let id: String
|
||||
@@ -102,11 +105,11 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
/// The real room identifier this item points to
|
||||
let roomId: String?
|
||||
|
||||
let name: String
|
||||
var name = ""
|
||||
|
||||
let hasUnreads: Bool
|
||||
var hasUnreads = false
|
||||
|
||||
let timestamp: String?
|
||||
var timestamp: String?
|
||||
|
||||
var lastMessage: AttributedString?
|
||||
|
||||
@@ -122,8 +125,8 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
name: "Placeholder room name",
|
||||
hasUnreads: false,
|
||||
timestamp: "Now",
|
||||
lastMessage: AttributedString("Last message"),
|
||||
avatar: UIImage(systemName: "photo"),
|
||||
lastMessage: Self.placeholderLastMessage,
|
||||
avatar: Self.placeholderAvatar,
|
||||
isPlaceholder: true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user