Bump the RustSDK to v1.0.14
This commit is contained in:
committed by
Stefan Ceriu
parent
25b41e420c
commit
c88e82a2b8
@@ -7380,7 +7380,7 @@
|
||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 1.0.13;
|
||||
version = 1.0.14;
|
||||
};
|
||||
};
|
||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||
|
||||
@@ -148,8 +148,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "94373ae0568cf1681c39b1a348601e733d76a7ec",
|
||||
"version" : "1.0.13"
|
||||
"revision" : "76ccbfd106eb4d967c79eccaf339ddfc45e6f7fb",
|
||||
"version" : "1.0.14"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -14255,9 +14255,9 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
||||
}
|
||||
}
|
||||
}
|
||||
open var roomRoomIdClosure: ((String) async throws -> RoomListItem)?
|
||||
open var roomRoomIdClosure: ((String) throws -> RoomListItem)?
|
||||
|
||||
open override func room(roomId: String) async throws -> RoomListItem {
|
||||
open override func room(roomId: String) throws -> RoomListItem {
|
||||
if let error = roomRoomIdThrowableError {
|
||||
throw error
|
||||
}
|
||||
@@ -14267,7 +14267,7 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
||||
self.roomRoomIdReceivedInvocations.append(roomId)
|
||||
}
|
||||
if let roomRoomIdClosure = roomRoomIdClosure {
|
||||
return try await roomRoomIdClosure(roomId)
|
||||
return try roomRoomIdClosure(roomId)
|
||||
} else {
|
||||
return roomRoomIdReturnValue
|
||||
}
|
||||
@@ -15338,9 +15338,9 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService {
|
||||
}
|
||||
}
|
||||
}
|
||||
open var roomRoomIdClosure: ((String) async throws -> RoomListItem)?
|
||||
open var roomRoomIdClosure: ((String) throws -> RoomListItem)?
|
||||
|
||||
open override func room(roomId: String) async throws -> RoomListItem {
|
||||
open override func room(roomId: String) throws -> RoomListItem {
|
||||
if let error = roomRoomIdThrowableError {
|
||||
throw error
|
||||
}
|
||||
@@ -15350,7 +15350,7 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService {
|
||||
self.roomRoomIdReceivedInvocations.append(roomId)
|
||||
}
|
||||
if let roomRoomIdClosure = roomRoomIdClosure {
|
||||
return try await roomRoomIdClosure(roomId)
|
||||
return try roomRoomIdClosure(roomId)
|
||||
} else {
|
||||
return roomRoomIdReturnValue
|
||||
}
|
||||
@@ -17558,71 +17558,6 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - latestEvent
|
||||
|
||||
var latestEventUnderlyingCallsCount = 0
|
||||
open var latestEventCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return latestEventUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = latestEventUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
latestEventUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
latestEventUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var latestEventCalled: Bool {
|
||||
return latestEventCallsCount > 0
|
||||
}
|
||||
|
||||
var latestEventUnderlyingReturnValue: EventTimelineItem?
|
||||
open var latestEventReturnValue: EventTimelineItem? {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return latestEventUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: EventTimelineItem?? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = latestEventUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
latestEventUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
latestEventUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var latestEventClosure: (() async -> EventTimelineItem?)?
|
||||
|
||||
open override func latestEvent() async -> EventTimelineItem? {
|
||||
latestEventCallsCount += 1
|
||||
if let latestEventClosure = latestEventClosure {
|
||||
return await latestEventClosure()
|
||||
} else {
|
||||
return latestEventReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - loadReplyDetails
|
||||
|
||||
open var loadReplyDetailsEventIdStrThrowableError: Error?
|
||||
|
||||
@@ -820,7 +820,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
|
||||
private func roomTupleForIdentifier(_ identifier: String) async -> (RoomListItem?, Room?) {
|
||||
do {
|
||||
let roomListItem = try await roomListService?.room(roomId: identifier)
|
||||
let roomListItem = try roomListService?.room(roomId: identifier)
|
||||
if roomListItem?.isTimelineInitialized() == false {
|
||||
try await roomListItem?.initTimeline(eventTypeFilter: eventFilters, internalIdPrefix: nil)
|
||||
}
|
||||
|
||||
@@ -200,9 +200,10 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
return updatedItems
|
||||
}
|
||||
|
||||
private func fetchRoomInfo(roomID: String) -> RoomInfo? {
|
||||
private func fetchRoomDetails(roomID: String) -> (roomInfo: RoomInfo?, latestEvent: EventTimelineItem?) {
|
||||
class FetchResult {
|
||||
var roomInfo: RoomInfo?
|
||||
var latestEvent: EventTimelineItem?
|
||||
}
|
||||
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
@@ -210,7 +211,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
Task {
|
||||
do {
|
||||
let roomListItem = try await roomListService.room(roomId: roomID)
|
||||
let roomListItem = try roomListService.room(roomId: roomID)
|
||||
result.latestEvent = await roomListItem.latestEvent()
|
||||
result.roomInfo = try await roomListItem.roomInfo()
|
||||
} catch {
|
||||
MXLog.error("Failed fetching room info with error: \(error)")
|
||||
@@ -218,18 +220,20 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
semaphore.signal()
|
||||
}
|
||||
semaphore.wait()
|
||||
return result.roomInfo
|
||||
return (result.roomInfo, result.latestEvent)
|
||||
}
|
||||
|
||||
private func buildRoomSummaryForIdentifier(_ identifier: String, invalidated: Bool) -> RoomSummary {
|
||||
guard let roomInfo = fetchRoomInfo(roomID: identifier) else {
|
||||
let roomDetails = fetchRoomDetails(roomID: identifier)
|
||||
|
||||
guard let roomInfo = roomDetails.roomInfo else {
|
||||
return .empty
|
||||
}
|
||||
|
||||
var attributedLastMessage: AttributedString?
|
||||
var lastMessageFormattedTimestamp: String?
|
||||
|
||||
if let latestRoomMessage = roomInfo.latestEvent {
|
||||
if let latestRoomMessage = roomDetails.latestEvent {
|
||||
let lastMessage = EventTimelineItemProxy(item: latestRoomMessage, id: "0")
|
||||
lastMessageFormattedTimestamp = lastMessage.timestamp.formattedMinimal()
|
||||
attributedLastMessage = eventStringBuilder.buildAttributedString(for: lastMessage)
|
||||
|
||||
@@ -49,7 +49,7 @@ packages:
|
||||
# Element/Matrix dependencies
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||
exactVersion: 1.0.13
|
||||
exactVersion: 1.0.14
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
url: https://github.com/element-hq/compound-ios
|
||||
|
||||
Reference in New Issue
Block a user