Skip to content

Commit

Permalink
Merge pull request #14979 from wordpress-mobile/issue/14944-sharing-m…
Browse files Browse the repository at this point in the history
…enu-visibility

Update site sharing menu visibility
  • Loading branch information
ashiagr authored Jul 2, 2021
2 parents 84073f2 + 02b4a9f commit 7c64af2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,17 @@ 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)

assertThat(item).isEqualTo(SHARING_ITEM)
}

@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)

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ext {
androidxWorkVersion = "2.4.0"

daggerVersion = '2.29.1'
fluxCVersion = '1.21.0-beta-1'
fluxCVersion = '1.21.0-beta-2'

appCompatVersion = '1.0.2'
coreVersion = '1.3.2'
Expand Down

0 comments on commit 7c64af2

Please sign in to comment.