Skip to content

Conversation

@Williamrai
Copy link
Collaborator

What does this do?

  • adds logic to support year in review survey which will appear on home screen or page screen

Phabricator:
https://phabricator.wikimedia.org/T405504

Comment on lines 795 to 797
var showYearInReviewSurvey
get() = PrefsIoUtil.getBoolean(R.string.preference_key_show_yir_survey, false)
set(value) = PrefsIoUtil.setBoolean(R.string.preference_key_show_yir_survey, value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should have this saved in the YearInReviewModel, otherwise we will not be able to show the survey for next year's YiR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean this data class?
@serializable
data class YearInReviewModel(
val totalReadingTimeMinutes: Long,
.....
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because the survey should be shown every year

Comment on lines 13 to 15
if (!Prefs.showYearInReviewSurvey || Prefs.yearInReviewSurveyShown) {
return
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but would it be possible to reduce one variable like shouldShowYiRSurvey?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added showYearInReviewSurvey to allow triggering the survey either after the user has viewed more than two slides or from the end of the highlights screen. This is needed because I am calling maybeShowYearInReviewFeedbackDialog from onResume in both MainFragment and PageActivity. The yearInReviewSurveyShown flag is used to ensure the survey is only shown once.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. Maybe these two preferences can be saved in the YearInReviewModel too.

# Conflicts:
#	app/src/main/java/org/wikipedia/page/PageActivity.kt
@Williamrai
Copy link
Collaborator Author

Instead of adding new variables to the model data (which is a map) and managing get/set operations across multiple places in the code, which would add lots of extra code, would it be simpler to just reset the survey preference when a new Year in Review loads in YearInReviewViewModel?

Base automatically changed from yir-re-design to main October 20, 2025 17:06
Williamrai and others added 3 commits October 20, 2025 14:04
# Conflicts:
#	app/src/main/java/org/wikipedia/main/MainFragment.kt
#	app/src/main/java/org/wikipedia/page/PageActivity.kt
#	app/src/main/java/org/wikipedia/yearinreview/YearInReviewActivity.kt
#	app/src/main/java/org/wikipedia/yearinreview/YearInReviewScreenDeck.kt
#	app/src/main/java/org/wikipedia/yearinreview/YearInReviewViewModel.kt
#	app/src/main/res/values/preference_keys.xml
- adds list preference as developer settings for year in review survey
- code fixes
@Williamrai Williamrai requested a review from cooltey October 21, 2025 17:08
@cooltey
Copy link
Collaborator

cooltey commented Oct 21, 2025

Please resolve the conflict file.

Williamrai and others added 4 commits October 21, 2025 18:05
# Conflicts:
#	app/src/main/java/org/wikipedia/page/PageActivity.kt
#	app/src/main/java/org/wikipedia/yearinreview/YearInReviewViewModel.kt
},
onNextButtonClick = { pagerState ->
onNextButtonClick = { pagerState, currentSlideData ->
viewModel.slideViewedCount += 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the following logic in onNextButtonClick so we do not need to put it in the onBackButtonClick?

if (viewModel.slideViewedCount >= 2 && Prefs.yearInReviewSurveyState == YearInReviewSurveyState.NOT_TRIGGERED) {
    Prefs.yearInReviewSurveyState = YearInReviewSurveyState.SHOULD_SHOW
 }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in onBackButtonClick is for this requirement.(or After someone has viewed 2 or more slides closed year in Review from any slide). I renamed the onBackButtonClick to onCloseButtonClick.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks

@cooltey cooltey merged commit 3ec0fb3 into main Oct 22, 2025
1 check passed
@cooltey cooltey deleted the yir-survey branch October 22, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants