mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 00:49:44 +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:
@@ -49,7 +49,7 @@ struct MessageTimelineItem<Content: MessageContentProtocol> {
|
||||
case .transactionId:
|
||||
return .sending
|
||||
case .eventId:
|
||||
return .sent(elapsedTime: Date().timeIntervalSince1970 - originServerTs.timeIntervalSince1970)
|
||||
return .sent(elapsedTime: Date().timeIntervalSince1970 - timestamp.timeIntervalSince1970)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +77,8 @@ struct MessageTimelineItem<Content: MessageContentProtocol> {
|
||||
item.sender()
|
||||
}
|
||||
|
||||
var originServerTs: Date {
|
||||
if let timestamp = item.originServerTs() {
|
||||
return Date(timeIntervalSince1970: TimeInterval(timestamp / 1000))
|
||||
} else {
|
||||
return .now
|
||||
}
|
||||
var timestamp: Date {
|
||||
Date(timeIntervalSince1970: TimeInterval(item.timestamp() / 1000))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,12 +91,8 @@ struct EventTimelineItemProxy: CustomDebugStringConvertible {
|
||||
item.reactions()
|
||||
}
|
||||
|
||||
var originServerTs: Date {
|
||||
if let timestamp = item.originServerTs() {
|
||||
return Date(timeIntervalSince1970: TimeInterval(timestamp / 1000))
|
||||
} else {
|
||||
return .now
|
||||
}
|
||||
var timestamp: Date {
|
||||
Date(timeIntervalSince1970: TimeInterval(item.timestamp() / 1000))
|
||||
}
|
||||
|
||||
// MARK: - CustomDebugStringConvertible
|
||||
|
||||
@@ -98,7 +98,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
return EncryptedRoomTimelineItem(id: eventItemProxy.id,
|
||||
text: ElementL10n.encryptionInformationDecryptionError,
|
||||
encryptionType: encryptionType,
|
||||
timestamp: eventItemProxy.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: eventItemProxy.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
@@ -115,7 +115,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
_ avatarImage: UIImage?) -> RoomTimelineItemProtocol {
|
||||
RedactedRoomTimelineItem(id: eventItemProxy.id,
|
||||
text: ElementL10n.eventRedacted,
|
||||
timestamp: eventItemProxy.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: eventItemProxy.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
@@ -136,7 +136,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
return TextRoomTimelineItem(id: eventItemProxy.id,
|
||||
text: eventItemProxy.body ?? "",
|
||||
attributedComponents: attributedComponents,
|
||||
timestamp: eventItemProxy.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: eventItemProxy.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
@@ -158,7 +158,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
return TextRoomTimelineItem(id: message.id,
|
||||
text: message.body,
|
||||
attributedComponents: attributedComponents,
|
||||
timestamp: message.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: message.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: message.isEditable,
|
||||
@@ -183,7 +183,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
|
||||
return ImageRoomTimelineItem(id: message.id,
|
||||
text: message.body,
|
||||
timestamp: message.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: message.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: message.isEditable,
|
||||
@@ -214,7 +214,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
|
||||
return VideoRoomTimelineItem(id: message.id,
|
||||
text: message.body,
|
||||
timestamp: message.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: message.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: message.isEditable,
|
||||
@@ -241,7 +241,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
_ avatarImage: UIImage?) -> RoomTimelineItemProtocol {
|
||||
FileRoomTimelineItem(id: message.id,
|
||||
text: message.body,
|
||||
timestamp: message.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: message.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: message.isEditable,
|
||||
@@ -266,7 +266,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
return NoticeRoomTimelineItem(id: message.id,
|
||||
text: message.body,
|
||||
attributedComponents: attributedComponents,
|
||||
timestamp: message.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: message.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: message.isEditable,
|
||||
@@ -289,7 +289,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
return EmoteRoomTimelineItem(id: message.id,
|
||||
text: message.body,
|
||||
attributedComponents: attributedComponents,
|
||||
timestamp: message.originServerTs.formatted(date: .omitted, time: .shortened),
|
||||
timestamp: message.timestamp.formatted(date: .omitted, time: .shortened),
|
||||
inGroupState: inGroupState,
|
||||
isOutgoing: isOutgoing,
|
||||
isEditable: message.isEditable,
|
||||
|
||||
Reference in New Issue
Block a user