Bump the RustSDK to v1.0.79-alpha

This commit is contained in:
Stefan Ceriu 2023-06-21 19:00:52 +03:00 committed by Mauro
parent 6d5652d56a
commit bbcfec3574
8 changed files with 46 additions and 40 deletions

View File

@ -5008,7 +5008,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = "1.0.78-alpha";
version = "1.0.79-alpha";
};
};
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {

View File

@ -11,7 +11,7 @@
{
"identity" : "compound-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vector-im/compound-ios.git",
"location" : "https://github.com/vector-im/compound-ios",
"state" : {
"revision" : "e8b35fdd8c4008079dfce203e63bf7a05582d7b9"
}
@ -111,8 +111,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : {
"revision" : "278e5694266e6b88b675d39a68391025b3b72bcb",
"version" : "1.0.78-alpha"
"revision" : "59c10bfd0b2dee9b5bf41b536ffac472d4fc49db",
"version" : "1.0.79-alpha"
}
},
{
@ -181,7 +181,7 @@
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state" : {
"revision" : "cef5b3f6f11781dd4591bdd1dd0a3d22bd609334",
"version" : "1.11.0"

View File

@ -652,27 +652,27 @@ class SDKClientMock: SDKClientProtocol {
}
//MARK: - `uploadMedia`
public var uploadMediaMimeTypeDataThrowableError: Error?
public var uploadMediaMimeTypeDataCallsCount = 0
public var uploadMediaMimeTypeDataCalled: Bool {
return uploadMediaMimeTypeDataCallsCount > 0
public var uploadMediaMimeTypeDataProgressWatcherThrowableError: Error?
public var uploadMediaMimeTypeDataProgressWatcherCallsCount = 0
public var uploadMediaMimeTypeDataProgressWatcherCalled: Bool {
return uploadMediaMimeTypeDataProgressWatcherCallsCount > 0
}
public var uploadMediaMimeTypeDataReceivedArguments: (`mimeType`: String, `data`: [UInt8])?
public var uploadMediaMimeTypeDataReceivedInvocations: [(`mimeType`: String, `data`: [UInt8])] = []
public var uploadMediaMimeTypeDataReturnValue: String!
public var uploadMediaMimeTypeDataClosure: ((String, [UInt8]) throws -> String)?
public var uploadMediaMimeTypeDataProgressWatcherReceivedArguments: (`mimeType`: String, `data`: [UInt8], `progressWatcher`: ProgressWatcher?)?
public var uploadMediaMimeTypeDataProgressWatcherReceivedInvocations: [(`mimeType`: String, `data`: [UInt8], `progressWatcher`: ProgressWatcher?)] = []
public var uploadMediaMimeTypeDataProgressWatcherReturnValue: String!
public var uploadMediaMimeTypeDataProgressWatcherClosure: ((String, [UInt8], ProgressWatcher?) throws -> String)?
public func `uploadMedia`(`mimeType`: String, `data`: [UInt8]) throws -> String {
if let error = uploadMediaMimeTypeDataThrowableError {
public func `uploadMedia`(`mimeType`: String, `data`: [UInt8], `progressWatcher`: ProgressWatcher?) throws -> String {
if let error = uploadMediaMimeTypeDataProgressWatcherThrowableError {
throw error
}
uploadMediaMimeTypeDataCallsCount += 1
uploadMediaMimeTypeDataReceivedArguments = (mimeType: mimeType, data: data)
uploadMediaMimeTypeDataReceivedInvocations.append((mimeType: mimeType, data: data))
if let uploadMediaMimeTypeDataClosure = uploadMediaMimeTypeDataClosure {
return try uploadMediaMimeTypeDataClosure(`mimeType`, `data`)
uploadMediaMimeTypeDataProgressWatcherCallsCount += 1
uploadMediaMimeTypeDataProgressWatcherReceivedArguments = (mimeType: mimeType, data: data, progressWatcher: progressWatcher)
uploadMediaMimeTypeDataProgressWatcherReceivedInvocations.append((mimeType: mimeType, data: data, progressWatcher: progressWatcher))
if let uploadMediaMimeTypeDataProgressWatcherClosure = uploadMediaMimeTypeDataProgressWatcherClosure {
return try uploadMediaMimeTypeDataProgressWatcherClosure(`mimeType`, `data`, `progressWatcher`)
} else {
return uploadMediaMimeTypeDataReturnValue
return uploadMediaMimeTypeDataProgressWatcherReturnValue
}
}
//MARK: - `userId`

View File

@ -47,7 +47,6 @@ class ClientProxy: ClientProxyProtocol {
private let clientQueue: DispatchQueue
private var roomListService: RoomList?
private var roomListSyncTaskHandle: TaskHandle?
private var roomListStateUpdateTaskHandle: TaskHandle?
var roomSummaryProvider: RoomSummaryProviderProtocol?
@ -71,7 +70,7 @@ class ClientProxy: ClientProxyProtocol {
// These need to be inlined instead of using stopSync()
// as we can't call async methods safely from deinit
client.setDelegate(delegate: nil)
roomListSyncTaskHandle?.cancel()
try? roomListService?.stopSync()
}
let callbacks = PassthroughSubject<ClientProxyCallback, Never>()
@ -123,7 +122,7 @@ class ClientProxy: ClientProxyProtocol {
}
var isSyncing: Bool {
roomListSyncTaskHandle != nil
roomListService?.isSyncing() ?? false
}
func startSync() {
@ -132,13 +131,16 @@ class ClientProxy: ClientProxyProtocol {
return
}
roomListSyncTaskHandle = roomListService?.sync()
roomListService?.sync()
}
func stopSync() {
MXLog.info("Stopping sync")
roomListSyncTaskHandle?.cancel()
roomListSyncTaskHandle = nil
do {
try roomListService?.stopSync()
} catch {
MXLog.error("Failed stopping room list service with error: \(error)")
}
}
func directRoomForUserID(_ userID: String) async -> Result<String?, ClientProxyError> {
@ -192,7 +194,7 @@ class ClientProxy: ClientProxyProtocol {
return await Task.dispatch(on: clientQueue) {
do {
let data = try Data(contentsOf: media.url)
let matrixUrl = try self.client.uploadMedia(mimeType: mimeType, data: [UInt8](data))
let matrixUrl = try self.client.uploadMedia(mimeType: mimeType, data: [UInt8](data), progressWatcher: nil)
return .success(matrixUrl)
} catch let error as ClientError {
return .failure(ClientProxyError.failedUploadingMedia(error.code))
@ -388,16 +390,14 @@ class ClientProxy: ClientProxyProtocol {
guard let self else { return }
MXLog.info("Received room list update: \(state)")
if state == .allRooms || state == .carryOn {
self.callbacks.send(.receivedSyncUpdate)
}
#warning("Not great, not terrible (ツ)")
// Restart the room list sync on every error for now
if state == .terminated {
self.restartSync()
}
if state == .allRooms {
if state == .running {
self.callbacks.send(.receivedSyncUpdate)
Task {
// Subscribe to invites later as the underlying SlidingSync list is only added when entering AllRooms
await self.inviteSummaryProvider?.subscribeIfNecessary(entriesFunction: roomListService.invites(listener:),

View File

@ -283,6 +283,8 @@ extension NotificationItemProxyProtocol {
return try await processNotice(content: content, mediaProvider: mediaProvider)
case .text(content: let content):
return try await processText(content: content, mediaProvider: mediaProvider)
case .location:
return processEmpty()
}
}

View File

@ -284,7 +284,7 @@ class RoomProxy: RoomProxyProtocol {
return await Task.dispatch(on: userInitiatedDispatchQueue) {
do {
try self.room.sendImage(url: url.path(), thumbnailUrl: thumbnailURL.path(), imageInfo: imageInfo)
try self.room.sendImage(url: url.path(), thumbnailUrl: thumbnailURL.path(), imageInfo: imageInfo, progressWatcher: nil)
return .success(())
} catch {
return .failure(.failedSendingMedia)
@ -300,7 +300,7 @@ class RoomProxy: RoomProxyProtocol {
return await Task.dispatch(on: userInitiatedDispatchQueue) {
do {
try self.room.sendVideo(url: url.path(), thumbnailUrl: thumbnailURL.path(), videoInfo: videoInfo)
try self.room.sendVideo(url: url.path(), thumbnailUrl: thumbnailURL.path(), videoInfo: videoInfo, progressWatcher: nil)
return .success(())
} catch {
return .failure(.failedSendingMedia)
@ -316,7 +316,7 @@ class RoomProxy: RoomProxyProtocol {
return await Task.dispatch(on: userInitiatedDispatchQueue) {
do {
try self.room.sendAudio(url: url.path(), audioInfo: audioInfo)
try self.room.sendAudio(url: url.path(), audioInfo: audioInfo, progressWatcher: nil)
return .success(())
} catch {
return .failure(.failedSendingMedia)
@ -332,7 +332,7 @@ class RoomProxy: RoomProxyProtocol {
return await Task.dispatch(on: userInitiatedDispatchQueue) {
do {
try self.room.sendFile(url: url.path(), fileInfo: fileInfo)
try self.room.sendFile(url: url.path(), fileInfo: fileInfo, progressWatcher: nil)
return .success(())
} catch {
return .failure(.failedSendingMedia)

View File

@ -74,6 +74,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
return buildEmoteTimelineItem(for: eventItemProxy, messageTimelineItem, content, isOutgoing)
case .audio(let content):
return buildAudioTimelineItem(for: eventItemProxy, messageTimelineItem, content, isOutgoing)
case .location:
return nil
case .none:
return nil
}
@ -488,6 +490,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
replyContent = .text(buildTextTimelineItemContent(content))
case .video(let content):
replyContent = .video(buildVideoTimelineItemContent(content))
case .location:
return nil
case .none:
return nil
}

View File

@ -44,7 +44,7 @@ include:
packages:
MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.0.78-alpha
exactVersion: 1.0.79-alpha
# path: ../matrix-rust-sdk
DesignKit:
path: DesignKit