posthog-flutter icon indicating copy to clipboard operation
posthog-flutter copied to clipboard

Dynamically initialize posthog

Open Mastersam07 opened this issue 1 year ago • 6 comments

: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

  • [x] I reviewed the submitted code.
  • [ ] I added tests to verify the changes.
  • [x] I updated the docs if needed.
  • [x] No breaking change or entry added to the changelog.

Mastersam07 avatar Jul 31 '24 07:07 Mastersam07

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

marandaneto avatar Jul 31 '24 13:07 marandaneto

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

Thanks, Gowtham.

GowthamanRavichandran3 avatar Aug 06 '24 07:08 GowthamanRavichandran3

@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.

marandaneto avatar Aug 14 '24 13:08 marandaneto

@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 , 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?

marandaneto avatar Sep 03 '24 06:09 marandaneto

@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.

Mastersam07 avatar Sep 03 '24 06:09 Mastersam07

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

marandaneto avatar Oct 02 '24 14:10 marandaneto