From 0e6ed1c51e7db0b0560fb3ae39fedf167a49c93b Mon Sep 17 00:00:00 2001 From: Sorunome Date: Mon, 16 Aug 2021 19:03:15 +0200 Subject: [PATCH] feat: Allow specifying extraContent for Room.sendFileEvent, in case clients want to specify some custom stuff --- lib/src/room.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 7277ec6b..0a695eda 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -628,6 +628,7 @@ class Room { /// the uploaded file. If [waitUntilSent] is true, the future will wait until /// the message event has received the server. Otherwise the future will only /// wait until the file has been uploaded. + /// Optionally specify [extraContent] to tack on to the event. Future sendFileEvent( MatrixFile file, { String txid, @@ -635,6 +636,7 @@ class Room { String editEventId, bool waitUntilSent = false, MatrixImageFile thumbnail, + Map extraContent, }) async { MatrixFile uploadFile = file; // ignore: omit_local_variable_types MatrixFile uploadThumbnail = thumbnail; // ignore: omit_local_variable_types @@ -703,7 +705,8 @@ class Room { 'hashes': {'sha256': encryptedThumbnail.sha256} }, if (thumbnail != null) 'thumbnail_info': thumbnail.info, - } + }, + if (extraContent != null) ...extraContent, }; final sendResponse = sendEvent( content,