From 6b414b7791297d80aad0066e993bb80347bc2eb8 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 10 Mar 2026 12:04:36 +0200 Subject: [PATCH] change(location_sharing): make the asset type non-optional as per original MSC instructions - https://github.com/matrix-org/matrix-spec-proposals/blob/matthew/location/proposals/3488-location.md - `If m.asset is missing from the location's content the client should render it as m.self as that will be the most common use case. Otherwise, if it's not missing but the type is invalid or unknown the client should attempt to render it as a generic location. Clients should be able to distinguish between m.self and explicit assets for this feature to be correctly implemented as interpreting everything as m.self is unwanted.` - this aligns the behavior with the newly introduced live location asset type handling --- bindings/matrix-sdk-ffi/src/ruma.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/ruma.rs b/bindings/matrix-sdk-ffi/src/ruma.rs index c5b0ad247..1de3362c9 100644 --- a/bindings/matrix-sdk-ffi/src/ruma.rs +++ b/bindings/matrix-sdk-ffi/src/ruma.rs @@ -472,11 +472,7 @@ impl TryFrom for MessageType { geo_uri: c.geo_uri, description, zoom_level: zoom_level.and_then(|z| z.get().try_into().ok()), - asset: c.asset.and_then(|a| match a.type_ { - RumaAssetType::Self_ => Some(AssetType::Sender), - RumaAssetType::Pin => Some(AssetType::Pin), - _ => None, - }), + asset: c.asset.map(|a| a.type_).into(), }, } } @@ -927,7 +923,7 @@ pub struct LocationContent { pub geo_uri: String, pub description: Option, pub zoom_level: Option, - pub asset: Option, + pub asset: AssetType, } #[derive(Clone, uniffi::Enum)] @@ -957,6 +953,15 @@ impl From for AssetType { } } +impl From> for AssetType { + fn from(value: Option) -> Self { + match value { + None => Self::Sender, + Some(asset_type) => asset_type.into(), + } + } +} + #[derive(Clone, uniffi::Record)] pub struct FormattedBody { pub format: MessageFormat,