mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: fix #125
This commit is contained in:
parent
d9a045bbf0
commit
a2b3e42eee
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
package moe.fuqiuluo.qqinterface.servlet
|
package moe.fuqiuluo.qqinterface.servlet
|
||||||
|
|
||||||
|
import androidx.core.text.HtmlCompat
|
||||||
import com.tencent.common.app.AppInterface
|
import com.tencent.common.app.AppInterface
|
||||||
import com.tencent.mobileqq.app.BusinessHandlerFactory
|
import com.tencent.mobileqq.app.BusinessHandlerFactory
|
||||||
import com.tencent.mobileqq.app.QQAppInterface
|
import com.tencent.mobileqq.app.QQAppInterface
|
||||||
@ -805,12 +806,13 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
senderId = obj["u"].asLong,
|
senderId = obj["u"].asLong,
|
||||||
publishTime = obj["pubt"].asLong,
|
publishTime = obj["pubt"].asLong,
|
||||||
message = GroupAnnouncementMessage(
|
message = GroupAnnouncementMessage(
|
||||||
text = obj["msg"].asJsonObject["text"].asString,
|
// text = obj["msg"].asJsonObject["text"].asString,
|
||||||
images = obj["msg"].asJsonObject["pics"].asJsonArrayOrNull?.map {
|
text = fromHtml(obj["msg"].asJsonObject["text"].asString),
|
||||||
|
images = obj["msg"].asJsonObject["pics"].asJsonArrayOrNull?.map { pic ->
|
||||||
GroupAnnouncementMessageImage(
|
GroupAnnouncementMessageImage(
|
||||||
id = it.jsonObject["id"].asString,
|
id = pic.jsonObject["id"].asString,
|
||||||
width = it.jsonObject["w"].asString,
|
width = pic.jsonObject["w"].asString,
|
||||||
height = it.jsonObject["h"].asString,
|
height = pic.jsonObject["h"].asString,
|
||||||
)
|
)
|
||||||
} ?: ArrayList()
|
} ?: ArrayList()
|
||||||
)
|
)
|
||||||
@ -821,6 +823,14 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun fromHtml(htmlString: String): String {
|
||||||
|
return HtmlCompat
|
||||||
|
// 特殊处理 ,目的是替换为换行符,否则会被fromHtml忽略并移除
|
||||||
|
.fromHtml(htmlString.replace(" ", "[shamrockplaceholder]"), HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||||
|
.toString()
|
||||||
|
.replace("[shamrockplaceholder]", "\n")
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
suspend fun uploadImageTroopNotice(image: String): Result<GroupAnnouncementMessageImage> {
|
suspend fun uploadImageTroopNotice(image: String): Result<GroupAnnouncementMessageImage> {
|
||||||
val file = FileUtils.parseAndSave(image)
|
val file = FileUtils.parseAndSave(image)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user