mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
New SlidingSync flow (#373)
* Switch back to using slidingSync rooms for timeline listeners * Expose 2 types of slidingSync views from the clientProxy and combine their results for the roomList * Fix breaking api changes * Remove sender mxids from the room list (until rust provides resolved display names) * Bump RustSDK to v1.0.22-alpha * Rename originServerTs to timestamp throughout * Simplified sliding sync view list merging * Rollback some SS changes as things still don't work properly * Revert "Switch back to using slidingSync rooms for timeline listeners" This reverts commit 1d6a6c09d8ddf386edefbe0ac6beaf52cc333fba.
This commit is contained in:
@@ -20,5 +20,5 @@ protocol RoomMessageProtocol {
|
||||
var id: String { get }
|
||||
var body: String { get }
|
||||
var sender: String { get }
|
||||
var originServerTs: Date { get }
|
||||
var timestamp: Date { get }
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ struct SomeRoomMessage: RoomMessageProtocol {
|
||||
let id: String
|
||||
let body: String
|
||||
let sender: String
|
||||
let originServerTs: Date
|
||||
let timestamp: Date
|
||||
}
|
||||
|
||||
struct RoomMessageFactory: RoomMessageFactoryProtocol {
|
||||
@@ -29,6 +29,6 @@ struct RoomMessageFactory: RoomMessageFactoryProtocol {
|
||||
SomeRoomMessage(id: eventItemProxy.id,
|
||||
body: eventItemProxy.body ?? "",
|
||||
sender: eventItemProxy.sender,
|
||||
originServerTs: eventItemProxy.originServerTs)
|
||||
timestamp: eventItemProxy.timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
func updateRoomsWithIdentifiers(_ identifiers: [String]) {
|
||||
#warning("This is a valid check but Rust doesn't set it correctly for selective ranged syncs")
|
||||
// guard statePublisher.value == .live else {
|
||||
// return
|
||||
// }
|
||||
// guard statePublisher.value == .live else {
|
||||
// return
|
||||
// }
|
||||
|
||||
var changes = [CollectionDifference<RoomSummary>.Change]()
|
||||
for identifier in identifiers {
|
||||
@@ -136,11 +136,14 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
var lastMessageTimestamp: Date?
|
||||
if let latestRoomMessage = room.latestRoomMessage() {
|
||||
let lastMessage = roomMessageFactory.buildRoomMessageFrom(EventTimelineItemProxy(item: latestRoomMessage))
|
||||
if let lastMessageSender = try? AttributedString(markdown: "**\(lastMessage.sender)**") {
|
||||
// Don't include the message body in the markdown otherwise it makes tappable links.
|
||||
attributedLastMessage = lastMessageSender + ": " + AttributedString(lastMessage.body)
|
||||
}
|
||||
lastMessageTimestamp = lastMessage.originServerTs
|
||||
|
||||
#warning("Intentionally remove the sender mxid from the room list for now")
|
||||
// if let lastMessageSender = try? AttributedString(markdown: "**\(lastMessage.sender)**") {
|
||||
// // Don't include the message body in the markdown otherwise it makes tappable links.
|
||||
// attributedLastMessage = lastMessageSender + ": " + AttributedString(lastMessage.body)
|
||||
// }
|
||||
attributedLastMessage = AttributedString(lastMessage.body)
|
||||
lastMessageTimestamp = lastMessage.timestamp
|
||||
}
|
||||
|
||||
return .filled(details: RoomSummaryDetails(id: room.roomId(),
|
||||
|
||||
Reference in New Issue
Block a user