From 03d0fc676390f019dbec8b3a10a31d3af0484232 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 5 May 2023 15:30:03 +0200 Subject: [PATCH] sdk bump to 1.0.60 --- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Sources/Services/Client/ClientProxy.swift | 131 ++++++++---------- .../MediaProvider/MediaLoaderTests.swift | 4 + project.yml | 2 +- 4 files changed, 62 insertions(+), 79 deletions(-) diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 54ff3882e..e81e998ed 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -111,8 +111,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-rust-components-swift", "state" : { - "revision" : "15c314fcb20e3b009b573a50edc4736a73e63c96", - "version" : "1.0.59-alpha" + "revision" : "6c11b548074f4bfedfe73a9724d7d8d1709b0ede", + "version" : "1.0.60-alpha" } }, { diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 2de5ba024..f5953b4bc 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -362,39 +362,34 @@ class ClientProxy: ClientProxyProtocol { fatalError("This shouldn't be called more than once") } - do { - let visibleRoomsSlidingSyncView = try SlidingSyncListBuilder() - .timelineLimit(limit: UInt32(SlidingSyncConstants.initialTimelineLimit)) // Starts off with zero to quickly load rooms, then goes to 1 while scrolling to quickly load last messages and 20 when the scrolling stops to load room history - .requiredState(requiredState: slidingSyncRequiredState) - .filters(filters: slidingSyncFilters) - .name(name: "CurrentlyVisibleRooms") - .syncMode(mode: .selective) - .addRange(from: 0, to: 20) - .build() - - let visibleRoomsViewProxy = SlidingSyncViewProxy(slidingSyncView: visibleRoomsSlidingSyncView, name: "Visible rooms") - - self.visibleRoomsSlidingSyncView = visibleRoomsSlidingSyncView - self.visibleRoomsViewProxy = visibleRoomsViewProxy - - // Changes to the visibleRoomsSlidingSyncView range need to restart the connection to be applied - visibleRoomsViewProxy.visibleRangeUpdatePublisher.sink { [weak self] in - self?.restartSync() + let visibleRoomsSlidingSyncView = SlidingSyncListBuilder(name: "CurrentlyVisibleRooms") + .timelineLimit(limit: UInt32(SlidingSyncConstants.initialTimelineLimit)) // Starts off with zero to quickly load rooms, then goes to 1 while scrolling to quickly load last messages and 20 when the scrolling stops to load room history + .requiredState(requiredState: slidingSyncRequiredState) + .filters(filters: slidingSyncFilters) + .syncMode(mode: .selective) + .addRange(from: 0, to: 20) + .build() + + let visibleRoomsViewProxy = SlidingSyncViewProxy(slidingSyncView: visibleRoomsSlidingSyncView, name: "Visible rooms") + + self.visibleRoomsSlidingSyncView = visibleRoomsSlidingSyncView + self.visibleRoomsViewProxy = visibleRoomsViewProxy + + // Changes to the visibleRoomsSlidingSyncView range need to restart the connection to be applied + visibleRoomsViewProxy.visibleRangeUpdatePublisher.sink { [weak self] in + self?.restartSync() + } + .store(in: &cancellables) + + // The allRoomsSlidingSyncView will be registered as soon as the visibleRoomsSlidingSyncView receives its first update + visibleRoomsViewProxyStateObservationToken = visibleRoomsViewProxy.statePublisher.sink { [weak self] state in + guard state == .fullyLoaded else { + return } - .store(in: &cancellables) - - // The allRoomsSlidingSyncView will be registered as soon as the visibleRoomsSlidingSyncView receives its first update - visibleRoomsViewProxyStateObservationToken = visibleRoomsViewProxy.statePublisher.sink { [weak self] state in - guard state == .fullyLoaded else { - return - } - - MXLog.info("Visible rooms view received first update, configuring views post initial sync") - self?.configureViewsPostInitialSync() - self?.visibleRoomsViewProxyStateObservationToken = nil - } - } catch { - MXLog.error("Failed building the visible rooms sliding sync view with error: \(error)") + + MXLog.info("Visible rooms view received first update, configuring views post initial sync") + self?.configureViewsPostInitialSync() + self?.visibleRoomsViewProxyStateObservationToken = nil } } @@ -403,22 +398,16 @@ class ClientProxy: ClientProxyProtocol { fatalError("This shouldn't be called more than once") } - do { - let allRoomsSlidingSyncView = try SlidingSyncListBuilder() - .noTimelineLimit() - .requiredState(requiredState: slidingSyncRequiredState) - .filters(filters: slidingSyncFilters) - .name(name: "AllRooms") - .syncMode(mode: .growing) - .batchSize(batchSize: 100) - .build() - - self.allRoomsSlidingSyncView = allRoomsSlidingSyncView - allRoomsViewProxy = SlidingSyncViewProxy(slidingSyncView: allRoomsSlidingSyncView, name: "All rooms") - - } catch { - MXLog.error("Failed building the all rooms sliding sync view with error: \(error)") - } + let allRoomsSlidingSyncView = SlidingSyncListBuilder(name: "AllRooms") + .noTimelineLimit() + .requiredState(requiredState: slidingSyncRequiredState) + .filters(filters: slidingSyncFilters) + .syncMode(mode: .growing) + .batchSize(batchSize: 100) + .build() + + self.allRoomsSlidingSyncView = allRoomsSlidingSyncView + allRoomsViewProxy = SlidingSyncViewProxy(slidingSyncView: allRoomsSlidingSyncView, name: "All rooms") } private func buildAndConfigureInvitesSlidingSyncView() { @@ -426,21 +415,16 @@ class ClientProxy: ClientProxyProtocol { fatalError("This shouldn't be called more than once") } - do { - let invitesView = try SlidingSyncListBuilder() - .noTimelineLimit() - .requiredState(requiredState: slidingSyncInvitesRequiredState) - .filters(filters: slidingSyncInviteFilters) - .name(name: "Invites") - .syncMode(mode: .growing) - .batchSize(batchSize: 100) - .build() - - invitesSlidingSyncView = invitesView - invitesViewProxy = SlidingSyncViewProxy(slidingSyncView: invitesView, name: "Invites") - } catch { - MXLog.error("Failed building the invites sliding sync view with error: \(error)") - } + let invitesView = SlidingSyncListBuilder(name: "Invites") + .noTimelineLimit() + .requiredState(requiredState: slidingSyncInvitesRequiredState) + .filters(filters: slidingSyncInviteFilters) + .syncMode(mode: .growing) + .batchSize(batchSize: 100) + .build() + + invitesSlidingSyncView = invitesView + invitesViewProxy = SlidingSyncViewProxy(slidingSyncView: invitesView, name: "Invites") } private func buildAndConfigureNotificationSyncView() { @@ -448,20 +432,15 @@ class ClientProxy: ClientProxyProtocol { fatalError("This shouldn't be called more than once") } - do { - let notificationsSlidingSyncView = try SlidingSyncListBuilder() - .noTimelineLimit() - .requiredState(requiredState: slidingSyncNotificationsRequiredState) - .filters(filters: slidingSyncNotificationsFilters) - .name(name: "Notifications") - .syncMode(mode: .growing) - .batchSize(batchSize: 100) - .build() + let notificationsSlidingSyncView = SlidingSyncListBuilder(name: "Notifications") + .noTimelineLimit() + .requiredState(requiredState: slidingSyncNotificationsRequiredState) + .filters(filters: slidingSyncNotificationsFilters) + .syncMode(mode: .growing) + .batchSize(batchSize: 100) + .build() - self.notificationsSlidingSyncView = notificationsSlidingSyncView - } catch { - MXLog.error("Failed building the notification sliding sync view with error: \(error)") - } + self.notificationsSlidingSyncView = notificationsSlidingSyncView } private func buildRoomSummaryProviders() { diff --git a/UnitTests/Sources/MediaProvider/MediaLoaderTests.swift b/UnitTests/Sources/MediaProvider/MediaLoaderTests.swift index 7cb574d64..e53d01fff 100644 --- a/UnitTests/Sources/MediaProvider/MediaLoaderTests.swift +++ b/UnitTests/Sources/MediaProvider/MediaLoaderTests.swift @@ -146,4 +146,8 @@ private class MockMediaLoadingClient: ClientProtocol { func searchUsers(searchTerm: String, limit: UInt64) throws -> MatrixRustSDK.SearchUsersResults { fatalError() } func setNotificationDelegate(notificationDelegate: MatrixRustSDK.NotificationDelegate?) { } + + func getNotificationItem(roomId: String, eventId: String) throws -> MatrixRustSDK.NotificationItem { + fatalError() + } } diff --git a/project.yml b/project.yml index f215b113d..3be5771ec 100644 --- a/project.yml +++ b/project.yml @@ -42,7 +42,7 @@ include: packages: MatrixRustSDK: url: https://github.com/matrix-org/matrix-rust-components-swift - exactVersion: 1.0.59-alpha + exactVersion: 1.0.60-alpha # path: ../matrix-rust-sdk DesignKit: path: DesignKit