Skip to content

Fix notification task completion not updating local app state#2184

Open
Captain-Vikram wants to merge 1 commit intoHabitRPG:mainfrom
Captain-Vikram:fix/notification-completion-sync
Open

Fix notification task completion not updating local app state#2184
Captain-Vikram wants to merge 1 commit intoHabitRPG:mainfrom
Captain-Vikram:fix/notification-completion-sync

Conversation

@Captain-Vikram
Copy link
Copy Markdown

Problem:
When a user completes a task directly from a notification action, the BroadcastReceiver often finishes execution and the system kills the process before the asynchronous database updates can complete. This causes a sync issue where the task is marked done on the server (user gets XP/Drops), but remains unchecked in the local task list until a full refresh.

Solution:
This PR implements goAsync() in LocalNotificationActionReceiver. This keeps the BroadcastReceiver alive while the taskRepository.taskChecked coroutine is running, ensuring the local database update completes successfully before the receiver is destroyed.

Changes:

Wrapped the complete_task_action logic in LocalNotificationActionReceiver.kt with goAsync() and pendingResult.finish().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant