(WearOS) Removes task observer after all tasks are completed

The task observer is now only removed after all tasks are completed, allowing due tasks to be checked.
This commit is contained in:
Hafiz 2025-06-06 13:37:57 -05:00 committed by Phillip Thelen
parent 0461cc35f5
commit f281e2ec0f
2 changed files with 10 additions and 1 deletions

View file

@ -37,12 +37,16 @@ class RYAActivity : BaseActivity<ActivityRyaBinding, RYAViewModel>() {
} else {
binding.scrollView.isVisible = true
createTaskListViews(value)
viewModel.tasks.removeObserver(this)
// only remove the observer if all tasks are completed
if (viewModel.areAllTasksCompleted(value)) {
viewModel.tasks.removeObserver(this)
}
}
}
}
)
binding.ryaButton.setOnClickListener {
binding.titleView.text = getString(R.string.check_off_yesterday)
binding.descriptionView.isVisible = false

View file

@ -72,4 +72,9 @@ constructor(
appStateManager.endLoading()
}
}
fun areAllTasksCompleted(tasks: List<Task>): Boolean {
return tasks.all { it.completed }
}
}