mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 12:28:29 +00:00
Adopt batched timeline diffs and other RustSDK changes
This commit is contained in:
committed by
Stefan Ceriu
parent
ebb7436927
commit
28c2490910
@@ -17,6 +17,7 @@ included:
|
|||||||
- Tools/Scripts/Templates
|
- Tools/Scripts/Templates
|
||||||
excluded:
|
excluded:
|
||||||
- IntegrationTests
|
- IntegrationTests
|
||||||
|
- ElementX/Sources/Generated
|
||||||
|
|
||||||
line_length:
|
line_length:
|
||||||
warning: 250
|
warning: 250
|
||||||
|
|||||||
@@ -3670,12 +3670,12 @@
|
|||||||
path = Timeline;
|
path = Timeline;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
"TEMP_1F400E96-40D6-4907-8497-57790078F40B" /* repository */ = {
|
"TEMP_2C2AE7A1-DD19-41AC-BCFD-C9FE3F5EC278" /* element-x-ios */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
41553551C55AD59885840F0E /* secrets.xcconfig */,
|
41553551C55AD59885840F0E /* secrets.xcconfig */,
|
||||||
);
|
);
|
||||||
path = repository;
|
path = "element-x-ios";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
@@ -5389,7 +5389,7 @@
|
|||||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = "1.0.103-alpha";
|
version = "1.0.104-alpha";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{
|
{
|
||||||
"identity" : "compound-ios",
|
"identity" : "compound-ios",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/vector-im/compound-ios",
|
"location" : "https://github.com/vector-im/compound-ios.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "1f3eb60c4f87249d95addf84ce1aef22c2968763"
|
"revision" : "1f3eb60c4f87249d95addf84ce1aef22c2968763"
|
||||||
}
|
}
|
||||||
@@ -111,8 +111,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "4557f06e00179b342b4522aefa064259ec12b0d7",
|
"revision" : "c22c3391690abb33dbe95b28e2f522793624547c",
|
||||||
"version" : "1.0.103-alpha"
|
"version" : "1.0.104-alpha"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -747,11 +747,11 @@ class RoomProxyMock: RoomProxyProtocol {
|
|||||||
set(value) { underlyingActiveMembersCount = value }
|
set(value) { underlyingActiveMembersCount = value }
|
||||||
}
|
}
|
||||||
var underlyingActiveMembersCount: Int!
|
var underlyingActiveMembersCount: Int!
|
||||||
var updatesPublisher: AnyPublisher<TimelineDiff, Never> {
|
var updatesPublisher: AnyPublisher<[TimelineDiff], Never> {
|
||||||
get { return underlyingUpdatesPublisher }
|
get { return underlyingUpdatesPublisher }
|
||||||
set(value) { underlyingUpdatesPublisher = value }
|
set(value) { underlyingUpdatesPublisher = value }
|
||||||
}
|
}
|
||||||
var underlyingUpdatesPublisher: AnyPublisher<TimelineDiff, Never>!
|
var underlyingUpdatesPublisher: AnyPublisher<[TimelineDiff], Never>!
|
||||||
var timelineProvider: RoomTimelineProviderProtocol {
|
var timelineProvider: RoomTimelineProviderProtocol {
|
||||||
get { return underlyingTimelineProvider }
|
get { return underlyingTimelineProvider }
|
||||||
set(value) { underlyingTimelineProvider = value }
|
set(value) { underlyingTimelineProvider = value }
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ struct InvitesScreenCell: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .top, spacing: 16) {
|
HStack(alignment: .top, spacing: 16) {
|
||||||
LoadableAvatarImage(url: mainAvatarURL,
|
LoadableAvatarImage(url: invite.roomDetails.avatarURL,
|
||||||
name: title,
|
name: title,
|
||||||
contentID: invite.roomDetails.id,
|
contentID: invite.roomDetails.id,
|
||||||
avatarSize: .custom(52),
|
avatarSize: .custom(52),
|
||||||
@@ -119,12 +119,7 @@ struct InvitesScreenCell: View {
|
|||||||
.fill(Color.compound.borderDisabled)
|
.fill(Color.compound.borderDisabled)
|
||||||
.frame(height: 1 / UIScreen.main.scale)
|
.frame(height: 1 / UIScreen.main.scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning("Return just `roomDetails.avatarURL` when this logic is implemented in the rust sdk")
|
|
||||||
private var mainAvatarURL: URL? {
|
|
||||||
invite.isDirect ? invite.inviter?.avatarURL : invite.roomDetails.avatarURL
|
|
||||||
}
|
|
||||||
|
|
||||||
private var title: String {
|
private var title: String {
|
||||||
invite.roomDetails.name
|
invite.roomDetails.name
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,12 @@ struct NotificationItemProxy: NotificationItemProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var senderID: String {
|
var senderID: String {
|
||||||
notificationItem.senderInfo.userId
|
switch notificationItem.event {
|
||||||
|
case .timeline(let event):
|
||||||
|
return event.senderId()
|
||||||
|
case .invite(let senderID):
|
||||||
|
return senderID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var roomDisplayName: String {
|
var roomDisplayName: String {
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var timelineListener: RoomTimelineListener?
|
private var timelineListener: RoomTimelineListener?
|
||||||
private let updatesSubject = PassthroughSubject<TimelineDiff, Never>()
|
private let updatesSubject = PassthroughSubject<[TimelineDiff], Never>()
|
||||||
var updatesPublisher: AnyPublisher<TimelineDiff, Never> {
|
var updatesPublisher: AnyPublisher<[TimelineDiff], Never> {
|
||||||
updatesSubject.eraseToAnyPublisher()
|
updatesSubject.eraseToAnyPublisher()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +80,8 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
timelineLimit: UInt32(SlidingSyncConstants.defaultTimelineLimit))
|
timelineLimit: UInt32(SlidingSyncConstants.defaultTimelineLimit))
|
||||||
roomListItem.subscribe(settings: settings)
|
roomListItem.subscribe(settings: settings)
|
||||||
|
|
||||||
let timelineListener = RoomTimelineListener { [weak self] timelineDiff in
|
let timelineListener = RoomTimelineListener { [weak self] timelineDiffs in
|
||||||
self?.updatesSubject.send(timelineDiff)
|
self?.updatesSubject.send(timelineDiffs)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.timelineListener = timelineListener
|
self.timelineListener = timelineListener
|
||||||
@@ -691,13 +691,13 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class RoomTimelineListener: TimelineListener {
|
private final class RoomTimelineListener: TimelineListener {
|
||||||
private let onUpdateClosure: (TimelineDiff) -> Void
|
private let onUpdateClosure: ([TimelineDiff]) -> Void
|
||||||
|
|
||||||
init(_ onUpdateClosure: @escaping (TimelineDiff) -> Void) {
|
init(_ onUpdateClosure: @escaping ([TimelineDiff]) -> Void) {
|
||||||
self.onUpdateClosure = onUpdateClosure
|
self.onUpdateClosure = onUpdateClosure
|
||||||
}
|
}
|
||||||
|
|
||||||
func onUpdate(diff: TimelineDiff) {
|
func onUpdate(diff: [TimelineDiff]) {
|
||||||
onUpdateClosure(diff)
|
onUpdateClosure(diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ protocol RoomProxyProtocol {
|
|||||||
|
|
||||||
/// Publishes the room's updates.
|
/// Publishes the room's updates.
|
||||||
/// The thread on which this publisher sends the output isn't defined.
|
/// The thread on which this publisher sends the output isn't defined.
|
||||||
var updatesPublisher: AnyPublisher<TimelineDiff, Never> { get }
|
var updatesPublisher: AnyPublisher<[TimelineDiff], Never> { get }
|
||||||
|
|
||||||
var timelineProvider: RoomTimelineProviderProtocol { get }
|
var timelineProvider: RoomTimelineProviderProtocol { get }
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(currentItems: [TimelineItem],
|
init(currentItems: [TimelineItem],
|
||||||
updatePublisher: AnyPublisher<TimelineDiff, Never>,
|
updatePublisher: AnyPublisher<[TimelineDiff], Never>,
|
||||||
backPaginationStatePublisher: AnyPublisher<BackPaginationStatus, Never>) {
|
backPaginationStatePublisher: AnyPublisher<BackPaginationStatus, Never>) {
|
||||||
serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomtimelineprovider", qos: .utility)
|
serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomtimelineprovider", qos: .utility)
|
||||||
itemProxiesSubject = CurrentValueSubject<[TimelineItemProxy], Never>(currentItems.map(TimelineItemProxy.init))
|
itemProxiesSubject = CurrentValueSubject<[TimelineItemProxy], Never>(currentItems.map(TimelineItemProxy.init))
|
||||||
@@ -49,7 +49,7 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
|||||||
itemProxiesSubject.send(itemProxies)
|
itemProxiesSubject.send(itemProxies)
|
||||||
|
|
||||||
updatePublisher
|
updatePublisher
|
||||||
.collect(.byTime(serialDispatchQueue, 0.1))
|
.receive(on: serialDispatchQueue)
|
||||||
.sink { [weak self] in self?.updateItemsWithDiffs($0) }
|
.sink { [weak self] in self?.updateItemsWithDiffs($0) }
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ final class NSEUserSession {
|
|||||||
func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? {
|
func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? {
|
||||||
await Task.dispatch(on: .global()) {
|
await Task.dispatch(on: .global()) {
|
||||||
do {
|
do {
|
||||||
let notification = try self.notificationClient.getNotificationWithSlidingSync(roomId: roomID, eventId: eventID)
|
let notification = try self.notificationClient.getNotification(roomId: roomID, eventId: eventID)
|
||||||
|
|
||||||
guard let notification else {
|
guard let notification else {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ include:
|
|||||||
packages:
|
packages:
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||||
exactVersion: 1.0.103-alpha
|
exactVersion: 1.0.104-alpha
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
DesignKit:
|
DesignKit:
|
||||||
path: DesignKit
|
path: DesignKit
|
||||||
|
|||||||
Reference in New Issue
Block a user