-
Notifications
You must be signed in to change notification settings - Fork 33
feat(surveys): support survey schedule 'always' to show every time #403
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
base: main
Are you sure you want to change the base?
Conversation
Add support for the `schedule: 'always'` survey configuration option, which displays surveys repeatedly regardless of prior viewing history. - Add `schedule` property to Survey data class - Update `canActivateRepeatedly()` to return true when schedule is 'always' - Add comprehensive unit tests for the new schedule functionality Closes #389
Instructions and example for changelogPlease add an entry to the appropriate changelog:
Make sure the entry includes this PR's number. ## Next
- support survey schedule 'always' to show every time ([#403](https://github.com/PostHog/posthog-android/pull/403))If none of the above apply, you can opt out of this check by adding |
|
|
||
| private fun canActivateRepeatedly(survey: Survey): Boolean { | ||
| return survey.conditions?.events?.repeatedActivation == true && hasEvents(survey) | ||
| return (survey.conditions?.events?.repeatedActivation == true && hasEvents(survey)) || |
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.
should schedule be an enum maybe so we avoid hardcoded values? or can we make a const for always
| ) | ||
| } | ||
|
|
||
| private fun hasEvents(survey: Survey): Boolean { |
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 be not here and tested directly from the source code and not copypasta into tests
|
@marandaneto thanks for the review, this wasn’t ready i thought it was a draft 🙈🙈 it’s entirely twig one-shot and i have not reviewed or tested it yet lol i’m sorry!!! did not mean to waste your time i’ve got twig ripping on a lot of small mobile surveys tasks and this one slipped through the cracks |
**created with twig 🦔 **
💡 Motivation and Context
Support the
schedule: 'always'survey configuration option, which displays surveys repeatedly regardless of prior viewing history.Closes #389
This brings the Android SDK in line with posthog-js and posthog-react-native, which already support this functionality.
💚 How did you test it?
SurveyScheduleTest.ktcovering:schedule = "always"can activate repeatedlyschedule = "once"cannot activate repeatedly by defaultschedule = "recurring"cannot activate repeatedly by defaultnullschedule cannot activate repeatedly by defaultrepeatedActivationevents and schedule settings📝 Checklist