Skip to content

feat(surveys): support survey schedule 'always' to show every time#403

Draft
adboio wants to merge 1 commit intomainfrom
feat/survey-schedule-always
Draft

feat(surveys): support survey schedule 'always' to show every time#403
adboio wants to merge 1 commit intomainfrom
feat/survey-schedule-always

Conversation

@adboio
Copy link
Contributor

@adboio adboio commented Jan 29, 2026

**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?

  • Added comprehensive unit tests in SurveyScheduleTest.kt covering:
    • Survey with schedule = "always" can activate repeatedly
    • Survey with schedule = "once" cannot activate repeatedly by default
    • Survey with schedule = "recurring" cannot activate repeatedly by default
    • Survey with null schedule cannot activate repeatedly by default
    • Combined scenarios with repeatedActivation events and schedule settings
  • All existing survey tests continue to pass

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.
  • If there are related changes in the core package, I've already released them, or I'll release them before this one.

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
@adboio adboio requested a review from a team January 29, 2026 19:49
@github-actions
Copy link

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to the appropriate changelog:

  • posthog/CHANGELOG.md (core module)
  • posthog-android/CHANGELOG.md (android module)
  • posthog-server/CHANGELOG.md (server module)
  • posthog-android-gradle-plugin/CHANGELOG.md (android plugin module)

Make sure the entry includes this PR's number.
Example:

## 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 #skip-changelog to the PR description.

Generated by 🚫 dangerJS against afbd24a


private fun canActivateRepeatedly(survey: Survey): Boolean {
return survey.conditions?.events?.repeatedActivation == true && hasEvents(survey)
return (survey.conditions?.events?.repeatedActivation == true && hasEvents(survey)) ||
Copy link
Member

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 {
Copy link
Member

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

Copy link
Contributor Author

adboio commented Jan 30, 2026

@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

@adboio adboio marked this pull request as draft January 30, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support survey schedule 'always' (show every time)

2 participants