fix: 通知模式完成最后任务后跳到新任务页而非首页

原因:filterTaskIds 过滤为空数组后 isNotEmpty()=false
跳过了通知模式分支,走了正常 status=2 查询显示了新任务
修复:ids != null 就进通知分支,空数组+hasActioned 直接回首页

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-05-07 21:41:33 +09:30
parent d38060e9b3
commit 7c631025ba

View File

@@ -133,13 +133,26 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
// 已操作过的刷新不显示 loading保持当前内容避免黑屏
if (!hasActioned) showLoading()
// 通知跳转:有 taskIds 时不走 queryTaskIds直接按 ID 构建列表
// 通知跳转模式
val ids = filterTaskIds
if (ids != null && ids.isNotEmpty()) {
taskList = ids.map { TaskItem(id = it) }
Timber.d("任务列表: 通知模式, ${ids.size} 个任务")
if (taskList.isNotEmpty()) {
if (ids != null) {
if (ids.isNotEmpty()) {
taskList = ids.map { TaskItem(id = it) }
Timber.d("任务列表: 通知模式, ${ids.size} 个任务")
if (taskIndex >= taskList.size) taskIndex = taskList.size - 1
fetchCurrentDetail()
} else if (hasActioned) {
// 通知模式所有任务操作完毕 → 回首页
tipDialog.show(
status = QuTipDialog.Status.SUCCESS,
title = "全部完成",
back = true, step = 1, countdown = 2,
onBack = {
if (isAdded && view != null) {
findNavController().popBackStack(R.id.homeFragment, false)
}
}
)
} else {
showEmpty()
}
@@ -166,7 +179,10 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
title = "全部完成",
back = true, step = 1, countdown = 2,
onBack = {
if (isAdded && view != null) findNavController().popBackStack()
if (isAdded && view != null) {
// 直接回到首页(跳过中间可能的导航栈)
findNavController().popBackStack(R.id.homeFragment, false)
}
}
)
} else {