debug: 红点逻辑添加详细日志
添加 baseline/diffStats/activeDotCards 每步日志, 用于排查红点不显示的具体断点。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -369,26 +369,27 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
val data = result.data
|
||||
|
||||
if (checkDots && notificationManager.pendingCount > 0) {
|
||||
// 用 preNotificationStats(通知前快照)做精确对比
|
||||
val baseline = notificationManager.preNotificationStats
|
||||
Timber.d("首页: checkDots baseline=$baseline, newData=$data, pendingCount=${notificationManager.pendingCount}")
|
||||
if (baseline != null) {
|
||||
val changed = notificationManager.diffStats(baseline, data)
|
||||
val ack = notificationManager.acknowledgedCards
|
||||
Timber.d("首页: diffStats changed=$changed, ack=$ack, activeDots=$activeDotCards")
|
||||
for (status in changed) {
|
||||
if (status !in ack) activeDotCards.add(status)
|
||||
}
|
||||
} else {
|
||||
// 无快照(极端情况)→ 所有有值的加红点
|
||||
Timber.d("首页: baseline为null,兜底显示所有有值的红点")
|
||||
val ack = notificationManager.acknowledgedCards
|
||||
if (data.waitForTask > 0 && 2 !in ack) activeDotCards.add(2)
|
||||
if (data.treatTask > 0 && 3 !in ack) activeDotCards.add(3)
|
||||
if (data.incompleteTask > 0 && 4 !in ack) activeDotCards.add(4)
|
||||
}
|
||||
Timber.d("首页: renderDots activeDotCards=$activeDotCards")
|
||||
renderDots()
|
||||
// 有通知时不更新 lastStats,保留旧基准给后续 diff
|
||||
} else {
|
||||
// 无通知的正常刷新 → 更新 lastStats 基准
|
||||
notificationManager.lastStats = data
|
||||
Timber.d("首页: lastStats 更新为 $data (无通知刷新)")
|
||||
}
|
||||
|
||||
// 更新数字
|
||||
|
||||
Reference in New Issue
Block a user