feat(surveys): support survey schedule 'always' to show every time#403
feat(surveys): support survey schedule 'always' to show every time#403
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.
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.
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