From e8eef2c6b82fd09f33e873623d8a31ceb1d4275d Mon Sep 17 00:00:00 2001 From: ashiagr Date: Wed, 30 Jun 2021 20:30:01 +0530 Subject: [PATCH 1/4] Check if site supports sharing --- .../main/java/org/wordpress/android/ui/main/MySiteFragment.kt | 2 +- .../java/org/wordpress/android/ui/mysite/SiteListItemBuilder.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.kt index ba657d9caaa8..d9385a6b40db 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.kt @@ -1004,7 +1004,7 @@ class MySiteFragment : Fragment(R.layout.my_site_fragment), rowThemes.visibility = themesVisibility // sharing is only exposed for sites accessed via the WPCOM REST API (wpcom or Jetpack) - val sharingVisibility = if (SiteUtils.isAccessedViaWPComRest(site)) View.VISIBLE else View.GONE + val sharingVisibility = if (site.supportsSharing()) View.VISIBLE else View.GONE rowSharing.visibility = sharingVisibility // show settings for all self-hosted to expose Delete Site diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteListItemBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteListItemBuilder.kt index e3d9408c59a5..12349e23a3af 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteListItemBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteListItemBuilder.kt @@ -150,7 +150,7 @@ class SiteListItemBuilder onClick: (ListItemAction) -> Unit, showFocusPoint: Boolean = false ): ListItem? { - return if (siteUtilsWrapper.isAccessedViaWPComRest(site)) { + return if (site.supportsSharing()) { ListItem( R.drawable.ic_share_white_24dp, UiStringRes(R.string.my_site_btn_sharing), From 34edf76920115c1622336f40b03a1ceb8c173dc1 Mon Sep 17 00:00:00 2001 From: ashiagr Date: Thu, 1 Jul 2021 20:58:01 +0530 Subject: [PATCH 2/4] Tests: update existing tests for site's sharing menu visibility --- .../android/ui/mysite/SiteListItemBuilderTest.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/SiteListItemBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/SiteListItemBuilderTest.kt index 2717f92d42c6..7720ecef8d2d 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/SiteListItemBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/SiteListItemBuilderTest.kt @@ -386,8 +386,8 @@ class SiteListItemBuilderTest { } @Test - fun `share item built if is accessed through WPCom REST`() { - whenever(siteUtilsWrapper.isAccessedViaWPComRest(siteModel)).thenReturn(true) + fun `share item built if site supports sharing`() { + whenever(siteModel.supportsSharing()).thenReturn(true) val item = siteListItemBuilder.buildShareItemIfAvailable(siteModel, SITE_ITEM_ACTION) @@ -395,8 +395,8 @@ class SiteListItemBuilderTest { } @Test - fun `share item not built if is not accessed through WPCom REST`() { - whenever(siteUtilsWrapper.isAccessedViaWPComRest(siteModel)).thenReturn(false) + fun `share item not built if site does not supports sharing`() { + whenever(siteModel.supportsSharing()).thenReturn(false) val item = siteListItemBuilder.buildShareItemIfAvailable(siteModel, SITE_ITEM_ACTION) From 4033d34c84d7ff592613f4d3f80c41ba0656b1e4 Mon Sep 17 00:00:00 2001 From: ashiagr Date: Fri, 2 Jul 2021 10:58:02 +0530 Subject: [PATCH 3/4] Update fluxc hash --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4a31d9d9f65e..878706d7ec94 100644 --- a/build.gradle +++ b/build.gradle @@ -133,7 +133,7 @@ ext { androidxWorkVersion = "2.4.0" daggerVersion = '2.29.1' - fluxCVersion = '1.21.0-beta-1' + fluxCVersion = 'd7fbe3f8' appCompatVersion = '1.0.2' coreVersion = '1.3.2' From 02b4a9f15dc85de752436d94d85df98f738624a4 Mon Sep 17 00:00:00 2001 From: ashiagr Date: Fri, 2 Jul 2021 19:04:10 +0530 Subject: [PATCH 4/4] Update FluxC tag --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 878706d7ec94..887e452954e3 100644 --- a/build.gradle +++ b/build.gradle @@ -133,7 +133,7 @@ ext { androidxWorkVersion = "2.4.0" daggerVersion = '2.29.1' - fluxCVersion = 'd7fbe3f8' + fluxCVersion = '1.21.0-beta-2' appCompatVersion = '1.0.2' coreVersion = '1.3.2'