Skip to content

Commit 486b61c

Browse files
refactor(viewmodel): Generalize and streamline list building logic
This commit introduces a generic `buildList` function in `MainViewModel` to abstract the common logic for filtering, sorting, and building scroll maps for different data types. Key changes: - A new generic `buildList<T, R>` function handles common list processing tasks like filtering by hidden/pinned status, sorting, and generating sidebar scroll indexes. - `getAppsList` and `getContactsList` are refactored to use this new `buildList` function, significantly reducing code duplication and improving clarity. - List observation in `AppDrawerFragment` is simplified by introducing a local generic `observeList` helper function, reducing boilerplate for observing `LiveData` sources. - App list loading now groups apps by profile type more efficiently and uses the new `buildList` function for final processing.
1 parent acebc4d commit 486b61c

File tree

2 files changed

+276
-338
lines changed

2 files changed

+276
-338
lines changed

0 commit comments

Comments
 (0)