fix: 首次绑定后统计数字显示0,onResume始终刷新统计数据
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -166,13 +166,16 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
// 检查版本更新(5分钟最小间隔)
|
||||
(activity as? com.xiaoqu.watch.app.MainActivity)?.checkForUpdate()
|
||||
|
||||
if (notificationManager.pendingCount <= 0) {
|
||||
// 每次回到首页都刷新统计(解决首次绑定后数字为0、从子页返回数据过期的问题)
|
||||
if (notificationManager.pendingCount > 0) {
|
||||
// 有未读通知 → 刷新统计 + 红点
|
||||
fetchStatistics(checkDots = true)
|
||||
} else {
|
||||
activeDotCards.clear()
|
||||
renderDots()
|
||||
return
|
||||
// 无通知也要刷新数字(首次绑定、任务列表操作后返回等场景)
|
||||
fetchStatistics()
|
||||
}
|
||||
// 有未读通知 → 刷新统计 + 红点
|
||||
fetchStatistics(checkDots = true)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
Reference in New Issue
Block a user