You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactored `NewsLabelManager` to use a `NewsRepository` and coroutines to move database operations off the main thread, fixing an ANR.
- Introduced `addLabel` and `removeLabel` suspend functions in `NewsRepository`.
- `NewsLabelManager` now uses a `CoroutineScope` from the view's `lifecycleScope` to call the repository methods asynchronously.
- Disabled the "add label" button and chip delete functionality during the async operation to prevent rapid double-clicks.
- Fixed a resource leak in `AdapterNews` by properly managing the Realm instance lifecycle within `onAttachedToRecyclerView` and `onDetachedFromRecyclerView`.
- Updated all call sites of `AdapterNews` (`NewsFragment`, `ReplyActivity`, `DiscussionListFragment`) to provide the `NewsRepository` dependency via Hilt.
- Resolved all compilation and Hilt dependency injection errors that arose from the refactoring.
0 commit comments