From 5e1783eaa23ecfcb1be8e4cc032467f0eb96e7d5 Mon Sep 17 00:00:00 2001 From: OfficialDakari Date: Tue, 21 Oct 2025 19:23:49 +0500 Subject: [PATCH] implement sendLocation and sendFileEvent in Thread --- lib/src/thread.dart | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/src/thread.dart b/lib/src/thread.dart index 441c3f0f..1e09437f 100644 --- a/lib/src/thread.dart +++ b/lib/src/thread.dart @@ -125,4 +125,47 @@ class Thread { threadRootEventId: rootEvent.eventId, ); } + + Future sendLocation(String body, String geoUri, {String? txid}) { + final event = { + 'msgtype': 'm.location', + 'body': body, + 'geo_uri': geoUri, + }; + return room.sendEvent( + event, + txid: txid, + threadLastEventId: lastEvent?.eventId, + threadRootEventId: rootEvent.eventId, + ); + } + + Future sendFileEvent( + MatrixFile file, { + String? txid, + Event? inReplyTo, + String? editEventId, + int? shrinkImageMaxDimension, + MatrixImageFile? thumbnail, + Map? extraContent, + + /// Displays an event in the timeline with the transaction ID as the event + /// ID and a status of SENDING, SENT or ERROR until it gets replaced by + /// the sync event. Using this can display a different sort order of events + /// as the sync event does replace but not relocate the pending event. + bool displayPendingEvent = true, + }) async { + return await room.sendFileEvent( + file, + txid: txid, + inReplyTo: inReplyTo, + editEventId: editEventId, + shrinkImageMaxDimension: shrinkImageMaxDimension, + thumbnail: thumbnail, + extraContent: extraContent, + displayPendingEvent: displayPendingEvent, + threadLastEventId: lastEvent?.eventId, + threadRootEventId: rootEvent.eventId, + ); + } }