Skip to content

Commit

Permalink
fix: OpenFriendChatHistory on QQnt before
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Nov 3, 2024
1 parent 678be6f commit 394db1a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/cc/ioctl/hook/friend/OpenFriendChatHistory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object OpenFriendChatHistory : IUiItemAgent, IUiItemAgentProvider {
fun startFriendChatHistoryActivity(context: Context, uin: Long) {
if (uin < 10000L) return
try {
startFriendChatHistory(context, uin.toString(), true)
startFriendChatHistory(context, uin.toString(), false)
} catch (e: NumberFormatException) {
return
}
Expand All @@ -116,18 +116,18 @@ object OpenFriendChatHistory : IUiItemAgent, IUiItemAgentProvider {
fun startFriendChatHistoryActivity(context: Context, uid: String) {
if (!(uid.startsWith("u_") && uid.length == 24)) return
try {
startFriendChatHistory(context, uid, false)
startFriendChatHistory(context, uid, true)
} catch (e: NumberFormatException) {
return
}
}

private fun startFriendChatHistory(context: Context, userUinOrUid: String, isUin: Boolean) {
private fun startFriendChatHistory(context: Context, userUinOrUid: String, isUid: Boolean) {
try {
if (QAppUtils.isQQnt()) {
val peerId = if (isUin) QAppUtils.UserUinToPeerID(userUinOrUid) else userUinOrUid
val peerId = if (isUid) userUinOrUid else QAppUtils.UserUinToPeerID(userUinOrUid)
if (peerId == null) {
FaultyDialog.show(context, "打开好友聊天记录错误", "无法获取 uid")
FaultyDialog.show(context, "打开好友聊天记录错误", "无法获取 peerId")
return
}
val kNTChatHistoryActivity = Initiator.loadClass("com.tencent.mobileqq.activity.history.NTChatHistoryActivity")
Expand All @@ -138,7 +138,7 @@ object OpenFriendChatHistory : IUiItemAgent, IUiItemAgentProvider {
}
context.startActivity(intent)
} else {
if (isUin) {
if (isUid) {
FaultyDialog.show(context, "打开好友聊天记录错误", "非 QQNT 版本无法使用 uid 打开")
return
}
Expand Down

0 comments on commit 394db1a

Please sign in to comment.