fix: 返回首页时补显示红点

HomeFragment暂停时(在任务详情页等)收到的NewTaskArrived事件会丢失,
返回首页后红点不显示。onResume中检查pendingCount,补刷统计和红点。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-04-29 15:52:16 +09:30
parent 379d784f70
commit 2fd8b7f80d

View File

@@ -126,6 +126,14 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
observePunchState() observePunchState()
} }
override fun onResume() {
super.onResume()
// 从其他页面返回时,检查是否有未读通知需要显示红点
if (notificationManager.pendingCount > 0) {
fetchStatistics(checkDots = true)
}
}
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
// 清理 Activity 回调,避免泄漏 // 清理 Activity 回调,避免泄漏