fix sending attachments(image) in open groups

This commit is contained in:
Ryan ZHAO 2021-03-11 14:05:48 +11:00
parent 97a9446eae
commit b490ed0c22
2 changed files with 2 additions and 2 deletions

View File

@ -113,7 +113,7 @@ object OpenGroupAPI: DotNetAPI() {
val id = attachmentAsJSON["id"] as? Long ?: (attachmentAsJSON["id"] as? Int)?.toLong() ?: (attachmentAsJSON["id"] as String).toLong() val id = attachmentAsJSON["id"] as? Long ?: (attachmentAsJSON["id"] as? Int)?.toLong() ?: (attachmentAsJSON["id"] as String).toLong()
val contentType = attachmentAsJSON["contentType"] as String val contentType = attachmentAsJSON["contentType"] as String
val size = attachmentAsJSON["size"] as? Int ?: (attachmentAsJSON["size"] as? Long)?.toInt() ?: (attachmentAsJSON["size"] as String).toInt() val size = attachmentAsJSON["size"] as? Int ?: (attachmentAsJSON["size"] as? Long)?.toInt() ?: (attachmentAsJSON["size"] as String).toInt()
val fileName = attachmentAsJSON["fileName"] as String val fileName = attachmentAsJSON["fileName"] as? String
val flags = 0 val flags = 0
val url = attachmentAsJSON["url"] as String val url = attachmentAsJSON["url"] as String
val caption = attachmentAsJSON["caption"] as? String val caption = attachmentAsJSON["caption"] as? String

View File

@ -74,7 +74,7 @@ data class OpenGroupMessage(
attachment.id, attachment.id,
attachment.contentType!!, attachment.contentType!!,
attachment.size.orNull(), attachment.size.orNull(),
attachment.fileName.orNull(), attachment.fileName.orNull() ?: "",
0, 0,
attachment.width, attachment.width,
attachment.height, attachment.height,