Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,20 @@ class YearInReviewSlides(
)
}

private fun topArticlesScreen(vararg params: Int): YearInReviewScreenData.StandardScreen {
// TODO: yir109 + yir105
private fun topArticlesScreen(): YearInReviewScreenData.StandardScreen? {
if (yearInReviewModel.localTopVisitedArticles.isEmpty()) {
return null
}

var topArticlesText = "<br />"
yearInReviewModel.localTopVisitedArticles.forEachIndexed { index, it ->
topArticlesText += "${index + 1}. $it<br />"
}
return YearInReviewScreenData.StandardScreen(
animatedImageResource = R.drawable.year_in_review_puzzle_pieces,
staticImageResource = R.drawable.year_in_review_puzzle_pieces,
headlineText = "Your top articles",
bodyText = "TBD"
animatedImageResource = R.drawable.year_in_review_puzzle_pieces, // TODO: tbd
staticImageResource = R.drawable.year_in_review_puzzle_pieces, // TODO: tbd
headlineText = context.getString(R.string.year_in_review_slide_top_articles_headline),
bodyText = context.getString(R.string.year_in_review_slide_top_articles_body, currentYear, topArticlesText)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class YearInReviewViewModel() : ViewModel() {

val topVisitedArticlesForTheYear = async {
AppDatabase.instance.historyEntryDao()
.getTopVisitedEntriesSince(MINIMUM_READ_COUNT, yearAgo)
.getTopVisitedEntriesSince(MAX_TOP_ARTICLES, yearAgo)
.map { StringUtil.fromHtml(it).toString() }
}

Expand Down Expand Up @@ -221,8 +221,9 @@ class YearInReviewViewModel() : ViewModel() {
}

companion object {
private const val MINIMUM_READ_COUNT = 3
private const val MINIMUM_SAVED_ARTICLE_COUNT = 3
private const val MINIMUM_EDIT_COUNT = 1
const val MAX_TOP_ARTICLES = 5
const val MIN_TOP_CATEGORY = 3
const val MAX_TOP_CATEGORY = 5
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-qq/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,8 @@
<string name="year_in_review_login_dialog_body">Body text of a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="year_in_review_login_dialog_positive">Positive button label for a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="year_in_review_login_dialog_negative">Negative button label for a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="year_in_review_slide_top_articles_headline">Title of the top articles slide for the Year in Review.</string>
<string name="year_in_review_slide_top_articles_body">Body text of the top articles slide for the Year in Review. The %1$d will be replaced by the current year and %2$s will be replaced by the list of top articles.</string>
<string name="year_in_review_slide_top_categories_headline">Title of the top categories slide for the Year in Review.</string>
<string name="year_in_review_slide_top_categories_body">Body text of the top categories slide for the Year in Review. The %1$d will be replaced by the current year and %2$s will be replaced by the list of top categories.</string>
<string name="recommended_reading_list_title">Title for the recommended reading list feature.</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,8 @@
<string name="year_in_review_login_dialog_body">Logging in gives you access to personalized insights. You can still see collective insights without logging in.</string>
<string name="year_in_review_login_dialog_positive">Log in / join Wikipedia</string>
<string name="year_in_review_login_dialog_negative">Continue without logging in</string>
<string name="year_in_review_slide_top_articles_headline">Your top articles</string>
<string name="year_in_review_slide_top_articles_body"><![CDATA[Here were the articles you visited the most in %1$d: %2$s]]></string>
<string name="year_in_review_slide_top_categories_headline">Your most interesting categories</string>
<string name="year_in_review_slide_top_categories_body"><![CDATA[Categories group articles on similar subjects together. In %1$d, you visited articles in these interesting categories multiple times: %2$s]]></string>

Expand Down
Loading