Skip to content

Commit

Permalink
update 兼容视频号类型
Browse files Browse the repository at this point in the history
  • Loading branch information
gallonyin committed Aug 26, 2023
1 parent e76f704 commit 55fdde8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public class WeworkMessageBean {
* 群收集表类型 TEXT_TYPE_COLLECTION
* 接收带回复引用文本类型 TEXT_TYPE_REPLY
* 内部群通知机器人类型 TEXT_TYPE_NOTIFY_ROBOT
* 视频号视频类型 TEXT_TYPE_CHANNELS_VIDEO
* 视频号直播类型 TEXT_TYPE_CHANNELS_LIVE
*/
public static final int TEXT_TYPE = 0;
public static final int TEXT_TYPE_UNKNOWN = 0;
Expand All @@ -171,6 +173,8 @@ public class WeworkMessageBean {
public static final int TEXT_TYPE_COLLECTION = 14;
public static final int TEXT_TYPE_REPLY = 15;
public static final int TEXT_TYPE_NOTIFY_ROBOT = 16;
public static final int TEXT_TYPE_CHANNELS_VIDEO = 17;
public static final int TEXT_TYPE_CHANNELS_LIVE = 18;

//消息id(解析指令时同步)
public String messageId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ object WeworkTextUtil {
tvCount == 0 && ivCount == 1 -> WeworkMessageBean.TEXT_TYPE_IMAGE
tvCount == 2 && ivCount == 2 -> {
val parent = tvList[0].parent
if (parent != null && parent.childCount > 3) {
if ((tvList[0].text?.toString() ?: "").matches("直播中".toRegex())) {
WeworkMessageBean.TEXT_TYPE_CHANNELS_LIVE
} else if (parent != null && parent.childCount > 3) {
WeworkMessageBean.TEXT_TYPE_VIDEO
} else {
WeworkMessageBean.TEXT_TYPE_OFFICE
Expand Down Expand Up @@ -260,6 +262,7 @@ object WeworkTextUtil {
}
tvCount == 3 && ivCount == 0 -> WeworkMessageBean.TEXT_TYPE_REPLY
tvCount == 0 && ivCount == 0 -> WeworkMessageBean.TEXT_TYPE_NOTIFY_ROBOT
tvCount == 1 && ivCount == 3 -> WeworkMessageBean.TEXT_TYPE_CHANNELS_VIDEO
else -> WeworkMessageBean.TEXT_TYPE_UNKNOWN
}
}
Expand Down

0 comments on commit 55fdde8

Please sign in to comment.