refactor(di): Introduce @ProcessLifecycle qualifier for di#3978
Merged
Conversation
…ection This commit introduces the `@ProcessLifecycle` qualifier to disambiguate `Lifecycle` and `LifecycleOwner` dependency injections. This resolves an issue where `@ActivityScoped` bindings in `MeshServiceClient` were conflicting with the application-wide `ProcessLifecycleOwner` provider in `ApplicationModule`. - Created the `@ProcessLifecycle` qualifier annotation in the `core.di` package. - Updated `ApplicationModule` to provide `LifecycleOwner` and `Lifecycle` using the `@ProcessLifecycle` qualifier. - Annotated `Lifecycle` dependencies in `RadioInterfaceService`, `UsbRepository`, `NodeRepository`, and `BluetoothRepository` with `@ProcessLifecycle` to ensure they receive the application-level lifecycle. - Refactored `MeshServiceClient` to inject `@ActivityContext Context` instead of `Activity`, resolving the scope conflict and simplifying the code. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3978 +/- ##
========================================
- Coverage 0.52% 0.52% -0.01%
========================================
Files 394 394
Lines 23170 23172 +2
Branches 2943 2944 +1
========================================
Hits 122 122
- Misses 23027 23029 +2
Partials 21 21 ☔ View full report in Codecov by Sentry. |
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.
This commit introduces the
@ProcessLifecyclequalifier to disambiguateLifecycleandLifecycleOwnerdependency injections. This resolves an issue where@ActivityScopedbindings inMeshServiceClientwere conflicting with the application-wideProcessLifecycleOwnerprovider inApplicationModule.@ProcessLifecyclequalifier annotation in thecore.dipackage.ApplicationModuleto provideLifecycleOwnerandLifecycleusing the@ProcessLifecyclequalifier.Lifecycledependencies inRadioInterfaceService,UsbRepository,NodeRepository, andBluetoothRepositorywith@ProcessLifecycleto ensure they receive the application-level lifecycle.MeshServiceClientto inject@ActivityContext Contextinstead ofActivity, resolving the scope conflict and simplifying the code.