mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Bump the RustSDK to v1.0.79-alpha
This commit is contained in:
@@ -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`
|
||||
|
||||
@@ -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:),
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user