Skip to content

Commit

Permalink
Fix #4448: Hide promoted story section for the first time user (#4430)
Browse files Browse the repository at this point in the history
* add number_of_logins field to profile proto

* add increment login count function

* add tests

* init number of logins to 0 when new profile is added

* hide promoted stories for the first time user

* add cta text

* modify header text

* shorten line length

* modify tests so that number of logins are two

* modify tests so that number of logins are two

* modify tests so that number of logins are two

* modify tests so that number of logins are two

* shorten lines: optional nit

* remove all topics string resource

* add new test for not displaying promoted stories

* remove unused resource (build was failing)

* add new test case

* use suggested method to reduce function size

* change tests to account for changing the loginIntoProfile method inside profileTestHelper.kt

* correction: change tests to account for changing the loginIntoProfile method inside profileTestHelper.kt
  • Loading branch information
JishnuGoyal authored Aug 24, 2022
1 parent 091b45a commit 76f954d
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 40 deletions.
12 changes: 8 additions & 4 deletions app/src/main/java/org/oppia/android/app/home/HomeViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ class HomeViewModel(
promotedActivityListSummaryDataProvider,
PROFILE_AND_PROMOTED_ACTIVITY_COMBINED_PROVIDER_ID
) { profile, promotedActivityList ->
listOfNotNull(
computeWelcomeViewModel(profile),
computePromotedActivityListViewModel(promotedActivityList)
)
if (profile.numberOfLogins > 1) {
listOfNotNull(
computeWelcomeViewModel(profile),
computePromotedActivityListViewModel(promotedActivityList)
)
} else {
listOfNotNull(computeWelcomeViewModel(profile))
}
}.combineWith(
topicListSummaryDataProvider,
HOME_FRAGMENT_COMBINED_PROVIDER_ID
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/all_topics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_marginEnd="@dimen/all_topics_text_margin_end"
android:layout_marginBottom="@dimen/all_topics_text_margin_bottom"
android:fontFamily="sans-serif-medium"
android:text="@string/all_topics"
android:text="@string/select_a_topic_to_start"
android:textColor="@color/oppia_primary_text"
android:textSize="18sp" />
</FrameLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:text="@string/all_topics"
android:text="@string/select_a_topic_to_start"
android:padding="10dp"
android:background="@color/color_def_oppia_stroke_blue"
android:textColor="@color/oppia_primary_text"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
<string name="ongoing_story_last_month">تم تشغيلها خلال الشهر الماضي</string>
<string name="story_activity_title">قائمة الفصول</string>
<string name="lesson_thumbnail_content_description">صورة %s</string>
<string name="all_topics">كل المواضيع</string>
<string name="stories_you_can_play">القصص التي باستطاعتك تشغيلها</string>
<string name="navigate_up">العودة للسابق</string>
<string name="recently_played_activity">القصص التي تم تشغيلها مؤخرًا</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
<string name="ongoing_story_last_month">Reproduzidas no Último Mês</string>
<string name="story_activity_title">Lista de Capítulos</string>
<string name="lesson_thumbnail_content_description">Imagem para %s</string>
<string name="all_topics">Todos os Tópicos</string>
<string name="stories_you_can_play">Histórias que Você Pode Reproduzir</string>
<string name="navigate_up">Navegar para cima</string>
<string name="recently_played_activity">Histórias Reproduzidas Recentemente</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
<string name="ongoing_story_last_month">zilizochezwa ndani ya Mwezi uliopita</string>
<string name="story_activity_title">Orodha ya Sura</string>
<string name="lesson_thumbnail_content_description">Picha ya %s</string>
<string name="all_topics">Mada Zote</string>
<string name="stories_you_can_play">Hadithi Unazoweza Kucheza</string>
<string name="navigate_up">Nenda juu/enda juu</string>
<string name="recently_played_activity">Hadithi Zilizochezwa Hivi Karibuni</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
<string name="ongoing_story_last_month">Played within the Last Month</string>
<string name="story_activity_title">Chapter List</string>
<string name="lesson_thumbnail_content_description">Image for %s</string>
<string name="all_topics">All Topics</string>
<string name="stories_you_can_play">Stories You Can Play</string>
<string name="navigate_up">Navigate up</string>
<string name="recently_played_activity">Recently-Played Stories</string>
Expand Down Expand Up @@ -548,4 +547,5 @@
<string name="faq_answer_9"><![CDATA[<p>If you cannot find your question or would like to report a bug, contact us at [email protected].</p>]]></string>
<string name="profile_edit_fragment_test_activity_label">Profile Edit Fragment Test Activity</string>
<string name="administrator_controls_fragment_test_activity_label">Administrator Controls Fragment Test Activity</string>
<string name="select_a_topic_to_start">Select a Topic to Start</string>
</resources>
Loading

0 comments on commit 76f954d

Please sign in to comment.