Skip to content

Remove the search module's dependency on other feature modules - #1271

Merged
dturner merged 5 commits into
mainfrom
dt/remove-feature-dep
Mar 15, 2024
Merged

dturner merged 5 commits into
mainfrom
dt/remove-feature-dep

Conversation

@dturner

@dturner dturner commented Mar 11, 2024 •

Copy link
Copy Markdown
Collaborator

What I have done and why
The :feature:search module depended on the :feature:foryou, :feature:bookmarks and :feature:interests modules.

It is bad practice for :feature modules to depend on other feature modules. Common functionality should be abstracted into :core modules and shared between those feature modules. This makes it clear what is unique to a given feature, and what is shared.

With this in mind I have:

  • Refactored the SearchScreen composable to accept only a single view model SearchViewModel (it previously required an InterestsViewModel and a BookmarksViewModel).
  • Added the functions provided by those other view models into SearchViewModel. I considered adding use cases for these but decided that since there is zero logic involved (they are one-line calls to repository methods) it keeps things simple to just add them directly.
  • Moved InterestsItem into :core:ui so it can be shared between the :feature:interests and :feature:search modules.

Fixes #707
Related #810

:feature:search Dependency graph

Before After
image image

dturner added 4 commits March 14, 2024 17:38
Change-Id: I17df9948fed04ddc7ba507b437d39536b8b180bb
Change-Id: Ib6aa372a1ab3b13b5c69c1d3feec2c31e5dca3ce
Change-Id: Ide4cb90abc2ae7ca78488909a37df685c2e71ec6
Change-Id: I5b08ce68522c59cdd7f7ec56a14a7ebc8b3868cd
@dturner
dturner force-pushed the dt/remove-feature-dep branch from 6319254 to b5bfe44 Compare March 14, 2024 17:38
Change-Id: Ia2fe3f339b26bf64dd965fc1aa58a957cb7c7f93
@dturner
dturner merged commit 0584f19 into main Mar 15, 2024
@dturner
dturner deleted the dt/remove-feature-dep branch March 15, 2024 07:54
@dturner dturner mentioned this pull request Mar 15, 2024
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.

[Bug]: Search feature is dependent on other feature modules

2 participants