-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix: ensure activity name is used when activity label is not defined #153
fix: ensure activity name is used when activity label is not defined #153
Conversation
Modified the activityLabel method to check if the label is explicitly set for the Activity. If not, it will return null instead of the application label. Added activityName to return activityName class Updated onActivityStarted to use activityName as a fallback if activityLabel is null.
- Combined activityLabel and activityName methods into a single method activityLabelOrName. - The new method retrieves the activity label if it differs from the application label. - If the labels are identical or the activity label is empty, it falls back to the activity's class name.
… method - Replaced the separate calls to activityLabel and activityName with a single call to activityLabelOrName.
…tion label - Added parameters for activity name and application label to the mockScreenTitle function.
- Updated tests in PostHogActivityLifecycleCallbackIntegrationTest to verify activity label and application label handling. - Added scenarios to ensure the correct behavior when labels are the same or empty.
...id/src/main/java/com/posthog/android/internal/PostHogActivityLifecycleCallbackIntegration.kt
Outdated
Show resolved
Hide resolved
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.
Thanks @thisames
it does not fix #150 but addresses another issue. |
@thisames would add a new item to the changelog file https://github.com/PostHog/posthog-android/blob/main/CHANGELOG.md ? |
for sure =) |
@thisames type |
💡 Motivation and Context
The loadLabel method was loading the application label when an activity label was not defined. This change ensures that when an activity label is not defined, it defaults to the activity name instead of the application label. This improves the accuracy of screen name logging.
fix #150
💚 How did you test it?
📝 Checklist