Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EMBR-631] Make ApiUrlBuilder independent from ConfigService. #10

Merged
merged 22 commits into from
Nov 1, 2023

Conversation

lucaslabari
Copy link
Contributor

@lucaslabari lucaslabari commented Oct 18, 2023

Goal

  • There were 3 circular dependencies within the EssentialServicesModule:

    • ApiUrlBuilder -> EmbraceMetaDataService -> EmbraceConfigService -> EmbraceApiService -> ApiUrlBuilder
    • ApiUrlBuilder -> EmbraceConfigService -> EmbraceApiService -> ApiUrlBuilder
    • EmbraceConfigService -> EmbraceApiService -> NetworkConnectivityService -> EmbraceConfigService
  • The following image shows the interaction between the different components and in red the ones that are part of a circular dependency.

Screenshot 2023-10-27 at 12 21 02 PM
  • The dotted lines represent the dependency that is cut in this PR.

  • The green dotted lines represent the values that are passed to the constructor of that Class to break the circular dependency.

  • In the future, we can separate some of these components to another module so the dependencies are more clearly separated and EssentialServicesModule is not overloaded of services.

Testing

Updated existing unit tests.

@lucaslabari lucaslabari requested a review from a team as a code owner October 18, 2023 21:46
@notion-workspace
Copy link

bidetofevil

This comment was marked as outdated.

@fractalwrench

This comment has been minimized.

This comment has been minimized.

@lucaslabari

This comment has been minimized.

@lucaslabari lucaslabari marked this pull request as draft October 19, 2023 15:23
@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Merging #10 (6764ab3) into master (a03129f) will increase coverage by 0.15%.
The diff coverage is 89.52%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #10      +/-   ##
==========================================
+ Coverage   73.61%   73.76%   +0.15%     
==========================================
  Files         305      305              
  Lines       10041    10053      +12     
  Branches     1446     1447       +1     
==========================================
+ Hits         7392     7416      +24     
+ Misses       2077     2067      -10     
+ Partials      572      570       -2     
Files Coverage Δ
...k/capture/aei/EmbraceApplicationExitInfoService.kt 83.68% <100.00%> (+0.72%) ⬆️
...racesdk/capture/metadata/EmbraceMetadataService.kt 84.61% <100.00%> (-0.23%) ⬇️
...droid/embracesdk/comms/api/EmbraceApiUrlBuilder.kt 100.00% <100.00%> (ø)
.../android/embracesdk/config/EmbraceConfigService.kt 85.44% <ø> (-1.44%) ⬇️
...ndroid/embracesdk/injection/DataContainerModule.kt 100.00% <100.00%> (ø)
...mbracesdk/comms/delivery/EmbraceDeliveryService.kt 62.18% <0.00%> (ø)
.../connectivity/EmbraceNetworkConnectivityService.kt 73.40% <77.77%> (-0.79%) ⬇️
.../android/embracesdk/comms/api/EmbraceApiService.kt 47.44% <62.50%> (+1.28%) ⬆️
...oid/embracesdk/injection/EssentialServiceModule.kt 95.38% <91.52%> (-1.32%) ⬇️

... and 4 files with indirect coverage changes

@lucaslabari

This comment was marked as outdated.

@lucaslabari lucaslabari marked this pull request as ready for review October 27, 2023 15:28
Copy link
Collaborator

bidetofevil commented Oct 29, 2023

So basically, the crux of the change is to pull out some of the app/device info needed by various services in the EssentialServicesModule and passing them in at init time, rather than having them depend on ConfigService or MetadataService directly to get them?

Copy link
Collaborator

So I THINK we can make it so that we remove all the circular dependencies for ApiUrlBuilder, and only have appId not be directly consumed from a service. Essentially, the dep graph looks something like

MetadataService -> ConfigService -> ApiService -> ApiUrlBuilder -> PreferenceService

Copy link
Collaborator

@bidetofevil bidetofevil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@lucaslabari lucaslabari merged commit 6f92fc4 into master Nov 1, 2023
4 checks passed
@lucaslabari lucaslabari deleted the lucas/EMBR-631 branch November 1, 2023 20:06
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.

None yet

3 participants