mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Update SDK to 1.0.94-alpha (#1232)
* Update SDK * Map new location fields * Add LocationRoomTimelineItemContent.AssetType
This commit is contained in:
@@ -5147,7 +5147,7 @@
|
||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = "1.0.93-alpha";
|
||||
version = "1.0.94-alpha";
|
||||
};
|
||||
};
|
||||
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
||||
|
||||
@@ -111,8 +111,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "40645a27fd55bbe0fa2065a90496fc823f45ff6e",
|
||||
"version" : "1.0.93-alpha"
|
||||
"revision" : "6d6c13bcf3bf900932599a62e2a157224d762630",
|
||||
"version" : "1.0.94-alpha"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -308,8 +308,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
stateMachine.tryEvent(.presentEmojiPicker(itemID: itemID))
|
||||
case .presentLocationPicker:
|
||||
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .picker))
|
||||
case .presentLocationViewer(_, let geoURI):
|
||||
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .viewOnly(geoURI: geoURI)))
|
||||
case .presentLocationViewer(_, let geoURI, let description):
|
||||
stateMachine.tryEvent(.presentMapNavigator(interactionMode: .viewOnly(geoURI: geoURI, description: description)))
|
||||
case .presentRoomMemberDetails(member: let member):
|
||||
stateMachine.tryEvent(.presentRoomMemberDetails(member: .init(value: member)))
|
||||
case .presentMessageForwarding(let itemID):
|
||||
@@ -513,7 +513,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
switch action {
|
||||
case .selectedLocation(let geoURI):
|
||||
Task {
|
||||
_ = await self.roomProxy?.sendLocation(body: geoURI.bodyMessage, geoURI: geoURI)
|
||||
_ = await self.roomProxy?.sendLocation(body: geoURI.bodyMessage,
|
||||
geoURI: geoURI,
|
||||
description: nil,
|
||||
zoomLevel: nil,
|
||||
assetType: .pin)
|
||||
self.navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
}
|
||||
case .close:
|
||||
|
||||
@@ -705,23 +705,23 @@ class RoomProxyMock: RoomProxyProtocol {
|
||||
}
|
||||
//MARK: - sendLocation
|
||||
|
||||
var sendLocationBodyGeoURICallsCount = 0
|
||||
var sendLocationBodyGeoURICalled: Bool {
|
||||
return sendLocationBodyGeoURICallsCount > 0
|
||||
var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCallsCount = 0
|
||||
var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCalled: Bool {
|
||||
return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCallsCount > 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>)?
|
||||
var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedArguments: (body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?)?
|
||||
var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedInvocations: [(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?)] = []
|
||||
var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReturnValue: Result<Void, RoomProxyError>!
|
||||
var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure: ((String, GeoURI, String?, UInt8?, AssetType?) 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)
|
||||
func sendLocation(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?) async -> Result<Void, RoomProxyError> {
|
||||
sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCallsCount += 1
|
||||
sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedArguments = (body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType)
|
||||
sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedInvocations.append((body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType))
|
||||
if let sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure {
|
||||
return await sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure(body, geoURI, description, zoomLevel, assetType)
|
||||
} else {
|
||||
return sendLocationBodyGeoURIReturnValue
|
||||
return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - retrySend
|
||||
|
||||
@@ -30,7 +30,7 @@ enum RoomScreenCoordinatorAction {
|
||||
case presentMediaUploadPreviewScreen(URL)
|
||||
case presentRoomDetails
|
||||
case presentLocationPicker
|
||||
case presentLocationViewer(body: String, geoURI: GeoURI)
|
||||
case presentLocationViewer(body: String, geoURI: GeoURI, description: String?)
|
||||
case presentEmojiPicker(itemID: String)
|
||||
case presentRoomMemberDetails(member: RoomMemberProxyProtocol)
|
||||
case presentMessageForwarding(itemID: String)
|
||||
@@ -85,8 +85,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.send(.presentRoomMemberDetails(member: member))
|
||||
case .displayMessageForwarding(let itemID):
|
||||
actionsSubject.send(.presentMessageForwarding(itemID: itemID))
|
||||
case .displayLocation(let body, let geoURI):
|
||||
actionsSubject.send(.presentLocationViewer(body: body, geoURI: geoURI))
|
||||
case .displayLocation(let body, let geoURI, let description):
|
||||
actionsSubject.send(.presentLocationViewer(body: body, geoURI: geoURI, description: description))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ enum RoomScreenViewModelAction {
|
||||
case displayMediaUploadPreviewScreen(url: URL)
|
||||
case displayRoomMemberDetails(member: RoomMemberProxyProtocol)
|
||||
case displayMessageForwarding(itemID: String)
|
||||
case displayLocation(body: String, geoURI: GeoURI)
|
||||
case displayLocation(body: String, geoURI: GeoURI, description: String?)
|
||||
}
|
||||
|
||||
enum RoomScreenComposerMode: Equatable {
|
||||
|
||||
@@ -223,8 +223,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
switch action {
|
||||
case .displayMediaFile(let file, let title):
|
||||
state.bindings.mediaPreviewItem = MediaPreviewItem(file: file, title: title)
|
||||
case .displayLocation(let body, let geoURI):
|
||||
callback?(.displayLocation(body: body, geoURI: geoURI))
|
||||
case .displayLocation(let body, let geoURI, let description):
|
||||
callback?(.displayLocation(body: body, geoURI: geoURI, description: description))
|
||||
case .none:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ struct TimelineReplyView_Previews: PreviewProvider {
|
||||
thumbnailSource: imageSource))))
|
||||
TimelineReplyView(placement: .timeline,
|
||||
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Alice"),
|
||||
contentType: .location(.init(body: "", geoURI: nil))))
|
||||
contentType: .location(.init(body: ""))))
|
||||
}
|
||||
.environmentObject(viewModel.context)
|
||||
}
|
||||
|
||||
@@ -65,13 +65,14 @@ struct LocationRoomTimelineView_Previews: PreviewProvider {
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(body: "Fallback geo uri description", geoURI: nil)))
|
||||
content: .init(body: "Fallback geo uri description")))
|
||||
|
||||
LocationRoomTimelineView(timelineItem: .init(id: UUID().uuidString,
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(body: "Fallback geo uri description", geoURI: .init(latitude: 41.902782, longitude: 12.496366))))
|
||||
content: .init(body: "Fallback geo uri description",
|
||||
geoURI: .init(latitude: 41.902782, longitude: 12.496366))))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,7 +372,11 @@ class RoomProxy: RoomProxyProtocol {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
func sendLocation(body: String, geoURI: GeoURI) async -> Result<Void, RoomProxyError> {
|
||||
func sendLocation(body: String,
|
||||
geoURI: GeoURI,
|
||||
description: String?,
|
||||
zoomLevel: UInt8?,
|
||||
assetType: AssetType?) async -> Result<Void, RoomProxyError> {
|
||||
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||
defer {
|
||||
sendMessageBackgroundTask?.stop()
|
||||
@@ -381,7 +385,12 @@ class RoomProxy: RoomProxyProtocol {
|
||||
let transactionId = genTransactionId()
|
||||
|
||||
return await Task.dispatch(on: userInitiatedDispatchQueue) {
|
||||
.success(self.room.sendLocation(body: body, geoUri: geoURI.string, txnId: transactionId))
|
||||
.success(self.room.sendLocation(body: body,
|
||||
geoUri: geoURI.string,
|
||||
description: description,
|
||||
zoomLevel: zoomLevel,
|
||||
assetType: assetType,
|
||||
txnId: transactionId))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,11 @@ protocol RoomProxyProtocol {
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func sendLocation(body: String, geoURI: GeoURI) async -> Result<Void, RoomProxyError>
|
||||
func sendLocation(body: String,
|
||||
geoURI: GeoURI,
|
||||
description: String?,
|
||||
zoomLevel: UInt8?,
|
||||
assetType: AssetType?) async -> Result<Void, RoomProxyError>
|
||||
|
||||
/// Retries sending a failed message given its transaction ID
|
||||
func retrySend(transactionID: String) async
|
||||
|
||||
@@ -118,7 +118,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
switch timelineItem {
|
||||
case let item as LocationRoomTimelineItem:
|
||||
guard let geoURI = item.content.geoURI else { return .none }
|
||||
return .displayLocation(body: item.content.body, geoURI: geoURI)
|
||||
return .displayLocation(body: item.content.body, geoURI: geoURI, description: item.content.description)
|
||||
default:
|
||||
return await displayMediaActionIfPossible(timelineItem: timelineItem)
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ enum RoomTimelineControllerCallback {
|
||||
|
||||
enum RoomTimelineControllerAction {
|
||||
case displayMediaFile(file: MediaFileHandleProxy, title: String?)
|
||||
case displayLocation(body: String, geoURI: GeoURI)
|
||||
case displayLocation(body: String, geoURI: GeoURI, description: String?)
|
||||
case none
|
||||
}
|
||||
|
||||
|
||||
+20
@@ -17,4 +17,24 @@
|
||||
struct LocationRoomTimelineItemContent: Hashable {
|
||||
let body: String
|
||||
let geoURI: GeoURI?
|
||||
let description: String?
|
||||
let zoomLevel: UInt8?
|
||||
let asset: AssetType?
|
||||
|
||||
enum AssetType {
|
||||
case sender
|
||||
case pin
|
||||
}
|
||||
|
||||
init(body: String,
|
||||
geoURI: GeoURI? = nil,
|
||||
description: String? = nil,
|
||||
zoomLevel: UInt8? = nil,
|
||||
asset: AssetType? = nil) {
|
||||
self.body = body
|
||||
self.geoURI = geoURI
|
||||
self.description = description
|
||||
self.zoomLevel = zoomLevel
|
||||
self.asset = asset
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,11 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
}
|
||||
|
||||
private func buildLocationTimelineItemContent(_ locationContent: LocationContent) -> LocationRoomTimelineItemContent {
|
||||
LocationRoomTimelineItemContent(body: locationContent.body, geoURI: .init(string: locationContent.geoUri))
|
||||
LocationRoomTimelineItemContent(body: locationContent.body,
|
||||
geoURI: .init(string: locationContent.geoUri),
|
||||
description: locationContent.description,
|
||||
zoomLevel: locationContent.zoomLevel,
|
||||
asset: locationContent.asset.map { .init(assetType: $0) })
|
||||
}
|
||||
|
||||
private func buildFileTimelineItemContent(_ messageContent: FileMessageContent) -> FileRoomTimelineItemContent {
|
||||
@@ -528,3 +532,14 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension LocationRoomTimelineItemContent.AssetType {
|
||||
init(assetType: MatrixRustSDK.AssetType) {
|
||||
switch assetType {
|
||||
case .sender:
|
||||
self = .sender
|
||||
case .pin:
|
||||
self = .pin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ include:
|
||||
packages:
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||
exactVersion: 1.0.93-alpha
|
||||
exactVersion: 1.0.94-alpha
|
||||
# path: ../matrix-rust-sdk
|
||||
DesignKit:
|
||||
path: DesignKit
|
||||
|
||||
Reference in New Issue
Block a user