diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 84e1d897c..b7a759f52 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -4778,7 +4778,7 @@ repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = "1.0.71-alpha"; + version = "1.0.72-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 e88819249..2d76ba28c 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -102,8 +102,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-rust-components-swift", "state" : { - "revision" : "3cd19bf79bd89b71477642a1d2172f3ee48b44ef", - "version" : "1.0.71-alpha" + "revision" : "d0533a4ba40ff1d9ea9c6473a07639fa9b9c5079", + "version" : "1.0.72-alpha" } }, { diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index f998df425..bb5eae9d8 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -168,8 +168,13 @@ class ClientProxy: ClientProxyProtocol { func stopSync() { MXLog.info("Stopping sync") - slidingSync?.stopSync() slidingSyncObserverToken = nil + + do { + try slidingSync?.stopSync() + } catch { + MXLog.error("Failed stopping sync with error: \(error). Ignore this error if ran just before the app being suspended") + } } func directRoomForUserID(_ userID: String) async -> Result { diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index de4b2dd1a..d1464732e 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -33,8 +33,6 @@ class RoomProxy: RoomProxyProtocol { private(set) var displayName: String? - private var roomSubscriptionObservationToken: TaskHandle? - private var roomUnsubscriptionObservationToken: TaskHandle? private var roomTimelineObservationToken: TaskHandle? private let membersSubject = CurrentValueSubject<[RoomMemberProxyProtocol], Never>([]) @@ -51,16 +49,7 @@ class RoomProxy: RoomProxyProtocol { deinit { Task { @MainActor [roomTimelineObservationToken, slidingSyncRoom] in roomTimelineObservationToken?.cancel() - - let task = ExpiringTaskRunner { - let unsubscribeTask = slidingSyncRoom.unsubscribeFromRoom() - - while !unsubscribeTask.isFinished() { - try await Task.sleep(for: .seconds(2)) - } - } - - try? await task.run(timeout: .seconds(30)) + slidingSyncRoom.unsubscribeFromRoom() } } @@ -184,7 +173,7 @@ class RoomProxy: RoomProxyProtocol { RequiredState(key: "m.room.canonical_alias", value: ""), RequiredState(key: "m.room.join_rules", value: "")], timelineLimit: UInt32(SlidingSyncConstants.timelinePrecachingTimelineLimit)) - roomSubscriptionObservationToken = slidingSyncRoom.subscribeToRoom(settings: settings) + slidingSyncRoom.subscribeToRoom(settings: settings) let timelineListener = RoomTimelineListener { [weak self] timelineDiff in self?.updatesSubject.send(timelineDiff) diff --git a/project.yml b/project.yml index db18b3ef5..d661ebe59 100644 --- a/project.yml +++ b/project.yml @@ -43,7 +43,7 @@ include: packages: MatrixRustSDK: url: https://github.com/matrix-org/matrix-rust-components-swift - exactVersion: 1.0.71-alpha + exactVersion: 1.0.72-alpha # path: ../matrix-rust-sdk DesignKit: path: DesignKit