Skip to content

Commit 48c8e00

Browse files
committed
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android into analysis/wordpress-all-warnings-as-errors
2 parents d9a7eef + 5efa74d commit 48c8e00

File tree

19 files changed

+125
-56
lines changed

19 files changed

+125
-56
lines changed

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
21.0
44
-----
5+
* [***] Updated About screen for WordPress and Jetpack apps to their respective urls. [https://github.com/wordpress-mobile/WordPress-Android/pull/17282]
56
* [*] Updates splash screen for Android 12+ [https://github.com/wordpress-mobile/WordPress-Android/pull/17273]
67
* [*] Fix text color of success messages in the QR code login flow [https://github.com/wordpress-mobile/WordPress-Android/pull/17286]
8+
* [*] Stats: Fix Western Arabic Numerals not being shown on every text of the stats screens in Arabic languages [https://github.com/wordpress-mobile/WordPress-Android/pull/17217]
79

810
20.9
911
-----

WordPress/src/androidTest/java/org/wordpress/android/e2e/ContactUsTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.wordpress.android.e2e;
22

33
import org.junit.Before;
4-
import org.junit.Ignore;
54
import org.junit.Test;
65
import org.wordpress.android.e2e.flows.LoginFlow;
76
import org.wordpress.android.e2e.pages.ContactSupportScreen;
@@ -18,7 +17,6 @@ public void setUp() {
1817
logoutIfNecessary();
1918
}
2019

21-
@Ignore("Ignored temporarily. This sometimes fail on CI while running with whole test suite.")
2220
@Test
2321
public void e2eSendButtonEnabledWhenTextIsEntered() {
2422
try {

WordPress/src/androidTest/java/org/wordpress/android/e2e/LoginTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.junit.After;
44
import org.junit.Before;
5-
import org.junit.Ignore;
65
import org.junit.Test;
76
import org.wordpress.android.e2e.flows.LoginFlow;
87
import org.wordpress.android.support.BaseTest;
@@ -24,7 +23,6 @@ public void setUp() {
2423
logoutIfNecessary();
2524
}
2625

27-
@Ignore("Ignored temporarily. This sometimes fail on CI while running with whole test suite.")
2826
@Test
2927
public void e2eLoginWithEmailPassword() {
3028
new LoginFlow().chooseContinueWithWpCom()
@@ -33,7 +31,6 @@ public void e2eLoginWithEmailPassword() {
3331
.confirmLogin(false);
3432
}
3533

36-
@Ignore("Ignored temporarily. This sometimes fail on CI while running with whole test suite.")
3734
@Test
3835
public void e2eLoginWithPasswordlessAccount() {
3936
new LoginFlow().chooseContinueWithWpCom()
@@ -51,7 +48,6 @@ public void e2eLoginWithSiteAddress() {
5148
.confirmLogin(false);
5249
}
5350

54-
@Ignore("Ignored temporarily. This sometimes fail on CI while running with whole test suite.")
5551
@Test
5652
public void e2eLoginWithMagicLink() {
5753
new LoginFlow().chooseContinueWithWpCom()

WordPress/src/androidTest/java/org/wordpress/android/e2e/ReaderTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import androidx.test.rule.GrantPermissionRule;
66

77
import org.junit.Before;
8-
import org.junit.Ignore;
98
import org.junit.Rule;
109
import org.junit.Test;
1110
import org.wordpress.android.e2e.pages.ReaderPage;
@@ -28,7 +27,6 @@ public void setUp() {
2827
String mCoachingPostTitle = "Let's check out the coaching team!";
2928
String mCompetitionPostTitle = "Let's focus on the competition.";
3029

31-
@Ignore("Ignored temporarily. This sometimes fail on CI while running with whole test suite.")
3230
@Test
3331
public void e2eNavigateThroughPosts() {
3432
new ReaderPage()
@@ -42,7 +40,6 @@ public void e2eNavigateThroughPosts() {
4240
.goBackToReader();
4341
}
4442

45-
@Ignore("Ignored temporarily. This sometimes fail on CI while running with whole test suite.")
4643
@Test
4744
public void e2eLikePost() {
4845
new ReaderPage()

WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/ContactSupportScreen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import static org.hamcrest.Matchers.not;
1818
import static org.wordpress.android.support.WPSupportUtils.populateTextField;
1919
import static org.wordpress.android.support.WPSupportUtils.sleep;
20+
import static org.wordpress.android.support.WPSupportUtils.waitForElementToBeDisplayed;
2021
import static org.wordpress.android.support.WPSupportUtils.waitForElementToBeDisplayedWithoutFailure;
2122

2223
public class ContactSupportScreen {
@@ -67,6 +68,7 @@ public HelpAndSupportScreen goBackAndDeleteUnsentMessageIfNeeded() {
6768

6869
// Assertions:
6970
public ContactSupportScreen assertContactSupportScreenLoaded() {
71+
waitForElementToBeDisplayed(textInput);
7072
textInput.check(matches(isCompletelyDisplayed()));
7173
sendButton.check(matches(isCompletelyDisplayed()));
7274
return this;

WordPress/src/main/java/org/wordpress/android/ui/about/UnifiedAboutViewModel.kt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import androidx.lifecycle.LiveData
44
import androidx.lifecycle.MutableLiveData
55
import androidx.lifecycle.ViewModel
66
import com.automattic.about.model.AboutConfig
7+
import com.automattic.about.model.AboutFooterConfig
78
import com.automattic.about.model.AnalyticsConfig
9+
import com.automattic.about.model.AutomatticConfig
810
import com.automattic.about.model.HeaderConfig
911
import com.automattic.about.model.ItemConfig
1012
import com.automattic.about.model.LegalConfig
1113
import com.automattic.about.model.RateUsConfig
1214
import com.automattic.about.model.ShareConfig
1315
import com.automattic.about.model.SocialsConfig
16+
import com.automattic.about.model.WorkWithUsConfig
1417
import org.wordpress.android.Constants
1518
import org.wordpress.android.R
1619
import org.wordpress.android.models.recommend.RecommendApiCallsProvider
@@ -49,7 +52,7 @@ class UnifiedAboutViewModel @Inject constructor(
4952
customItems = listOf(
5053
ItemConfig(
5154
name = BLOG_ITEM_NAME,
52-
title = contextProvider.getContext().getString(R.string.about_blog),
55+
title = blogTitle(),
5356
onClick = ::onBlogClick
5457
)
5558
),
@@ -58,6 +61,13 @@ class UnifiedAboutViewModel @Inject constructor(
5861
privacyPolicyUrl = Constants.URL_PRIVACY_POLICY,
5962
acknowledgementsUrl = LICENSES_FILE_URL
6063
),
64+
automatticConfig = AutomatticConfig(isVisible = buildConfig.isJetpackApp),
65+
workWithUsConfig = WorkWithUsConfig(
66+
title = workWithUsTitle(),
67+
subtitle = workWithUsSubTitle(),
68+
url = if (buildConfig.isJetpackApp) JP_WORK_WITH_US_URL else WP_CONTRIBUTE_URL
69+
),
70+
aboutFooterConfig = AboutFooterConfig(isVisible = buildConfig.isJetpackApp),
6171
analyticsConfig = AnalyticsConfig(
6272
trackScreenShown = unifiedAboutTracker::trackScreenShown,
6373
trackScreenDismissed = unifiedAboutTracker::trackScreenDismissed,
@@ -90,16 +100,36 @@ class UnifiedAboutViewModel @Inject constructor(
90100
_onNavigation.postValue(Event(OpenBlog(if (buildConfig.isJetpackApp) JP_BLOG_URL else WP_BLOG_URL)))
91101
}
92102

103+
private fun blogTitle() = if (buildConfig.isJetpackApp) {
104+
contextProvider.getContext().getString(R.string.about_blog)
105+
} else {
106+
contextProvider.getContext().getString(R.string.about_news)
107+
}
108+
109+
private fun workWithUsTitle() = if (buildConfig.isJetpackApp) {
110+
contextProvider.getContext().getString(R.string.about_automattic_work_with_us_item_title)
111+
} else {
112+
contextProvider.getContext().getString(R.string.about_automattic_contribute_item_title)
113+
}
114+
115+
private fun workWithUsSubTitle() = if (buildConfig.isJetpackApp) {
116+
contextProvider.getContext().getString(R.string.about_automattic_work_with_us_item_subtitle)
117+
} else {
118+
null
119+
}
120+
93121
companion object {
94122
private const val BLOG_ITEM_NAME = "blog"
95123
private const val LICENSES_FILE_URL = "file:///android_asset/licenses.html"
96124

97-
private const val WP_SOCIAL_HANDLE = "wordpress"
125+
private const val WP_SOCIAL_HANDLE = "WPAndroid"
98126
private const val WP_APPS_URL = "https://apps.wordpress.com"
99-
private const val WP_BLOG_URL = "https://blog.wordpress.com"
127+
private const val WP_BLOG_URL = "https://wordpress.org/news/"
128+
private const val WP_CONTRIBUTE_URL = "https://make.wordpress.org/mobile/handbook/"
100129

101130
private const val JP_SOCIAL_HANDLE = "jetpack"
102131
private const val JP_APPS_URL = "https://jetpack.com/app"
103132
private const val JP_BLOG_URL = "https://jetpack.com/blog"
133+
private const val JP_WORK_WITH_US_URL = "https://automattic.com/work-with-us/"
104134
}
105135
}

WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/detail/PostDayViewsMapper.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter
1313
import org.wordpress.android.ui.stats.refresh.utils.StatsUtils
1414
import org.wordpress.android.util.text.PercentFormatter
1515
import org.wordpress.android.viewmodel.ResourceProvider
16+
import java.math.RoundingMode.HALF_UP
1617
import javax.inject.Inject
1718

1819
class PostDayViewsMapper
@@ -67,7 +68,7 @@ class PostDayViewsMapper
6768
0 -> ""
6869
else -> {
6970
val percentageValue = difference.toFloat() / previousValue
70-
percentFormatter.format(percentageValue)
71+
percentFormatter.format(value = percentageValue, rounding = HALF_UP)
7172
}
7273
}
7374
val formattedDifference = mapIntToString(difference, isFormattedNumber)

WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/MostPopularInsightsUseCase.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.wordpress.android.ui.stats.refresh.utils.ItemPopupMenuHandler
2424
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
2525
import org.wordpress.android.util.text.PercentFormatter
2626
import org.wordpress.android.viewmodel.ResourceProvider
27+
import java.math.RoundingMode
2728
import javax.inject.Inject
2829
import javax.inject.Named
2930
import kotlin.math.roundToInt
@@ -75,11 +76,17 @@ class MostPopularInsightsUseCase
7576
} else {
7677
val highestDayPercent = resourceProvider.getString(
7778
R.string.stats_most_popular_percent_views,
78-
percentFormatter.format(domainModel.highestDayPercent.roundToInt())
79+
percentFormatter.format(
80+
value = domainModel.highestDayPercent.roundToInt(),
81+
rounding = RoundingMode.HALF_UP
82+
)
7983
)
8084
val highestHourPercent = resourceProvider.getString(
8185
R.string.stats_most_popular_percent_views,
82-
percentFormatter.format(domainModel.highestHourPercent.roundToInt())
86+
percentFormatter.format(
87+
value = domainModel.highestHourPercent.roundToInt(),
88+
rounding = RoundingMode.HALF_UP
89+
)
8390
)
8491
items.add(
8592
QuickScanItem(

WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/ViewsAndVisitorsMapper.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.wordpress.android.ui.stats.refresh.utils.MILLION
2323
import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter
2424
import org.wordpress.android.ui.stats.refresh.utils.StatsUtils
2525
import org.wordpress.android.ui.utils.ListItemInteraction
26+
import org.wordpress.android.util.extensions.enforceWesternArabicNumerals
2627
import org.wordpress.android.viewmodel.ResourceProvider
2728
import javax.inject.Inject
2829

@@ -117,7 +118,7 @@ class ViewsAndVisitorsMapper
117118
val value = it.getValue(selectedType)
118119
val date = statsDateFormatter.parseStatsDate(statsGranularity, it.period)
119120
Line(
120-
statsDateFormatter.printDayWithoutYear(date),
121+
statsDateFormatter.printDayWithoutYear(date).enforceWesternArabicNumerals() as String,
121122
it.period,
122123
value.toInt()
123124
)

WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/StatsUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.LineC
77
import org.wordpress.android.util.LocaleManagerWrapper
88
import org.wordpress.android.util.text.PercentFormatter
99
import org.wordpress.android.viewmodel.ResourceProvider
10+
import java.math.RoundingMode.HALF_UP
1011
import java.text.DecimalFormat
1112
import java.util.TreeMap
1213
import javax.inject.Inject
@@ -197,7 +198,7 @@ class StatsUtils @Inject constructor(
197198
0L -> ""
198199
else -> {
199200
val percentageValue = difference.toFloat() / previousValue
200-
percentFormatter.format(percentageValue)
201+
percentFormatter.format(value = percentageValue, rounding = HALF_UP)
201202
}
202203
}
203204
val formattedDifference = mapLongToString(difference, isFormattedNumber)

0 commit comments

Comments
 (0)