mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
fix: add file IDs to request parameters for message send (#940)
This commit is contained in:
parent
865a69c49f
commit
7dcb566a57
@ -404,12 +404,19 @@ object OpenGroupApi {
|
||||
fileIds: List<String>? = null
|
||||
): Promise<OpenGroupMessage, Exception> {
|
||||
val signedMessage = message.sign(room, server, fallbackSigningType = IdPrefix.STANDARD) ?: return Promise.ofFail(Error.SigningFailed)
|
||||
val parameters = signedMessage.toJSON().toMutableMap()
|
||||
|
||||
// add file IDs if there are any (from attachments)
|
||||
if (!fileIds.isNullOrEmpty()) {
|
||||
parameters += "files" to fileIds
|
||||
}
|
||||
|
||||
val request = Request(
|
||||
verb = POST,
|
||||
room = room,
|
||||
server = server,
|
||||
endpoint = Endpoint.RoomMessage(room),
|
||||
parameters = signedMessage.toJSON()
|
||||
parameters = parameters
|
||||
)
|
||||
return getResponseBodyJson(request).map { json ->
|
||||
@Suppress("UNCHECKED_CAST") val rawMessage = json as? Map<String, Any>
|
||||
|
Loading…
Reference in New Issue
Block a user