From 6da49f646fc4ee124118bf36999da847fdda00e9 Mon Sep 17 00:00:00 2001 From: Momo Ozawa Date: Fri, 1 Mar 2024 10:23:03 -0800 Subject: [PATCH 1/4] change likes copy for reader --- .../viewmodels/ReaderPostDetailViewModel.kt | 45 +++---------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModel.kt index 69a02b9d7508..afa95b1e79a8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModel.kt @@ -699,7 +699,7 @@ class ReaderPostDetailViewModel @Inject constructor( } private fun buildLikersUiState(updateLikesState: GetLikesState?): TrainOfFacesUiState { - val (likers, numLikes, iLiked) = getLikersEssentials(updateLikesState) + val (likers, numLikes) = getLikersEssentials(updateLikesState) val showLoading = updateLikesState is Loading var showEmptyState = false @@ -717,7 +717,7 @@ class ReaderPostDetailViewModel @Inject constructor( } ?: false val engageItemsList = if (showLikeFacesTrainContainer) { - likers + getLikersFacesText(showEmptyState, numLikes, iLiked) + likers + getLikersFacesText(showEmptyState, numLikes) } else { listOf() } @@ -750,56 +750,25 @@ class ReaderPostDetailViewModel @Inject constructor( } @Suppress("LongMethod") - private fun getLikersFacesText(showEmptyState: Boolean, numLikes: Int, iLiked: Boolean): List { + private fun getLikersFacesText(showEmptyState: Boolean, numLikes: Int): List { @AttrRes val labelColor = R.attr.wpColorOnSurfaceMedium return when { showEmptyState -> { listOf() } - numLikes == 1 && iLiked -> { + numLikes == 1 -> { TrailingLabelTextItem( UiStringText( - htmlMessageUtils.getHtmlMessageFromStringFormatResId(R.string.like_faces_you_like_text) + htmlMessageUtils.getHtmlMessageFromStringFormatResId(R.string.like_title_singular) ), labelColor ).toList() } - numLikes == 2 && iLiked -> { + numLikes > 1 -> { TrailingLabelTextItem( UiStringText( htmlMessageUtils.getHtmlMessageFromStringFormatResId( - R.string.like_faces_you_plus_one_like_text - ) - ), - labelColor - ).toList() - } - numLikes > 2 && iLiked -> { - TrailingLabelTextItem( - UiStringText( - htmlMessageUtils.getHtmlMessageFromStringFormatResId( - R.string.like_faces_you_plus_others_like_text, - numLikes - 1 - ) - ), - labelColor - ).toList() - } - numLikes == 1 && !iLiked -> { - TrailingLabelTextItem( - UiStringText( - htmlMessageUtils.getHtmlMessageFromStringFormatResId( - R.string.like_faces_one_blogger_likes_text - ) - ), - labelColor - ).toList() - } - numLikes > 1 && !iLiked -> { - TrailingLabelTextItem( - UiStringText( - htmlMessageUtils.getHtmlMessageFromStringFormatResId( - R.string.like_faces_others_like_text, + R.string.like_title_plural, numLikes ) ), From edf080af99541dea12cfe17af1020e31a050bfe4 Mon Sep 17 00:00:00 2001 From: Momo Ozawa Date: Mon, 4 Mar 2024 09:21:51 +0000 Subject: [PATCH 2/4] update test string --- .../ui/reader/viewmodels/ReaderPostDetailViewModelTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModelTest.kt index 071880f7d400..e603e69a5e84 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/viewmodels/ReaderPostDetailViewModelTest.kt @@ -978,7 +978,7 @@ class ReaderPostDetailViewModelTest : BaseUnitTest() { fun `ui state show likers faces when data available`() { val likesState = getGetLikesState(TEST_CONFIG_1) as LikesData val likers = MutableList(5) { mock() } - val testTextString = "10 bloggers like this." + val testTextString = "10 likes" getLikesState.value = likesState whenever(accountStore.account).thenReturn(AccountModel().apply { userId = -1 }) From b50c02b38a9e43800c398ddc3e3385689aaccef2 Mon Sep 17 00:00:00 2001 From: Momo Ozawa Date: Mon, 4 Mar 2024 09:25:41 +0000 Subject: [PATCH 3/4] update placeholder text --- WordPress/src/main/res/layout/trailing_label_item.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/res/layout/trailing_label_item.xml b/WordPress/src/main/res/layout/trailing_label_item.xml index 6b67448945aa..07823e955b79 100644 --- a/WordPress/src/main/res/layout/trailing_label_item.xml +++ b/WordPress/src/main/res/layout/trailing_label_item.xml @@ -16,6 +16,6 @@ android:paddingBottom="@dimen/margin_medium" android:paddingTop="@dimen/margin_medium" android:textAppearance="?attr/textAppearanceCaption" - tools:text="19 bloggers like this." /> + tools:text="19 likes" /> From 3fcc032da37e36175b1273cb51a1645973ea1514 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Wed, 6 Mar 2024 12:20:04 +0530 Subject: [PATCH 4/4] - Removes: redundant string resources --- WordPress/src/main/res/values/strings.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 07623a4c35c9..30074dc35922 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -1629,14 +1629,6 @@ 1 Like %d Likes Error loading like data. %s. - - <a href="">You</a> like this. - <a href="">You and 1 blogger</a> like this. - <a href="">You and %1$s bloggers</a> like this. - <a href="">1 blogger</a> likes this. - <a href="">%1$s bloggers</a> like this. Reader