Bump the RustSDK to v1.0.41 (#654)

* Handle breaking changes.
* Fix a couple of warnings
* Bump the SDK to v1.0.41
This commit is contained in:
Stefan Ceriu
2023-02-28 18:03:19 +02:00
committed by GitHub
parent c2dc873c74
commit 802279d8af
8 changed files with 38 additions and 48 deletions
@@ -95,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : {
"revision" : "cceadb7fb59518e642010901b8f0cd87946221f3",
"version" : "1.0.40-alpha"
"revision" : "6cf248cfdf11237ae988f6e7ee11f273c551860a",
"version" : "1.0.41-alpha"
}
},
{
@@ -38,7 +38,7 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
var homeserver = LoginHomeserver(address: homeserverAddress, loginMode: .unknown)
try await Task.dispatch(on: .global()) {
try self.authenticationService.configureHomeserver(serverName: homeserverAddress)
try self.authenticationService.configureHomeserver(serverNameOrHomeserverUrl: homeserverAddress)
}
if let details = authenticationService.homeserverDetails() {
@@ -55,7 +55,7 @@ class ClientProxy: ClientProxyProtocol {
private let mediaLoader: MediaLoaderProtocol
private let clientQueue: DispatchQueue
private var slidingSyncObserverToken: StoppableSpawn?
private var slidingSyncObserverToken: TaskHandle?
private var slidingSync: SlidingSync?
var visibleRoomsSlidingSyncView: SlidingSyncView?
@@ -54,9 +54,9 @@ class SlidingSyncViewProxy {
private let slidingSync: SlidingSyncProtocol
private let slidingSyncView: SlidingSyncViewProtocol
private var listUpdateObserverToken: StoppableSpawn?
private var stateUpdateObserverToken: StoppableSpawn?
private var countUpdateObserverToken: StoppableSpawn?
private var listUpdateObserverToken: TaskHandle?
private var stateUpdateObserverToken: TaskHandle?
private var countUpdateObserverToken: TaskHandle?
private var cancellables = Set<AnyCancellable>()
@@ -33,7 +33,7 @@ class RoomProxy: RoomProxyProtocol {
private(set) var displayName: String?
private var timelineObservationToken: StoppableSpawn?
private var timelineObservationToken: TaskHandle?
init(slidingSyncRoom: SlidingSyncRoomProtocol,
room: RoomProtocol,
@@ -135,34 +135,39 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
}
}
// swiftlint:disable:next cyclomatic_complexity
// swiftlint:disable:next cyclomatic_complexity function_body_length
private func buildDiff(from diff: SlidingSyncViewRoomsListDiff, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
var changes = [CollectionDifference<RoomSummary>.Change]()
switch diff {
case .push(value: let value):
MXLog.verbose("Push")
case .pushFront(let value):
MXLog.verbose("Push Front")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: Int(rooms.count), element: summary, associatedWith: nil))
case .updateAt(let index, let value):
changes.append(.insert(offset: 0, element: summary, associatedWith: nil))
case .pushBack(let value):
MXLog.verbose("Push Back")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: rooms.count, element: summary, associatedWith: nil))
case .append(values: let values):
MXLog.verbose("Append \(values.count) rooms, current total count: \(rooms.count)")
for (index, value) in values.enumerated() {
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: rooms.count + index, element: summary, associatedWith: nil))
}
case .set(let index, let value):
MXLog.verbose("Update \(index), current total count: \(rooms.count)")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
case .insertAt(let index, let value):
case .insert(let index, let value):
MXLog.verbose("Insert at \(index), current total count: \(rooms.count)")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
case .move(let oldIndex, let newIndex):
MXLog.verbose("Move from: \(oldIndex) to: \(newIndex), current total count: \(rooms.count)")
let summary = rooms[Int(oldIndex)]
changes.append(.remove(offset: Int(oldIndex), element: summary, associatedWith: nil))
changes.append(.insert(offset: Int(newIndex), element: summary, associatedWith: nil))
case .removeAt(let index):
case .remove(let index):
MXLog.verbose("Remove from: \(index), current total count: \(rooms.count)")
let summary = rooms[Int(index)]
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
case .replace(let values):
case .reset(let values):
MXLog.verbose("Replace all items with new count: \(values.count), current total count: \(rooms.count)")
for (index, summary) in rooms.enumerated() {
changes.append(.remove(offset: index, element: summary, associatedWith: nil))
@@ -176,8 +181,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
for (index, value) in rooms.enumerated() {
changes.append(.remove(offset: index, element: value, associatedWith: nil))
}
case .pop:
MXLog.verbose("Pop, current total count: \(rooms.count)")
case .popFront:
MXLog.verbose("Pop Front, current total count: \(rooms.count)")
let summary = rooms[0]
changes.append(.remove(offset: 0, element: summary, associatedWith: nil))
case .popBack:
MXLog.verbose("Pop Back, current total count: \(rooms.count)")
guard let value = rooms.last else {
fatalError()
}
@@ -208,22 +217,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
}
}
extension SlidingSyncViewRoomsListDiff {
var isInvalidation: Bool {
switch self {
case .push(let value), .updateAt(_, let value), .insertAt(_, let value):
switch value {
case .invalidated:
return true
default:
return false
}
default:
return false
}
}
}
extension RoomSummaryProviderState {
init(slidingSyncState: SlidingSyncState) {
switch slidingSyncState {
@@ -94,9 +94,11 @@ extension NotificationItemProxy {
senderId: senderId,
roomId: roomId,
mediaProvider: mediaProvider)
case .audio:
#warning("Audio timeline items not currently supported")
return nil
case .audio(content: let content):
return try await processAudio(content: content,
senderId: senderId,
roomId: roomId,
mediaProvider: mediaProvider)
case .video(content: let content):
return try await processVideo(content: content,
senderId: senderId,
@@ -117,11 +119,6 @@ extension NotificationItemProxy {
senderId: senderId,
roomId: roomId,
mediaProvider: mediaProvider)
case .audio(content: let content):
return try await processAudio(content: content,
senderId: senderId,
roomId: roomId,
mediaProvider: mediaProvider)
case .none:
return nil
}
+1 -1
View File
@@ -40,7 +40,7 @@ include:
packages:
MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.0.40-alpha
exactVersion: 1.0.41-alpha
# path: ../matrix-rust-sdk
DesignKit:
path: DesignKit