Skip to content

Commit

Permalink
Merge pull request #19136 from wordpress-mobile/issue/remove-quick-ac…
Browse files Browse the repository at this point in the history
…tions-card

Removes: Quick Actions Card from MySiteDashboard
  • Loading branch information
AjeshRPai authored Sep 7, 2023
2 parents 78477c5 + 0c5dc1a commit 5d80261
Show file tree
Hide file tree
Showing 22 changed files with 27 additions and 741 deletions.
2 changes: 0 additions & 2 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ android {
buildConfigField "boolean", "ENABLE_SIGNUP", "true"
buildConfigField "boolean", "ENABLE_READER", "true"
buildConfigField "boolean", "ENABLE_CREATE_FAB", "true"
buildConfigField "boolean", "ENABLE_QUICK_ACTION", "true"
buildConfigField "boolean", "ENABLE_FOLLOWED_SITES_SETTINGS", "true"
buildConfigField "boolean", "ENABLE_WHATS_NEW_FEATURE", "true"
buildConfigField "boolean", "ENABLE_MY_SITE_DASHBOARD_TABS", "true"
Expand Down Expand Up @@ -208,7 +207,6 @@ android {
buildConfigField "boolean", "ENABLE_SIGNUP", "true"
buildConfigField "boolean", "ENABLE_READER", "true"
buildConfigField "boolean", "ENABLE_CREATE_FAB", "true"
buildConfigField "boolean", "ENABLE_QUICK_ACTION", "true"
buildConfigField "boolean", "ENABLE_FOLLOWED_SITES_SETTINGS", "true"
buildConfigField "boolean", "ENABLE_WHATS_NEW_FEATURE", "true"
buildConfigField "boolean", "ENABLE_MY_SITE_DASHBOARD_TABS", "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.wordpress.android.e2e.pages
import android.view.View
import android.widget.Checkable
import android.widget.TextView
import androidx.annotation.IdRes
import androidx.annotation.StringRes
import androidx.appcompat.widget.SwitchCompat
import androidx.appcompat.widget.Toolbar
Expand Down Expand Up @@ -82,10 +81,7 @@ class MySitesPage {

fun goToPosts() {
goToMenuTab()
clickQuickActionOrSiteMenuItem(
R.id.quick_action_posts_button,
R.string.my_site_btn_blog_posts
)
clickSiteMenuItem(R.string.my_site_btn_blog_posts)
}

fun goToActivityLog() {
Expand Down Expand Up @@ -152,19 +148,17 @@ class MySitesPage {
goToMenuTab()

// Using RecyclerViewActions.click doesn't work for some reason when quick actions are displayed.
if (WPSupportUtils.isElementDisplayed(R.id.quick_actions_card)) {
WPSupportUtils.clickOn(Espresso.onView(ViewMatchers.withText(R.string.backup)))
} else {
clickItemWithText(R.string.backup)
}
clickItemWithText(R.string.backup)
}

fun goToStats(): StatsPage {
goToMenuTab()
val statsButton = Espresso.onView(Matchers.allOf(
ViewMatchers.withText(R.string.stats),
ViewMatchers.withId(R.id.my_site_item_primary_text)
))
val statsButton = Espresso.onView(
Matchers.allOf(
ViewMatchers.withText(R.string.stats),
ViewMatchers.withId(R.id.my_site_item_primary_text)
)
)
WPSupportUtils.clickOn(statsButton)
WPSupportUtils.idleFor(4000)
WPSupportUtils.dismissJetpackAdIfPresent()
Expand All @@ -177,7 +171,7 @@ class MySitesPage {

fun goToMedia() {
goToMenuTab()
clickQuickActionOrSiteMenuItem(R.id.quick_action_media_button, R.string.media)
clickSiteMenuItem(R.string.media)
}

fun createPost() {
Expand Down Expand Up @@ -215,20 +209,13 @@ class MySitesPage {
}

/**
* Clicks on the "Quick Action" item or the Site menu item if the quick actions card is hidden.
* Needed because locating site menu items by text fails if the quick actions are available.
* @param quickActionItemId Id of the quick actions menu item.
* Clicks on the Site menu item
* @param siteMenuItemString String resource id of the site menu item.
*/
private fun clickQuickActionOrSiteMenuItem(
@IdRes quickActionItemId: Int,
private fun clickSiteMenuItem(
@StringRes siteMenuItemString: Int
) {
if (WPSupportUtils.isElementDisplayed(quickActionItemId)) {
WPSupportUtils.clickOn(quickActionItemId)
} else {
clickItemWithText(siteMenuItemString)
}
clickItemWithText(siteMenuItemString)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DomainRegistration
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackFeatureCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackInstallFullPluginCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackSwitchMenu
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickActionsCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickLinkRibbon
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickStartCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Item.CategoryHeaderItem
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Item.CategoryEmptyHeaderItem
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Item.CategoryHeaderItem
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Item.InfoItem
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Item.ListItem
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Item.SingleActionCard
Expand All @@ -25,7 +24,6 @@ import org.wordpress.android.ui.mysite.cards.domainregistration.DomainRegistrati
import org.wordpress.android.ui.mysite.cards.jetpackfeature.JetpackFeatureCardViewHolder
import org.wordpress.android.ui.mysite.cards.jetpackfeature.SwitchToJetpackMenuCardViewHolder
import org.wordpress.android.ui.mysite.cards.jpfullplugininstall.JetpackInstallFullPluginCardViewHolder
import org.wordpress.android.ui.mysite.cards.quickactions.QuickActionsViewHolder
import org.wordpress.android.ui.mysite.cards.quicklinksribbon.QuickLinkRibbonViewHolder
import org.wordpress.android.ui.mysite.cards.quickstart.QuickStartCardViewHolder
import org.wordpress.android.ui.mysite.items.categoryheader.MySiteCategoryItemEmptyViewHolder
Expand Down Expand Up @@ -53,7 +51,6 @@ class MySiteAdapter(
@Suppress("ComplexMethod")
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MySiteCardAndItemViewHolder<*> {
return when (viewType) {
MySiteCardAndItem.Type.QUICK_ACTIONS_CARD.ordinal -> QuickActionsViewHolder(parent, uiHelpers)
MySiteCardAndItem.Type.QUICK_LINK_RIBBON.ordinal -> QuickLinkRibbonViewHolder(parent)
MySiteCardAndItem.Type.DOMAIN_REGISTRATION_CARD.ordinal -> DomainRegistrationViewHolder(parent)
MySiteCardAndItem.Type.QUICK_START_CARD.ordinal -> QuickStartCardViewHolder(parent, uiHelpers)
Expand Down Expand Up @@ -90,7 +87,6 @@ class MySiteAdapter(
@Suppress("ComplexMethod")
override fun onBindViewHolder(holder: MySiteCardAndItemViewHolder<*>, position: Int) {
when (holder) {
is QuickActionsViewHolder -> holder.bind(getItem(position) as QuickActionsCard)
is QuickLinkRibbonViewHolder -> holder.bind(getItem(position) as QuickLinkRibbon)
is DomainRegistrationViewHolder -> holder.bind(getItem(position) as DomainRegistrationCard)
is QuickStartCardViewHolder -> holder.bind(getItem(position) as QuickStartCard)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DomainRegistrationCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackFeatureCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackInstallFullPluginCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickActionsCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickLinkRibbon
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickStartCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackSwitchMenu
Expand All @@ -20,7 +19,6 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.JetpackBadge
object MySiteAdapterDiffCallback : DiffUtil.ItemCallback<MySiteCardAndItem>() {
override fun areItemsTheSame(oldItem: MySiteCardAndItem, updatedItem: MySiteCardAndItem): Boolean {
return oldItem.type == updatedItem.type && when {
oldItem is QuickActionsCard && updatedItem is QuickActionsCard -> true
oldItem is QuickLinkRibbon && updatedItem is QuickLinkRibbon -> true
oldItem is DomainRegistrationCard && updatedItem is DomainRegistrationCard -> true
oldItem is QuickStartCard && updatedItem is QuickStartCard -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.INFO_ITEM
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.JETPACK_BADGE
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.JETPACK_FEATURE_CARD
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.LIST_ITEM
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.QUICK_ACTIONS_CARD
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.QUICK_LINK_RIBBON
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.QUICK_START_CARD
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type.SINGLE_ACTION_CARD
Expand All @@ -31,7 +30,6 @@ typealias PromptID = Int
sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartItem: Boolean = false) {
enum class Type {
SITE_INFO_CARD,
QUICK_ACTIONS_CARD,
QUICK_LINK_RIBBON,
DOMAIN_REGISTRATION_CARD,
QUICK_START_CARD,
Expand Down Expand Up @@ -90,15 +88,6 @@ sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartIte
override val type: Type,
override val activeQuickStartItem: Boolean = false
) : MySiteCardAndItem(type, activeQuickStartItem) {
data class QuickActionsCard(
val title: UiString,
val onStatsClick: ListItemInteraction,
val onPagesClick: ListItemInteraction,
val onPostsClick: ListItemInteraction,
val onMediaClick: ListItemInteraction,
val showPages: Boolean = true
) : Card(QUICK_ACTIONS_CARD)

data class QuickLinkRibbon(
val quickLinkRibbonItems: List<QuickLinkRibbonItem>,
val showPagesFocusPoint: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ sealed class MySiteCardAndItemBuilderParams {
val isStaleMessagePresent: Boolean
) : MySiteCardAndItemBuilderParams()

data class QuickActionsCardBuilderParams(
val siteModel: SiteModel,
val onQuickActionStatsClick: () -> Unit,
val onQuickActionPagesClick: () -> Unit,
val onQuickActionPostsClick: () -> Unit,
val onQuickActionMediaClick: () -> Unit
) : MySiteCardAndItemBuilderParams()

data class QuickLinkRibbonBuilderParams(
val siteModel: SiteModel,
val onPagesClick: () -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardC
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DomainRegistrationCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.InfoItemBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.JetpackInstallFullPluginCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickActionsCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickLinkRibbonBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickStartCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.SiteInfoCardBuilderParams
Expand Down Expand Up @@ -555,13 +554,6 @@ class MySiteViewModel @Inject constructor(

val cardsResult = if (!jetpackFeatureRemovalPhaseHelper.shouldShowDashboard()) emptyList()
else cardsBuilder.build(
QuickActionsCardBuilderParams(
siteModel = site,
onQuickActionStatsClick = this::quickActionStatsClick,
onQuickActionPagesClick = this::quickActionPagesClick,
onQuickActionPostsClick = this::quickActionPostsClick,
onQuickActionMediaClick = this::quickActionMediaClick
),
DomainRegistrationCardBuilderParams(
isDomainCreditAvailable = isDomainCreditAvailable,
domainRegistrationClick = this::domainRegistrationClick
Expand Down Expand Up @@ -729,7 +721,6 @@ class MySiteViewModel @Inject constructor(
if (defaultTab == MySiteTabType.SITE_MENU) {
add(Type.QUICK_START_CARD)
}
add(Type.QUICK_ACTIONS_CARD)
}

MySiteTabType.ALL -> emptyList()
Expand Down Expand Up @@ -979,37 +970,6 @@ class MySiteViewModel @Inject constructor(
_onNavigation.value = Event(SiteNavigationAction.OpenSitePicker(selectedSite))
}

private fun quickActionStatsClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
trackWithTabSourceIfNeeded(Stat.QUICK_ACTION_STATS_TAPPED)
quickStartRepository.completeTask(
quickStartRepository.quickStartType.getTaskFromString(QUICK_START_CHECK_STATS_LABEL)
)
_onNavigation.value = Event(getStatsNavigationActionForSite(selectedSite))
}

private fun quickActionPagesClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
trackWithTabSourceIfNeeded(Stat.QUICK_ACTION_PAGES_TAPPED)
quickStartRepository.completeTask(QuickStartNewSiteTask.REVIEW_PAGES)
_onNavigation.value = Event(SiteNavigationAction.OpenPages(selectedSite))
}

private fun quickActionPostsClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
trackWithTabSourceIfNeeded(Stat.QUICK_ACTION_POSTS_TAPPED)
_onNavigation.value = Event(SiteNavigationAction.OpenPosts(selectedSite))
}

private fun quickActionMediaClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
trackWithTabSourceIfNeeded(Stat.QUICK_ACTION_MEDIA_TAPPED)
quickStartRepository.requestNextStepOfTask(
quickStartRepository.quickStartType.getTaskFromString(QUICK_START_UPLOAD_MEDIA_LABEL)
)
_onNavigation.value = Event(SiteNavigationAction.OpenMedia(selectedSite))
}

private fun onQuickLinkRibbonStatsClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
trackWithTabSourceIfNeeded(Stat.QUICK_LINK_RIBBON_STATS_TAPPED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,23 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DomainRegistration
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardCardsBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DomainRegistrationCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.JetpackInstallFullPluginCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickActionsCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickLinkRibbonBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickStartCardBuilderParams
import org.wordpress.android.ui.mysite.cards.dashboard.CardsBuilder
import org.wordpress.android.ui.mysite.cards.jpfullplugininstall.JetpackInstallFullPluginCardBuilder
import org.wordpress.android.ui.mysite.cards.quickactions.QuickActionsCardBuilder
import org.wordpress.android.ui.mysite.cards.quicklinksribbon.QuickLinkRibbonBuilder
import org.wordpress.android.ui.mysite.cards.quickstart.QuickStartCardBuilder
import org.wordpress.android.ui.utils.ListItemInteraction
import org.wordpress.android.util.BuildConfigWrapper
import javax.inject.Inject

class CardsBuilder @Inject constructor(
private val buildConfigWrapper: BuildConfigWrapper,
private val quickActionsCardBuilder: QuickActionsCardBuilder,
private val quickStartCardBuilder: QuickStartCardBuilder,
private val quickLinkRibbonBuilder: QuickLinkRibbonBuilder,
private val dashboardCardsBuilder: CardsBuilder,
private val jetpackInstallFullPluginCardBuilder: JetpackInstallFullPluginCardBuilder,
) {
@Suppress("LongParameterList")
fun build(
quickActionsCardBuilderParams: QuickActionsCardBuilderParams,
domainRegistrationCardBuilderParams: DomainRegistrationCardBuilderParams,
quickStartCardBuilderParams: QuickStartCardBuilderParams,
dashboardCardsBuilderParams: DashboardCardsBuilderParams,
Expand All @@ -39,9 +33,6 @@ class CardsBuilder @Inject constructor(
if (isMySiteTabsEnabled) {
cards.add(quickLinkRibbonBuilder.build(quickLinkRibbonBuilderParams))
}
if (shouldShowQuickActionsCard(isMySiteTabsEnabled)) {
cards.add(quickActionsCardBuilder.build(quickActionsCardBuilderParams))
}
jetpackInstallFullPluginCardBuilder.build(jetpackInstallFullPluginCardBuilderParams)?.let {
cards.add(it)
}
Expand All @@ -55,10 +46,6 @@ class CardsBuilder @Inject constructor(
return cards
}

private fun shouldShowQuickActionsCard(isMySiteTabsEnabled: Boolean): Boolean {
return buildConfigWrapper.isQuickActionEnabled && !isMySiteTabsEnabled
}

private fun trackAndBuildDomainRegistrationCard(
params: DomainRegistrationCardBuilderParams
): DomainRegistrationCard {
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5d80261

Please sign in to comment.