diff --git a/.swiftlint.yml b/.swiftlint.yml index ec611b419..344f76bdd 100755 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -17,6 +17,7 @@ included: - Tools/Scripts/Templates excluded: - IntegrationTests + - ElementX/Sources/Generated line_length: warning: 250 diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index be09acd88..8ab89d211 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3670,12 +3670,12 @@ path = Timeline; sourceTree = ""; }; - "TEMP_1F400E96-40D6-4907-8497-57790078F40B" /* repository */ = { + "TEMP_2C2AE7A1-DD19-41AC-BCFD-C9FE3F5EC278" /* element-x-ios */ = { isa = PBXGroup; children = ( 41553551C55AD59885840F0E /* secrets.xcconfig */, ); - path = repository; + path = "element-x-ios"; sourceTree = ""; }; /* End PBXGroup section */ @@ -5389,7 +5389,7 @@ repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = "1.0.103-alpha"; + version = "1.0.104-alpha"; }; }; 96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a2e719153..9e09fd533 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -11,7 +11,7 @@ { "identity" : "compound-ios", "kind" : "remoteSourceControl", - "location" : "https://github.com/vector-im/compound-ios", + "location" : "https://github.com/vector-im/compound-ios.git", "state" : { "revision" : "1f3eb60c4f87249d95addf84ce1aef22c2968763" } @@ -111,8 +111,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-rust-components-swift", "state" : { - "revision" : "4557f06e00179b342b4522aefa064259ec12b0d7", - "version" : "1.0.103-alpha" + "revision" : "c22c3391690abb33dbe95b28e2f522793624547c", + "version" : "1.0.104-alpha" } }, { diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 572cd8f4a..90f671a38 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -747,11 +747,11 @@ class RoomProxyMock: RoomProxyProtocol { set(value) { underlyingActiveMembersCount = value } } var underlyingActiveMembersCount: Int! - var updatesPublisher: AnyPublisher { + var updatesPublisher: AnyPublisher<[TimelineDiff], Never> { get { return underlyingUpdatesPublisher } set(value) { underlyingUpdatesPublisher = value } } - var underlyingUpdatesPublisher: AnyPublisher! + var underlyingUpdatesPublisher: AnyPublisher<[TimelineDiff], Never>! var timelineProvider: RoomTimelineProviderProtocol { get { return underlyingTimelineProvider } set(value) { underlyingTimelineProvider = value } diff --git a/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift b/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift index f61f2340e..397e85c0b 100644 --- a/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift +++ b/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift @@ -27,7 +27,7 @@ struct InvitesScreenCell: View { var body: some View { HStack(alignment: .top, spacing: 16) { - LoadableAvatarImage(url: mainAvatarURL, + LoadableAvatarImage(url: invite.roomDetails.avatarURL, name: title, contentID: invite.roomDetails.id, avatarSize: .custom(52), @@ -119,12 +119,7 @@ struct InvitesScreenCell: View { .fill(Color.compound.borderDisabled) .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 { invite.roomDetails.name } diff --git a/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxy.swift b/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxy.swift index 6d086ee6f..c438bba57 100644 --- a/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxy.swift +++ b/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxy.swift @@ -88,7 +88,12 @@ struct NotificationItemProxy: NotificationItemProxyProtocol { } 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 { diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index a0aa61af3..02b8e8c79 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -45,8 +45,8 @@ class RoomProxy: RoomProxyProtocol { } private var timelineListener: RoomTimelineListener? - private let updatesSubject = PassthroughSubject() - var updatesPublisher: AnyPublisher { + private let updatesSubject = PassthroughSubject<[TimelineDiff], Never>() + var updatesPublisher: AnyPublisher<[TimelineDiff], Never> { updatesSubject.eraseToAnyPublisher() } @@ -80,8 +80,8 @@ class RoomProxy: RoomProxyProtocol { timelineLimit: UInt32(SlidingSyncConstants.defaultTimelineLimit)) roomListItem.subscribe(settings: settings) - let timelineListener = RoomTimelineListener { [weak self] timelineDiff in - self?.updatesSubject.send(timelineDiff) + let timelineListener = RoomTimelineListener { [weak self] timelineDiffs in + self?.updatesSubject.send(timelineDiffs) } self.timelineListener = timelineListener @@ -691,13 +691,13 @@ class RoomProxy: RoomProxyProtocol { } 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 } - func onUpdate(diff: TimelineDiff) { + func onUpdate(diff: [TimelineDiff]) { onUpdateClosure(diff) } } diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index 2aa2d524c..79902cb6b 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -74,7 +74,7 @@ protocol RoomProxyProtocol { /// Publishes the room's updates. /// The thread on which this publisher sends the output isn't defined. - var updatesPublisher: AnyPublisher { get } + var updatesPublisher: AnyPublisher<[TimelineDiff], Never> { get } var timelineProvider: RoomTimelineProviderProtocol { get } diff --git a/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift b/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift index c517bd9ba..d6017036f 100644 --- a/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift +++ b/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift @@ -40,7 +40,7 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol { } init(currentItems: [TimelineItem], - updatePublisher: AnyPublisher, + updatePublisher: AnyPublisher<[TimelineDiff], Never>, backPaginationStatePublisher: AnyPublisher) { serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomtimelineprovider", qos: .utility) itemProxiesSubject = CurrentValueSubject<[TimelineItemProxy], Never>(currentItems.map(TimelineItemProxy.init)) @@ -49,7 +49,7 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol { itemProxiesSubject.send(itemProxies) updatePublisher - .collect(.byTime(serialDispatchQueue, 0.1)) + .receive(on: serialDispatchQueue) .sink { [weak self] in self?.updateItemsWithDiffs($0) } .store(in: &cancellables) diff --git a/NSE/Sources/Other/NSEUserSession.swift b/NSE/Sources/Other/NSEUserSession.swift index a129f5c97..f0a24d30d 100644 --- a/NSE/Sources/Other/NSEUserSession.swift +++ b/NSE/Sources/Other/NSEUserSession.swift @@ -48,7 +48,7 @@ final class NSEUserSession { func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? { await Task.dispatch(on: .global()) { 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 { return nil diff --git a/project.yml b/project.yml index 2e7560c6c..a02163b25 100644 --- a/project.yml +++ b/project.yml @@ -45,7 +45,7 @@ include: packages: MatrixRustSDK: url: https://github.com/matrix-org/matrix-rust-components-swift - exactVersion: 1.0.103-alpha + exactVersion: 1.0.104-alpha # path: ../matrix-rust-sdk DesignKit: path: DesignKit