PostHog / posthog-flutter

PostHog Flutter SDK
https://posthog.com/docs/libraries/flutter
MIT License
55 stars 37 forks source link

Dynamically initialize posthog #113

Closed Mastersam07 closed 1 month ago

Mastersam07 commented 3 months ago

:bulb: Motivation and Context

Posthog initialization can only be done natively from android manifest and info.plist. However, there are cases where user want to configure dynamically from the dart side.

A good example is loading the posthog api key and host from some 3rd party(say api or firebase remote config) and then setting up posthog.

The current setup does not allow

This PR aims at solving the above described issue.

:green_heart: How did you test it?

With the example code, on an emulator.

:pencil: Checklist

marandaneto commented 3 months ago

@Mastersam07 sorry I am out on sick leave and will come back to it either later this week or next week.

GowthamanRavichandran3 commented 3 months ago

Hi @marandaneto, This PR will also fulfill our requirements. So, please merge this PR as soon as possible.

Thanks, Gowtham.

marandaneto commented 3 months ago

@shuttlershq I think it's ok to offer an alternative to use the given configuration, but the current form should still be possible to keep back compatibility. it'd help solve this issue as well https://github.com/PostHog/posthog-flutter/issues/22 my suggestion is that we offer a way to disable the auto init via native (manifest/plist), and then someone can call config manually, otherwise, everything should work as it is, wdyt?

for example: <meta-data android:name="com.posthog.posthog.AUTO_INIT" android:value="false" /> // defaults to true in this case, the call to posthog.config(...) is needed, otherwise, everything works as it is.

dharanidharandharmasivam commented 2 months ago

@marandaneto , can you please provide some approximate timeline to merge this changes to merge, since am having scenario like based on domain I needs to log in different things, so can you please merge this PR sooner

marandaneto commented 2 months ago

@marandaneto , can you please provide some approximate timeline to merge this changes to merge, since am having scenario like based on domain I needs to log in different things, so can you please merge this PR sooner

I left a few comments and specifically a different approach for compatibility, described here, would you apply those suggestions so we can move forward?

Mastersam07 commented 2 months ago

@marandaneto , can you please provide some approximate timeline to merge this changes to merge, since am having scenario like based on domain I needs to log in different things, so can you please merge this PR sooner

I left a few comments and specifically a different approach for compatibility, described here, would you apply those suggestions so we can move forward?

I will attend to these changea. I was on leave.

marandaneto commented 1 month ago

Closed in favor of https://github.com/PostHog/posthog-flutter/pull/117 Thanks for the initial PR @Mastersam07