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

Add SdkComponent and move configuration fetch out of BraintreeClient #1203

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

tdchow
Copy link
Collaborator

@tdchow tdchow commented Nov 7, 2024

Summary of changes

  • Created ConfigurationLoaderResult to make it easier to handle ConfigurationLoaderCallback.onResult()
  • Move the fetching of configuration to AnalyticsClient
  • Move latency analytics call to configuration loader
  • Create SdkComponent for instantiating classes that require Context

Checklist

  • Added a changelog entry
  • Relevant test coverage

Authors

List GitHub usernames for everyone who contributed to this pull request.

@tdchow tdchow requested a review from saperi22 November 13, 2024 22:01
@tdchow tdchow marked this pull request as ready for review November 13, 2024 22:01
@tdchow tdchow requested a review from a team as a code owner November 13, 2024 22:01
integration
)
fun sendEvent(event: AnalyticsEvent) {
configurationLoader.loadConfiguration { result ->
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the fetching of Configuration here

@tdchow tdchow changed the title [WIP] Add SdkComponent and move configuration fetch out of BraintreeClient Add SdkComponent and move configuration fetch out of BraintreeClient Nov 13, 2024
* Returns the instance of [SdkComponent]
*/
fun getInstance(): SdkComponent {
return checkNotNull(instance)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this ever is null what happens at that point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would throw an IllegalStateException. However this should never happen since create() would be called before getInstance(), which would set the singleton instance.

@tdchow tdchow merged commit c9d4246 into main Nov 14, 2024
3 checks passed
@tdchow tdchow deleted the remove-context-from-analytics-client branch November 14, 2024 16:02
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.

3 participants