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

Revisit MapboxMap plugin related extension functions to not use singletons #75

Merged
merged 3 commits into from
Feb 4, 2021

Conversation

kiryldz
Copy link
Contributor

@kiryldz kiryldz commented Feb 3, 2021

PRs must be submitted under the terms of our Contributor License Agreement CLA.
Fixes: #73
<changelog>Revisit MapboxMap plugin related extension functions to not use singletons</changelog>

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-android changelog: <changelog></changelog>.

Summary of changes

Fix extension function usage in case of several instances of MapboxMap objects if using plugins.

User impact (optional)

@kiryldz kiryldz added bug 🪲 Something isn't working breaking change ⚠️ labels Feb 3, 2021
@kiryldz kiryldz requested a review from a team February 3, 2021 14:42
@kiryldz kiryldz self-assigned this Feb 3, 2021
Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

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

I appreciate the thinking outside the box. Moving the extension functions to SDK-base makes them always part of the SDK public API. We will conditionally execute APIs if the plugin dependency has been met. If we want to moe forward to such a setup, we can also replace the extension functions from sdk-base and add them directly on MapboxMap.

Note how this is conceptually different as the initial idea behind it. We only wanted to populate the MapboxMap API with new APIs if a plugin dependency was met. If you add animations plugin dependency, "magically" MapboxMap was able to use flyTo etc. without it, it wasn't.

@kiryldz
Copy link
Contributor Author

kiryldz commented Feb 4, 2021

I appreciate the thinking outside the box. Moving the extension functions to SDK-base makes them always part of the SDK public API. We will conditionally execute APIs if the plugin dependency has been met. If we want to moe forward to such a setup, we can also replace the extension functions from sdk-base and add them directly on MapboxMap.

Note how this is conceptually different as the initial idea behind it. We only wanted to populate the MapboxMap API with new APIs if a plugin dependency was met. If you add animations plugin dependency, "magically" MapboxMap was able to use flyTo etc. without it, it wasn't.

@tobrun - thanks a lot for such detailed write-up! I actually did not realize that bringing extension functions to sdk-base actually ruin all that "magic" as you described. I guess then indeed the best option is do it in a way @pengdev suggested.

@kiryldz kiryldz force-pushed the kdz-fix-camera-animations-extension-function branch from 4d9b0f0 to 78aee15 Compare February 4, 2021 09:32
@kiryldz kiryldz force-pushed the kdz-fix-camera-animations-extension-function branch from 78aee15 to aa22e25 Compare February 4, 2021 09:33
@kiryldz kiryldz force-pushed the kdz-fix-camera-animations-extension-function branch from aa22e25 to f686302 Compare February 4, 2021 11:18
@kiryldz kiryldz requested review from tobrun, Chaoba and pengdev February 4, 2021 11:20
@kiryldz kiryldz changed the title Move MapboxMap plugin related extension functions to sdk-base Revisit MapboxMap plugin related extension functions to not use singletons Feb 4, 2021
Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

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

Super clean, I like it

Copy link
Contributor

@Chaoba Chaoba left a comment

Choose a reason for hiding this comment

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

LGTM

@pengdev
Copy link
Member

pengdev commented Feb 4, 2021

Great work! can we add tests to these functions?

@kiryldz
Copy link
Contributor Author

kiryldz commented Feb 4, 2021

Great work! can we add tests to these functions?

Yep, working on that right now 👍

@kiryldz kiryldz merged commit 08c6154 into main Feb 4, 2021
@kiryldz kiryldz deleted the kdz-fix-camera-animations-extension-function branch February 4, 2021 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit MapboxMap plugin extension functions
4 participants