Move the remaining feature bindings out of the app module - #89
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After the api/presentation split,
:appstill registered ViewModels belonging to five features, andgitModulestill boundGitPanelApiImpl. Leaving them there means the app module keeps naming feature internals — the same coupling the split was meant to remove.Three of those bindings were also in the wrong feature's module entirely:
CloneRepoViewModel(a projects screen),AssetsViewModel(an editor screen) andGitAuthSettingsViewModel(a settings screen) all sat ingitModule, presumably because they touch git repositories.What changed
gitPresentationModulein:feature:git:presentation, holding the six git ViewModels and theGitPanelApibinding.CloneRepoViewModel→projectsModule,AssetsViewModel→editorModule,GitAuthSettingsViewModel→settingsModule.:app'sgitModulekeeps only the bindings that wire:domaincontracts to:dataimplementations.Why some bindings stay in :app
GitRepository,GitCredentialStore,GitHubDeviceAuthenticator,GitAuthorStoreandWorkspaceWriteGatebind:domaininterfaces to:data:gitclasses. That is the composition root's job, and a feature module is not allowed to see:data:*at all — the boundary check would reject it. Pushing them into features would trade one coupling for a worse one.So the rule is: a feature owns everything it implements;
:appowns the domain-to-data wiring.Behavior
No behavior change. The same definitions, declared by the module that owns the class.
Tests
KoinModuleGraphTestverifies the whole graph still resolves after the moves — a binding dropped or landed in the wrong module fails there rather than at runtime.verifyModuleBoundaries: 0 baseline entries, 0 violations.Verification
./gradlew test detekt verifyModuleBoundaries :app:assembleDebug— BUILD SUCCESSFUL.Verified on an emulator: project opens and the git panel renders through
GitPanelApi, now bound by the git feature rather than by:app. NoNoBeanDefFoundException,InstanceCreationExceptionor crash in logcat.Scope
:appstill references a few feature types that are genuinely app-level integrations rather than DI leaks: the volume-key dispatchers (hardware key routing from the Activity),PendingInstallConfirmation(an install result arriving at the Activity), and the git destination routes it hosts in the singleNavHost. Those are the composition root doing its job; moving them would need contracts that do not yet earn their keep.