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

Avoid having all integrations in the same package #49

Open
danielgomezrico opened this issue Aug 4, 2022 · 3 comments
Open

Avoid having all integrations in the same package #49

danielgomezrico opened this issue Aug 4, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@danielgomezrico
Copy link
Contributor

danielgomezrico commented Aug 4, 2022

Current

We add integration with things like amplitude, firebase and so on and that requires that the dependency is added on each platform like this:

PRs related to this:

This makes that the effort made by the Segment team to avoid having a big library and instead adding the dependencies you need on your project pretty bad.

Expected

Somehow if I should be able to include the dependencies I need for each platform and just those.

@danielgomezrico danielgomezrico added the help wanted Extra attention is needed label Aug 4, 2022
@danielgomezrico danielgomezrico changed the title Split library to support different services Avoid having all integrations in the same package Aug 4, 2022
@ariefwijaya
Copy link
Contributor

This is needed because one of the benefits of the segment is as a portal to all CRMs. Maybe cloud mode doesn't need this, but not device mode.

Yczar pushed a commit to tradedepot/flutter-segment that referenced this issue Oct 13, 2022
@b099l3
Copy link
Contributor

b099l3 commented Nov 22, 2022

Just seen the MoEngage PR and I was also looking into integrating Adjust, this is a repeating problem. @danielgomezrico Sorry for the delay. I have been thinking about this a lot and how we would architect it. I believe we have these issues to address:

Architecture:

I had the idea that we would need the following:

  1. A core package that
  • keeps all the standard segment calls:
  • Starts Segment and adds the other integrations (some registry that looks for the integration packages added)
  1. Packages for each of the integrations, Firebase, AppsFlyer, etc

I got stuck trying to work out how we could build a registry... until I watched a talk on federated plugins at Droidcon 2022, and I realised that the FlutterFire plugin has a similar set-up. We could copy that pattern by filling in our registry.

I will use iOS as an example to highlight how this would work, but there are Android and other platforms. If we look at the core package:

 [[FLTFirebasePluginRegistry sharedInstance] registerFirebasePlugin:instance];

We could potentially get away with something like this on the native side if we can get access to the config object, native setup of the firebase integration:

[config use:[SEGFirebaseIntegrationFactory instance]];

The Integrations Plugin would do this code.

I have started a small proof of concept with Melos but will try to get something working to show how this could work. It would mean we could house multiple packages in this Repo and publish them separately. And if someone wanted another repo they could create their own that wraps the native implementation, we could then do federated plugins.

Other non-related issues that we should consider

I can separate these into other issues if needed, but I wanted to raise this here to see what you thought

Melos

Move to use Melos or something to help with multi-package repos, it could also help us structure and have a concise release log, etc. This would mean we could have a mono repo with some of the packages and be able to release them separately. E.g. see the FlutterFire repo. That is not to say we couldn't have federated plugins or something similar.

Pigeon

Move to use Pigeon for inter-language mapping. Still determining how much of this we will be doing, but if we start to get more, we should consider adopting Pigeon.

Integration setup

We should move away from using a bool to enable plugins
Using bools like isAmplitudeIntegrationEnabled is going to limit us

Newer native segment packages

From researching, I noticed that we depend on analytics-ios, last updated 05 Oct 2021, over a year ago 😬. They also mention migrating over in their docs
Both analytics-kotlin / analytics-swift seem to be updated more often. We should move to the newer native segment packages, as it looks like this is the way Segment is going. Maybe not for this change, but it should be our next priority as they are not supporting it anymore.

Sorry for the long post but I wanted to get this out of my head 🤯😂 WDYT?

@danielgomezrico
Copy link
Contributor Author

Thanks for those ideas @b099l3, this is an excellent starting point to resolve the issue.

We are sorry but as a company this month this got a low priority, and we need to ultra focus on other things, we will come back in a month or so to continue with it :)

@danielgomezrico danielgomezrico added the enhancement New feature or request label Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants