mawaqit / android-tv-app

Prayer times App for Android TV
https://mawaqit.net
Other
34 stars 15 forks source link

fix: LateInitializationError in AnnouncementWorkflowNotifier #1192

Open YassinNouh21 opened 6 days ago

YassinNouh21 commented 6 days ago

📝 Summary

This PR for issue #1158

Description

This pull request addresses a critical issue where a LateInitializationError occurs in the AnnouncementWorkflowNotifier class. The error is caused by accessing the '_timer' field before it has been properly initialized, leading to app crashes on Android TV devices.

Key changes:

  1. Modified AnnouncementWorkflowNotifier to ensure '_timer' is correctly initialized before use.
  2. Implemented null checks and error handling to prevent crashes if initialization fails.
  3. Refactored timer logic to be more robust and less susceptible to race conditions.

These changes aim to resolve the high-priority crash affecting users on Android TV devices, improving app stability and overall user experience.

Tests

🧪 Use case 1: Normal app flow

💬 Description:

  1. Launch the app on an Android TV device
  2. Navigate through various screens that utilize the AnnouncementWorkflowNotifier
  3. Verify that no crashes occur and the announcement workflow functions as expected

📷 Screenshots or GIFs (if applicable): [No screenshots provided as this is a backend fix without visual changes]

Checklist: