diff --git a/bindings/matrix-sdk-ffi/CHANGELOG.md b/bindings/matrix-sdk-ffi/CHANGELOG.md index 819b6245e..99db0fb5d 100644 --- a/bindings/matrix-sdk-ffi/CHANGELOG.md +++ b/bindings/matrix-sdk-ffi/CHANGELOG.md @@ -47,10 +47,11 @@ All notable changes to this project will be documented in this file. flags for selecting TLS backend, as `rustls` is the now the only supported TLS backend. ([#6409](https://github.com/matrix-org/matrix-rust-sdk/pull/6409)) -- Expose `event_type_raw` and `latest_content_raw()` on `EventTimelineItem`, - allowing clients to access the raw event type string and content JSON for +- Expose `event_type_raw` and `latest_json()` on `EventTimelineItem`, + allowing clients to access the raw event type string and full event JSON for custom event handling without pattern-matching through nested enums. ([#6387](https://github.com/matrix-org/matrix-rust-sdk/pull/6387)) + ([#6424](https://github.com/matrix-org/matrix-rust-sdk/pull/6424)) - Expose sync v2 API through FFI via `Client.sync_v2()` and `Client.sync_once_v2()`, enabling mobile clients to sync without requiring Sliding Sync support on the homeserver. `Client.sync_v2()` diff --git a/bindings/matrix-sdk-ffi/src/timeline/mod.rs b/bindings/matrix-sdk-ffi/src/timeline/mod.rs index 8eb011b8c..bec8cd84a 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/mod.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/mod.rs @@ -1327,14 +1327,11 @@ impl LazyTimelineItemProvider { self.0.contains_only_emojis() } - /// Returns the JSON string of the event's `content` field from the latest - /// version (including edits). Returns `None` for local echoes that haven't - /// been echoed back by the server yet. - fn latest_content_raw(&self) -> Option { - let raw = self.0.latest_json()?; - let value: serde_json::Value = serde_json::from_str(raw.json().get()).ok()?; - let content = value.get("content")?; - serde_json::to_string(content).ok() + /// Returns the full raw JSON string of the latest version of the event + /// (including edits). Returns `None` for local echoes that haven't been + /// echoed back by the server yet. + fn latest_json(&self) -> Option { + Some(self.0.latest_json()?.json().get().to_owned()) } }