Allow sending locations within threads

This patch implements support for sending locations within threads by following a similar behavior to the other screens: pass the thread root between the various state machine states until the action is finally invoked.
This commit is contained in:
Stefan Ceriu
2025-06-12 13:30:23 +03:00
committed by Stefan Ceriu
parent 3c441f47c9
commit f66d654820
9 changed files with 101 additions and 65 deletions
+1 -1
View File
@@ -8736,7 +8736,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = { requirement = {
kind = exactVersion; kind = exactVersion;
version = 25.06.11; version = 25.06.12;
}; };
}; };
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
@@ -158,8 +158,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift", "location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : { "state" : {
"revision" : "0d5ded2509e9d409b33e4f33a45a8ee027b94828", "revision" : "6450696917e54b4ab62cad9275d673e43d0e865c",
"version" : "25.6.11" "version" : "25.6.12"
} }
}, },
{ {
@@ -310,8 +310,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case (_, .presentMessageForwarding(let forwardingItem), .messageForwarding): case (_, .presentMessageForwarding(let forwardingItem), .messageForwarding):
presentMessageForwarding(with: forwardingItem) presentMessageForwarding(with: forwardingItem)
case (_, .presentMapNavigator(let mode), .mapNavigator): case (_, .presentMapNavigator(let mode, let threadRootEventID), .mapNavigator):
presentMapNavigator(interactionMode: mode) presentMapNavigator(interactionMode: mode, threadRootEventID: threadRootEventID)
case (_, .presentPollForm(let mode), .pollForm): case (_, .presentPollForm(let mode), .pollForm):
presentPollForm(mode: mode) presentPollForm(mode: mode)
@@ -528,19 +528,25 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case .presentRoomDetails: case .presentRoomDetails:
stateMachine.tryEvent(.presentRoomDetails) stateMachine.tryEvent(.presentRoomDetails)
case .presentReportContent(let itemID, let senderID): case .presentReportContent(let itemID, let senderID):
stateMachine.tryEvent(.presentReportContent(itemID: itemID, senderID: senderID)) stateMachine.tryEvent(.presentReportContent(itemID: itemID,
senderID: senderID))
case .presentMediaUploadPicker(let source): case .presentMediaUploadPicker(let source):
stateMachine.tryEvent(.presentMediaUploadPicker(source: source, threadRootEventID: nil)) stateMachine.tryEvent(.presentMediaUploadPicker(source: source,
threadRootEventID: nil))
case .presentMediaUploadPreviewScreen(let url): case .presentMediaUploadPreviewScreen(let url):
stateMachine.tryEvent(.presentMediaUploadPreview(fileURL: url, threadRootEventID: nil)) stateMachine.tryEvent(.presentMediaUploadPreview(fileURL: url,
threadRootEventID: nil))
case .presentEmojiPicker(let itemID, let selectedEmojis): case .presentEmojiPicker(let itemID, let selectedEmojis):
stateMachine.tryEvent(.presentEmojiPicker(itemID: itemID, selectedEmojis: selectedEmojis)) stateMachine.tryEvent(.presentEmojiPicker(itemID: itemID,
selectedEmojis: selectedEmojis))
case .presentLocationPicker: case .presentLocationPicker:
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .picker)) stateMachine.tryEvent(.presentMapNavigator(interactionMode: .picker,
threadRootEventID: nil))
case .presentPollForm(let mode): case .presentPollForm(let mode):
stateMachine.tryEvent(.presentPollForm(mode: mode)) stateMachine.tryEvent(.presentPollForm(mode: mode))
case .presentLocationViewer(_, let geoURI, let description): case .presentLocationViewer(_, let geoURI, let description):
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .viewOnly(geoURI: geoURI, description: description))) stateMachine.tryEvent(.presentMapNavigator(interactionMode: .viewOnly(geoURI: geoURI, description: description),
threadRootEventID: nil))
case .presentRoomMemberDetails(userID: let userID): case .presentRoomMemberDetails(userID: let userID):
stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID)) stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID))
case .presentMessageForwarding(let forwardingItem): case .presentMessageForwarding(let forwardingItem):
@@ -550,13 +556,16 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case .presentPinnedEventsTimeline: case .presentPinnedEventsTimeline:
stateMachine.tryEvent(.presentPinnedEventsTimeline) stateMachine.tryEvent(.presentPinnedEventsTimeline)
case .presentResolveSendFailure(failure: let failure, sendHandle: let sendHandle): case .presentResolveSendFailure(failure: let failure, sendHandle: let sendHandle):
stateMachine.tryEvent(.presentResolveSendFailure(failure: failure, sendHandle: sendHandle)) stateMachine.tryEvent(.presentResolveSendFailure(failure: failure,
sendHandle: sendHandle))
case .presentKnockRequestsList: case .presentKnockRequestsList:
stateMachine.tryEvent(.presentKnockRequestsListScreen) stateMachine.tryEvent(.presentKnockRequestsListScreen)
case .presentThread(let itemID): case .presentThread(let itemID):
stateMachine.tryEvent(.presentThread(itemID: itemID)) stateMachine.tryEvent(.presentThread(itemID: itemID))
case .presentRoom(roomID: let roomID): case .presentRoom(roomID: let roomID):
stateMachine.tryEvent(.startChildFlow(roomID: roomID, via: [], entryPoint: .room)) stateMachine.tryEvent(.startChildFlow(roomID: roomID,
via: [],
entryPoint: .room))
} }
} }
.store(in: &cancellables) .store(in: &cancellables)
@@ -613,20 +622,25 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case .presentMediaUploadPreviewScreen(let url, let threadRootEventID): case .presentMediaUploadPreviewScreen(let url, let threadRootEventID):
stateMachine.tryEvent(.presentMediaUploadPreview(fileURL: url, stateMachine.tryEvent(.presentMediaUploadPreview(fileURL: url,
threadRootEventID: threadRootEventID)) threadRootEventID: threadRootEventID))
case .presentLocationPicker: case .presentLocationPicker(let threadRootEventID):
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .picker)) stateMachine.tryEvent(.presentMapNavigator(interactionMode: .picker,
threadRootEventID: threadRootEventID))
case .presentPollForm(let mode): case .presentPollForm(let mode):
stateMachine.tryEvent(.presentPollForm(mode: mode)) stateMachine.tryEvent(.presentPollForm(mode: mode))
case .presentLocationViewer(_, let geoURI, let description): case .presentLocationViewer(_, let geoURI, let description, let threadRootEventID):
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .viewOnly(geoURI: geoURI, description: description))) stateMachine.tryEvent(.presentMapNavigator(interactionMode: .viewOnly(geoURI: geoURI,
description: description),
threadRootEventID: threadRootEventID))
case .presentEmojiPicker(let itemID, let selectedEmojis): case .presentEmojiPicker(let itemID, let selectedEmojis):
stateMachine.tryEvent(.presentEmojiPicker(itemID: itemID, selectedEmojis: selectedEmojis)) stateMachine.tryEvent(.presentEmojiPicker(itemID: itemID,
selectedEmojis: selectedEmojis))
case .presentRoomMemberDetails(let userID): case .presentRoomMemberDetails(let userID):
stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID)) stateMachine.tryEvent(.presentRoomMemberDetails(userID: userID))
case .presentMessageForwarding(let forwardingItem): case .presentMessageForwarding(let forwardingItem):
stateMachine.tryEvent(.presentMessageForwarding(forwardingItem: forwardingItem)) stateMachine.tryEvent(.presentMessageForwarding(forwardingItem: forwardingItem))
case .presentResolveSendFailure(let failure, let sendHandle): case .presentResolveSendFailure(let failure, let sendHandle):
stateMachine.tryEvent(.presentResolveSendFailure(failure: failure, sendHandle: sendHandle)) stateMachine.tryEvent(.presentResolveSendFailure(failure: failure,
sendHandle: sendHandle))
} }
} }
.store(in: &cancellables) .store(in: &cancellables)
@@ -961,7 +975,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
} }
} }
private func presentMapNavigator(interactionMode: StaticLocationInteractionMode) { private func presentMapNavigator(interactionMode: StaticLocationInteractionMode,
threadRootEventID: String?) {
let stackCoordinator = NavigationStackCoordinator() let stackCoordinator = NavigationStackCoordinator()
let params = StaticLocationScreenCoordinatorParameters(interactionMode: interactionMode, let params = StaticLocationScreenCoordinatorParameters(interactionMode: interactionMode,
@@ -974,13 +989,12 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
switch action { switch action {
case .selectedLocation(let geoURI, let isUserLocation): case .selectedLocation(let geoURI, let isUserLocation):
Task { Task {
#warning("Allow sending locations within threads when the SDK allows it")
_ = await self.roomProxy.timeline.sendLocation(body: geoURI.bodyMessage, _ = await self.roomProxy.timeline.sendLocation(body: geoURI.bodyMessage,
geoURI: geoURI, geoURI: geoURI,
description: nil, description: nil,
zoomLevel: 15, zoomLevel: 15,
assetType: isUserLocation ? .sender : .pin, assetType: isUserLocation ? .sender : .pin,
threadRootEventID: nil) threadRootEventID: threadRootEventID)
self.navigationStackCoordinator.setSheetCoordinator(nil) self.navigationStackCoordinator.setSheetCoordinator(nil)
} }
@@ -1038,7 +1052,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
private func createPoll(question: String, options: [String], pollKind: Poll.Kind) { private func createPoll(question: String, options: [String], pollKind: Poll.Kind) {
Task { Task {
#warning("Allow sending polls within threads when the SDK allows it")
let result = await roomProxy.timeline.createPoll(question: question, answers: options, pollKind: pollKind, threadRootEventID: nil) let result = await roomProxy.timeline.createPoll(question: question, answers: options, pollKind: pollKind, threadRootEventID: nil)
self.analytics.trackComposer(inThread: false, self.analytics.trackComposer(inThread: false,
@@ -60,7 +60,7 @@ extension RoomFlowCoordinator {
case mediaUploadPicker(source: MediaPickerScreenSource, threadRootEventID: String?, previousState: State) case mediaUploadPicker(source: MediaPickerScreenSource, threadRootEventID: String?, previousState: State)
case mediaUploadPreview(fileURL: URL, threadRootEventID: String?, previousState: State) case mediaUploadPreview(fileURL: URL, threadRootEventID: String?, previousState: State)
case emojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>, previousState: State) case emojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>, previousState: State)
case mapNavigator(previousState: State) case mapNavigator(threadRootEventID: String?, previousState: State)
case messageForwarding(forwardingItem: MessageForwardingItem, previousState: State) case messageForwarding(forwardingItem: MessageForwardingItem, previousState: State)
case reportContent(itemID: TimelineItemIdentifier, senderID: String, previousState: State) case reportContent(itemID: TimelineItemIdentifier, senderID: String, previousState: State)
case pollForm(previousState: State) case pollForm(previousState: State)
@@ -131,7 +131,7 @@ extension RoomFlowCoordinator {
case presentEmojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>) case presentEmojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>)
case dismissEmojiPicker case dismissEmojiPicker
case presentMapNavigator(interactionMode: StaticLocationInteractionMode) case presentMapNavigator(interactionMode: StaticLocationInteractionMode, threadRootEventID: String?)
case dismissMapNavigator case dismissMapNavigator
case presentMessageForwarding(forwardingItem: MessageForwardingItem) case presentMessageForwarding(forwardingItem: MessageForwardingItem)
@@ -196,8 +196,8 @@ extension RoomFlowCoordinator {
case (.room, .presentMessageForwarding(let forwardingItem)): case (.room, .presentMessageForwarding(let forwardingItem)):
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState) return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
case (.room, .presentMapNavigator): case (.room, .presentMapNavigator(_, let threadRootEventID)):
return .mapNavigator(previousState: fromState) return .mapNavigator(threadRootEventID: threadRootEventID, previousState: fromState)
case (.room, .presentPollForm): case (.room, .presentPollForm):
return .pollForm(previousState: fromState) return .pollForm(previousState: fromState)
@@ -233,8 +233,8 @@ extension RoomFlowCoordinator {
case (.thread, .presentMessageForwarding(let forwardingItem)): case (.thread, .presentMessageForwarding(let forwardingItem)):
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState) return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
case (.thread, .presentMapNavigator): case (.thread, .presentMapNavigator(_, let threadRootEventID)):
return .mapNavigator(previousState: fromState) return .mapNavigator(threadRootEventID: threadRootEventID, previousState: fromState)
case (.thread, .presentPollForm): case (.thread, .presentPollForm):
return .pollForm(previousState: fromState) return .pollForm(previousState: fromState)
@@ -256,7 +256,7 @@ extension RoomFlowCoordinator {
case (.messageForwarding(_, let previousState), .dismissMessageForwarding): case (.messageForwarding(_, let previousState), .dismissMessageForwarding):
return previousState return previousState
case (.mapNavigator(let previousState), .dismissMapNavigator): case (.mapNavigator(_, let previousState), .dismissMapNavigator):
return previousState return previousState
case (.pollForm(let previousState), .dismissPollForm): case (.pollForm(let previousState), .dismissPollForm):
@@ -22215,15 +22215,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable {
//MARK: - sendLocation //MARK: - sendLocation
var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeUnderlyingCallsCount = 0 open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsThrowableError: Error?
open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeCallsCount: Int { var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount = 0
open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeUnderlyingCallsCount return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeUnderlyingCallsCount returnValue = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -22231,28 +22232,31 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeUnderlyingCallsCount = newValue sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeUnderlyingCallsCount = newValue sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeCalled: Bool { open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCalled: Bool {
return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeCallsCount > 0 return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCallsCount > 0
} }
open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReceivedArguments: (body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?)? open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedArguments: (body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, replyParams: ReplyParameters?)?
open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReceivedInvocations: [(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?)] = [] open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedInvocations: [(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, replyParams: ReplyParameters?)] = []
open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeClosure: ((String, String, String?, UInt8?, AssetType?) async -> Void)? open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsClosure: ((String, String, String?, UInt8?, AssetType?, ReplyParameters?) async throws -> Void)?
open override func sendLocation(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?) async { open override func sendLocation(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, replyParams: ReplyParameters?) async throws {
sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeCallsCount += 1 if let error = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsThrowableError {
sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReceivedArguments = (body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType) throw error
DispatchQueue.main.async {
self.sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReceivedInvocations.append((body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType))
} }
await sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeClosure?(body, geoUri, description, zoomLevel, assetType) sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCallsCount += 1
sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedArguments = (body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType, replyParams: replyParams)
DispatchQueue.main.async {
self.sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedInvocations.append((body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType, replyParams: replyParams))
}
try await sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsClosure?(body, geoUri, description, zoomLevel, assetType, replyParams)
} }
//MARK: - sendPollResponse //MARK: - sendPollResponse
@@ -49,7 +49,7 @@ struct RoomAttachmentPicker: View {
.accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPickerPoll) .accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPickerPoll)
} }
if !context.viewState.isInThread, context.viewState.isLocationSharingEnabled { if context.viewState.isLocationSharingEnabled {
Button { Button {
context.send(viewAction: .attach(.location)) context.send(viewAction: .attach(.location))
} label: { } label: {
@@ -29,9 +29,9 @@ enum ThreadTimelineScreenCoordinatorAction {
case presentReportContent(itemID: TimelineItemIdentifier, senderID: String) case presentReportContent(itemID: TimelineItemIdentifier, senderID: String)
case presentMediaUploadPicker(MediaPickerScreenSource, threadRootEventID: String?) case presentMediaUploadPicker(MediaPickerScreenSource, threadRootEventID: String?)
case presentMediaUploadPreviewScreen(url: URL, threadRootEventID: String?) case presentMediaUploadPreviewScreen(url: URL, threadRootEventID: String?)
case presentLocationPicker case presentLocationPicker(threadRootEventID: String?)
case presentLocationViewer(body: String, geoURI: GeoURI, description: String?, threadRootEventID: String?)
case presentPollForm(mode: PollFormMode) case presentPollForm(mode: PollFormMode)
case presentLocationViewer(body: String, geoURI: GeoURI, description: String?)
case presentEmojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>) case presentEmojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>)
case presentRoomMemberDetails(userID: String) case presentRoomMemberDetails(userID: String)
case presentMessageForwarding(forwardingItem: MessageForwardingItem) case presentMessageForwarding(forwardingItem: MessageForwardingItem)
@@ -99,27 +99,34 @@ final class ThreadTimelineScreenCoordinator: CoordinatorProtocol {
case .displayReportContent(let itemID, let senderID): case .displayReportContent(let itemID, let senderID):
actionsSubject.send(.presentReportContent(itemID: itemID, senderID: senderID)) actionsSubject.send(.presentReportContent(itemID: itemID, senderID: senderID))
case .displayCameraPicker: case .displayCameraPicker:
actionsSubject.send(.presentMediaUploadPicker(.camera, threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID)) actionsSubject.send(.presentMediaUploadPicker(.camera,
threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID))
case .displayMediaPicker: case .displayMediaPicker:
actionsSubject.send(.presentMediaUploadPicker(.photoLibrary, threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID)) actionsSubject.send(.presentMediaUploadPicker(.photoLibrary,
threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID))
case .displayDocumentPicker: case .displayDocumentPicker:
actionsSubject.send(.presentMediaUploadPicker(.documents, threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID)) actionsSubject.send(.presentMediaUploadPicker(.documents,
threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID))
case .displayMediaPreview(let mediaPreviewViewModel): case .displayMediaPreview(let mediaPreviewViewModel):
viewModel.displayMediaPreview(mediaPreviewViewModel) viewModel.displayMediaPreview(mediaPreviewViewModel)
case .displayLocationPicker: case .displayLocationPicker:
actionsSubject.send(.presentLocationPicker) actionsSubject.send(.presentLocationPicker(threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID))
case .displayLocation(let body, let geoURI, let description):
actionsSubject.send(.presentLocationViewer(body: body,
geoURI: geoURI,
description: description, threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID))
case .displayPollForm(let mode): case .displayPollForm(let mode):
actionsSubject.send(.presentPollForm(mode: mode)) actionsSubject.send(.presentPollForm(mode: mode))
case .displayMediaUploadPreviewScreen(let url): case .displayMediaUploadPreviewScreen(let url):
actionsSubject.send(.presentMediaUploadPreviewScreen(url: url, threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID)) actionsSubject.send(.presentMediaUploadPreviewScreen(url: url,
threadRootEventID: parameters.timelineController.timelineKind.threadRootEventID))
case .displaySenderDetails(userID: let userID): case .displaySenderDetails(userID: let userID):
actionsSubject.send(.presentRoomMemberDetails(userID: userID)) actionsSubject.send(.presentRoomMemberDetails(userID: userID))
case .displayMessageForwarding(let forwardingItem): case .displayMessageForwarding(let forwardingItem):
actionsSubject.send(.presentMessageForwarding(forwardingItem: forwardingItem)) actionsSubject.send(.presentMessageForwarding(forwardingItem: forwardingItem))
case .displayLocation(let body, let geoURI, let description):
actionsSubject.send(.presentLocationViewer(body: body, geoURI: geoURI, description: description))
case .displayResolveSendFailure(let failure, let sendHandle): case .displayResolveSendFailure(let failure, let sendHandle):
actionsSubject.send(.presentResolveSendFailure(failure: failure, sendHandle: sendHandle)) actionsSubject.send(.presentResolveSendFailure(failure: failure,
sendHandle: sendHandle))
case .hasScrolled, .displayRoom: case .hasScrolled, .displayRoom:
break break
case .composer(let action): case .composer(let action):
@@ -341,13 +341,25 @@ final class TimelineProxy: TimelineProxyProtocol {
threadRootEventID: String?) async -> Result<Void, TimelineProxyError> { threadRootEventID: String?) async -> Result<Void, TimelineProxyError> {
MXLog.info("Sending location") MXLog.info("Sending location")
await timeline.sendLocation(body: body, let replyParameters: ReplyParameters? = if let threadRootEventID {
geoUri: geoURI.string, ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false)
description: description, } else {
zoomLevel: zoomLevel, nil
assetType: assetType) }
MXLog.info("Finished sending location") do {
try await timeline.sendLocation(body: body,
geoUri: geoURI.string,
description: description,
zoomLevel: zoomLevel,
assetType: assetType,
replyParams: replyParameters)
MXLog.info("Finished sending location")
} catch {
MXLog.error("Failed sending location with error: \(error)")
return .failure(.sdkError(error))
}
return .success(()) return .success(())
} }
+1 -1
View File
@@ -65,7 +65,7 @@ packages:
# Element/Matrix dependencies # Element/Matrix dependencies
MatrixRustSDK: MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 25.06.11 exactVersion: 25.06.12
# path: ../matrix-rust-sdk # path: ../matrix-rust-sdk
Compound: Compound:
url: https://github.com/element-hq/compound-ios url: https://github.com/element-hq/compound-ios