From d38777d06a72af6fae1b0c58f1a642d5fcd93fca Mon Sep 17 00:00:00 2001 From: tuuz Date: Thu, 14 Mar 2024 15:05:01 +0800 Subject: [PATCH] =?UTF-8?q?notice=E7=B1=BB=E6=B6=88=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9Esource=EF=BC=8C=E8=A7=A3=E5=86=B3poke?= =?UTF-8?q?=E7=AD=89=E7=89=B9=E6=AE=8A=E6=B6=88=E6=81=AF=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8A=9E=E6=B3=95=E7=9B=B4=E6=8E=A5=E5=88=A4=E6=96=AD=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=9D=A5=E6=BA=90=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E9=80=9A=E8=BF=87notice=E7=B1=BB?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=9A=84source=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E5=8F=AF=E5=88=A4=E6=96=AD=E9=9C=80=E8=A6=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=82=A3=E7=A7=8Dstruct=E6=9D=A5=E6=8E=A5=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/api/GlobalEventTransmitter.kt | 56 ++++++++++++------- .../remote/service/data/push/NoticeEvent.kt | 19 ++++--- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/GlobalEventTransmitter.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/GlobalEventTransmitter.kt index 29bbb4b1..2f6d1e73 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/GlobalEventTransmitter.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/GlobalEventTransmitter.kt @@ -21,6 +21,7 @@ import moe.fuqiuluo.shamrock.remote.service.data.push.MsgSubType import moe.fuqiuluo.shamrock.remote.service.data.push.MsgType import moe.fuqiuluo.shamrock.remote.service.data.push.PostType import moe.fuqiuluo.shamrock.remote.service.data.push.MessageEvent +import moe.fuqiuluo.shamrock.remote.service.data.push.MessageSource import moe.fuqiuluo.shamrock.remote.service.data.push.MessageTempSource import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeEvent import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeSubType @@ -235,7 +236,8 @@ internal object GlobalEventTransmitter: BaseSvc() { url = url, subId = fileSubId, expire = expireTime - ) + ), + messageSource =MessageSource.Private )) return true } @@ -258,16 +260,17 @@ internal object GlobalEventTransmitter: BaseSvc() { selfId = app.longAccountUin, postType = PostType.Notice, type = NoticeType.GroupUpload, + groupId = groupId, operatorId = userId, userId = userId, - groupId = groupId, file = GroupFileMsg( id = uuid, name = fileName, size = fileSize, busid = bizId.toLong(), url = url - ) + ), + messageSource =MessageSource.Private )) return true } @@ -284,13 +287,14 @@ internal object GlobalEventTransmitter: BaseSvc() { postType = PostType.Notice, type = NoticeType.Notify, subType = NoticeSubType.Sign, - userId = target, groupId = groupCode, + userId = target, target = target, signDetail = SignDetail( rankImg = rankImg, action = action - ) + ), + messageSource =MessageSource.Group )) return true } @@ -306,6 +310,7 @@ internal object GlobalEventTransmitter: BaseSvc() { userId = operation, groupId = groupCode, target = target, + messageSource =MessageSource.Group, pokeDetail = PokeDetail( action = action, suffix = suffix, @@ -331,14 +336,15 @@ internal object GlobalEventTransmitter: BaseSvc() { postType = PostType.Notice, type = noticeType, subType = noticeSubType, + groupId = groupCode, operatorId = operator, + operatorUid = operatorUid, userId = target, + userUid = targetUid, senderId = operator, target = target, - groupId = groupCode, targetUid = targetUid, - operatorUid = operatorUid, - userUid = targetUid + messageSource =MessageSource.Group, )) return true } @@ -356,12 +362,13 @@ internal object GlobalEventTransmitter: BaseSvc() { postType = PostType.Notice, type = NoticeType.GroupAdminChange, subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet, + groupId = groupCode, operatorId = 0, userId = target, userUid = targetUid, target = target, targetUid = targetUid, - groupId = groupCode + messageSource =MessageSource.Group, )) return true } @@ -382,14 +389,15 @@ internal object GlobalEventTransmitter: BaseSvc() { postType = PostType.Notice, type = NoticeType.GroupBan, subType = subType, + groupId = groupCode, operatorId = operator, + operatorUid = operatorUid, userId = target, senderId = operator, - target = target, - groupId = groupCode, duration = duration, - operatorUid = operatorUid, - targetUid = targetUid + target = target, + targetUid = targetUid, + messageSource =MessageSource.Group, )) return true } @@ -407,11 +415,12 @@ internal object GlobalEventTransmitter: BaseSvc() { selfId = app.longAccountUin, postType = PostType.Notice, type = NoticeType.GroupRecall, + groupId = groupCode, operatorId = operator, userId = target, msgId = msgHash, tip = tipText, - groupId = groupCode + messageSource =MessageSource.Group, )) return true } @@ -428,10 +437,11 @@ internal object GlobalEventTransmitter: BaseSvc() { selfId = app.longAccountUin, postType = PostType.Notice, type = NoticeType.GroupCard, + groupId = groupId, userId = targetId, cardNew = newCard, cardOld = oldCard, - groupId = groupId + messageSource =MessageSource.Group, )) return true } @@ -447,10 +457,11 @@ internal object GlobalEventTransmitter: BaseSvc() { selfId = app.longAccountUin, postType = PostType.Notice, type = NoticeType.Notify, - userId = targetId, + subType = NoticeSubType.Title, groupId = groupId, + userId = targetId, title = title, - subType = NoticeSubType.Title + messageSource =MessageSource.Group, )) return true } @@ -468,11 +479,12 @@ internal object GlobalEventTransmitter: BaseSvc() { selfId = app.longAccountUin, postType = PostType.Notice, type = NoticeType.Essence, - senderId = senderUin, + subType = subType, groupId = groupId, operatorId = operatorUin, + senderId = senderUin, msgId = msgId, - subType = subType + messageSource =MessageSource.Group, )) return true } @@ -497,7 +509,8 @@ internal object GlobalEventTransmitter: BaseSvc() { actionImg = actionImg, action = action, suffix = suffix - ) + ), + messageSource =MessageSource.Private )) return true } @@ -511,7 +524,8 @@ internal object GlobalEventTransmitter: BaseSvc() { operatorId = operation, userId = operation, msgId = msgHashId, - tip = tipText + tip = tipText, + messageSource =MessageSource.Private, )) return true } diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt index 82871829..cf333566 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt @@ -27,27 +27,20 @@ internal enum class RequestType { @Serializable internal enum class NoticeSubType { @SerialName("none") None, - @SerialName("ban") Ban, @SerialName("lift_ban") LiftBan, - @SerialName("set") Set, @SerialName("unset") UnSet, - @SerialName("add") Add, @SerialName("invite") Invite, @SerialName("approve") Approve, @SerialName("leave") Leave, @SerialName("kick") Kick, @SerialName("kick_me") KickMe, - @SerialName("poke") Poke, @SerialName("sign") Sign, - - @SerialName("title") Title, @SerialName("delete") Delete, - } @Serializable @@ -57,6 +50,13 @@ internal enum class RequestSubType { @SerialName("invite") Invite, } +@Serializable +internal enum class MessageSource { + @SerialName("group") Group, + + @SerialName("private") Private, +} + /** * 不要使用继承的方式实现通用字段,那样会很难维护! */ @@ -97,6 +97,7 @@ internal data class NoticeEvent( // 群打卡 @SerialName("sign_detail") val signDetail: SignDetail? = null, + @SerialName("source") val messageSource: MessageSource? = null, ) @@ -138,7 +139,7 @@ internal data class PrivateFileMsg( ) @Serializable -internal data class PokeDetail ( +internal data class PokeDetail( val action: String? = "戳了戳", val suffix: String? = "", @SerialName("action_img_url") @@ -146,7 +147,7 @@ internal data class PokeDetail ( ) @Serializable -internal data class SignDetail ( +internal data class SignDetail( val action: String? = "今日第1个打卡", @SerialName("rank_img") val rankImg: String? = "",