Update Matrix SDK to v1.0.84-alpha (#1147)

* Fix build errors

* Add sendLocation API

* Amend cancelled behavior
This commit is contained in:
Alfonso Grillo
2023-06-23 17:14:38 +02:00
committed by GitHub
parent 9c115d8e25
commit 1f99e9af8d
8 changed files with 47 additions and 5 deletions
+1 -1
View File
@@ -5038,7 +5038,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = "1.0.82-alpha";
version = "1.0.84-alpha";
};
};
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
@@ -111,8 +111,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : {
"revision" : "fbac557ed23d326f4838f2cd4a902c6b54851311",
"version" : "1.0.82-alpha"
"revision" : "ff4185d36530b4368f45ddee69f9cfb99ab336d0",
"version" : "1.0.84-alpha"
}
},
{
@@ -715,6 +715,27 @@ class RoomProxyMock: RoomProxyProtocol {
return sendFileUrlFileInfoProgressSubjectReturnValue
}
}
//MARK: - sendLocation
var sendLocationBodyGeoURICallsCount = 0
var sendLocationBodyGeoURICalled: Bool {
return sendLocationBodyGeoURICallsCount > 0
}
var sendLocationBodyGeoURIReceivedArguments: (body: String, geoURI: GeoURI)?
var sendLocationBodyGeoURIReceivedInvocations: [(body: String, geoURI: GeoURI)] = []
var sendLocationBodyGeoURIReturnValue: Result<Void, RoomProxyError>!
var sendLocationBodyGeoURIClosure: ((String, GeoURI) async -> Result<Void, RoomProxyError>)?
func sendLocation(body: String, geoURI: GeoURI) async -> Result<Void, RoomProxyError> {
sendLocationBodyGeoURICallsCount += 1
sendLocationBodyGeoURIReceivedArguments = (body: body, geoURI: geoURI)
sendLocationBodyGeoURIReceivedInvocations.append((body: body, geoURI: geoURI))
if let sendLocationBodyGeoURIClosure = sendLocationBodyGeoURIClosure {
return await sendLocationBodyGeoURIClosure(body, geoURI)
} else {
return sendLocationBodyGeoURIReturnValue
}
}
//MARK: - retrySend
var retrySendTransactionIDCallsCount = 0
@@ -64,6 +64,7 @@ struct TimelineItemStatusView: View {
TimelineDeliveryStatusView(deliveryStatus: .sent)
}
case .sendingFailed:
// The bubbles handle the failure internally
if style == .plain {
Image(systemName: "exclamationmark.circle.fill")
.resizable()
@@ -73,7 +74,8 @@ struct TimelineItemStatusView: View {
context.sendFailedConfirmationDialogInfo = .init(transactionID: timelineItem.properties.transactionID)
}
}
// The bubbles handle the failure internally
case .cancelled:
EmptyView()
}
}
@@ -348,6 +348,19 @@ class RoomProxy: RoomProxyProtocol {
}
}
func sendLocation(body: String, geoURI: GeoURI) async -> Result<Void, RoomProxyError> {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
sendMessageBackgroundTask?.stop()
}
let transactionId = genTransactionId()
return await Task.dispatch(on: userInitiatedDispatchQueue) {
.success(self.room.sendLocation(body: body, geoUri: geoURI.string, txnId: transactionId))
}
}
func retrySend(transactionID: String) async {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
@@ -41,6 +41,7 @@ enum RoomProxyError: Error {
case failedSettingRoomTopic
case failedRemovingAvatar
case failedUploadingAvatar
case failedSendingLocation
}
@MainActor
@@ -101,6 +102,8 @@ protocol RoomProxyProtocol {
func sendFile(url: URL, fileInfo: FileInfo, progressSubject: CurrentValueSubject<Double, Never>?) async -> Result<Void, RoomProxyError>
func sendLocation(body: String, geoURI: GeoURI) async -> Result<Void, RoomProxyError>
/// Retries sending a failed message given its transaction ID
func retrySend(transactionID: String) async
@@ -39,6 +39,7 @@ enum TimelineItemDeliveryStatus: Hashable {
case sending
case sent
case sendingFailed
case cancelled
}
/// A light wrapper around event timeline items returned from Rust.
@@ -69,6 +70,8 @@ struct EventTimelineItemProxy {
return .sendingFailed
case .sent:
return .sent
case .cancelled:
return .cancelled
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ include:
packages:
MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.0.82-alpha
exactVersion: 1.0.84-alpha
# path: ../matrix-rust-sdk
DesignKit:
path: DesignKit