{{ message }}
feat: 按会话控制发送后的已读上报并完善新版兼容 - #9
Merged
Merged
Conversation
Co-authored-by: Changyu Dai <kelsoprotein@gmail.com>
starccy
reviewed
Aug 12, 2026
Comment on lines
+101
to
+112
Owner
There was a problem hiding this comment.
感谢您的提交,整体没问题。就是 验证情况 这部分可以不用放在 README 里,在 PR 描述里就够了,毕竟使用者不会关心这些细节。然后麻烦您可以将适用的飞书版本号描述提到 README 的最前面吗
Contributor
Author
There was a problem hiding this comment.
感谢您的提交,整体没问题。就是
验证情况这部分可以不用放在 README 里,在 PR 描述里就够了,毕竟使用者不会关心这些细节。然后麻烦您可以将适用的飞书版本号描述提到 README 的最前面吗
@starccy 感谢review。我已删除README中的“验证情况”,并将适用版本说明移到开头,标明macOS飞书 7.53.16(已双账号手工验证通过)。麻烦您再看一下。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

背景
当前实现会在
updateMessagesMeRead调用前清空messageIds,从而阻止普通浏览触发已读回执。但在新版客户端中,已读请求除了消息 ID,还包含以下位置字段:maxPosition/maxPositionBadgeCountthreadMaxPosition/threadMaxPositionBadgeCountfoldIds实测中,即使
messageIds已被清空,只要这些会话或话题位置仍然上报,对方仍会在打开会话后立即看到已读。另一方面,完全屏蔽已读也会产生一个明显的交互问题:用户已经回复消息,对方却仍然看到未读。#8 已提出在
MessageService::sendMessage:onSendMessageSuccess:处放行一次已读上报的思路。本 PR 在该思路上继续完善,增加会话隔离、短时有效期和新版字段的完整处理。主要改动
1. 完整拦截普通浏览产生的已读请求
未获得发送许可时,不再只清空
messageIds,而是将本次上报中的所有已读信息恢复为无操作状态:messageIds和foldIdsmaxPosition=-1、maxPositionBadgeCount=0客户端内部仍可以处理原始消息列表,但传给 native 层的请求不再携带可推进服务端已读状态的信息。
2. 发送成功后按会话短时放行一次
在
MessageService::sendMessage:onSendMessageSuccess:锚点设置一次性许可:chatId,其他会话无法消费这样可以实现:普通查看保持未读;成功发送普通消息或引用回复后,当前会话此前的消息可以正常变为已读。
3. 支持多补丁锚点并在不兼容时快速失败
Patch结构4. 提高 ASAR 重打包可靠性
messenger.asar.tmp并验证可以重新打开--repatch,可以直接基于已有的原始.bak重新生成新版补丁5. 文档与测试
--repatch用法和限制条件行为预期
验证情况
python3 -m unittest discover -s tests -v:8/8 通过python3 -m py_compile main.py asar.py tests/test_patch.py tests/test_asar.pygit diff --checkmessenger.asar原始备份完成离线解包、修改、重打包和再次解包node --check.bak时可通过--repatch完成重新生成整个验证过程没有通过自动化工具操作或发送飞书消息,账号侧行为由人工双账号测试确认。
已知限制
与 #8 的关系
感谢 #8 提供“在
onSendMessageSuccess后放行一次已读上报”的实现方向和真机验证。本 PR 延续这一交互目标,并主要补充以下差异:--repatch及相应测试和文档