-
Notifications
You must be signed in to change notification settings - Fork 39
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
Dynamically initialize posthog #113
Conversation
…nitialize-posthog Feature/sht 5366 dynamically initialize posthog
fix: broken android usage
Chore set default host
@Mastersam07 sorry I am out on sick leave and will come back to it either later this week or next week. |
Hi @marandaneto, This PR will also fulfill our requirements. So, please merge this PR as soon as possible. Thanks, |
@@ -56,86 +48,56 @@ class PosthogFlutterPlugin : FlutterPlugin, MethodCallHandler { | |||
} | |||
PostHogAndroid.setup(applicationContext, config) | |||
|
|||
} catch (e: Throwable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not change, Throwable
is lower level
@@ -15,37 +15,29 @@ import io.flutter.plugin.common.MethodChannel.Result | |||
|
|||
/** PosthogFlutterPlugin */ | |||
class PosthogFlutterPlugin : FlutterPlugin, MethodCallHandler { | |||
/// The MethodChannel that will the communication between Flutter and native Android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments were removed, please add them back, those comments are good for new comers
print("[PostHog] com.posthog.posthog.API_KEY is missing!") | ||
return | ||
} | ||
print("\nApiKey:", apiKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prints should be removed
@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. for example: |
@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. |
Closed in favor of #117 |
💡 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.
💚 How did you test it?
With the example code, on an emulator.
📝 Checklist