From df320aaccab6e89caefa0fab0a9b9e8307d7b8c3 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:07:07 +0530 Subject: [PATCH 01/22] - Removes: Quick action build logic from MySiteViewModel --- .../android/ui/mysite/MySiteViewModel.kt | 38 ------------------- .../android/ui/mysite/cards/CardsBuilder.kt | 10 ----- 2 files changed, 48 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt index 6a373854437b..819a348471bd 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt @@ -555,13 +555,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 @@ -979,37 +972,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) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt index 5d6b860bf034..6cfa92a4c4de 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt @@ -18,8 +18,6 @@ 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, @@ -27,7 +25,6 @@ class CardsBuilder @Inject constructor( ) { @Suppress("LongParameterList") fun build( - quickActionsCardBuilderParams: QuickActionsCardBuilderParams, domainRegistrationCardBuilderParams: DomainRegistrationCardBuilderParams, quickStartCardBuilderParams: QuickStartCardBuilderParams, dashboardCardsBuilderParams: DashboardCardsBuilderParams, @@ -39,9 +36,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) } @@ -55,10 +49,6 @@ class CardsBuilder @Inject constructor( return cards } - private fun shouldShowQuickActionsCard(isMySiteTabsEnabled: Boolean): Boolean { - return buildConfigWrapper.isQuickActionEnabled && !isMySiteTabsEnabled - } - private fun trackAndBuildDomainRegistrationCard( params: DomainRegistrationCardBuilderParams ): DomainRegistrationCard { From 3738d4d72570caf7c52265b0b853358c61c8434d Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:35:35 +0530 Subject: [PATCH 02/22] - Removes: Quick action build logic from CardsBuilderTest --- .../ui/mysite/cards/CardsBuilderTest.kt | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt index d3a881f6403e..e256cf2e04ec 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt @@ -31,29 +31,20 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DomainTran import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.JetpackInstallFullPluginCardBuilderParams import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.PagesCardBuilderParams import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.PostCardBuilderParams -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.TodaysStatsCardBuilderParams 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.mysite.cards.quickstart.QuickStartCardType import org.wordpress.android.ui.mysite.cards.quickstart.QuickStartRepository.QuickStartCategory import org.wordpress.android.ui.quickstart.QuickStartTaskDetails import org.wordpress.android.ui.utils.UiString.UiStringText -import org.wordpress.android.util.BuildConfigWrapper import org.wordpress.android.ui.mysite.cards.dashboard.CardsBuilder as DashboardCardsBuilder @RunWith(MockitoJUnitRunner::class) class CardsBuilderTest { - @Mock - lateinit var buildConfigWrapper: BuildConfigWrapper - - @Mock - lateinit var quickActionsCardBuilder: QuickActionsCardBuilder - @Mock lateinit var quickStartCardBuilder: QuickStartCardBuilder @@ -80,7 +71,6 @@ class CardsBuilderTest { @Before fun setUp() { setUpCardsBuilder() - setUpQuickActionsBuilder() setUpQuickStartCardBuilder() setUpDashboardCardsBuilder() setUpQuickLinkRibbonBuilder() @@ -183,13 +173,6 @@ class CardsBuilderTest { ): List { whenever(buildConfigWrapper.isQuickActionEnabled).thenReturn(isQuickActionEnabled) return cardsBuilder.build( - quickActionsCardBuilderParams = QuickActionsCardBuilderParams( - siteModel = site, - onQuickActionMediaClick = mock(), - onQuickActionPagesClick = mock(), - onQuickActionPostsClick = mock(), - onQuickActionStatsClick = mock() - ), domainRegistrationCardBuilderParams = DomainRegistrationCardBuilderParams( isDomainCreditAvailable = isDomainCreditAvailable, domainRegistrationClick = mock() @@ -257,12 +240,6 @@ class CardsBuilderTest { ) } - private fun setUpQuickActionsBuilder() { - doAnswer { - initQuickActionsCard() - }.whenever(quickActionsCardBuilder).build(any()) - } - private fun setUpQuickStartCardBuilder() { doAnswer { initQuickStartCard() @@ -283,8 +260,6 @@ class CardsBuilderTest { private fun setUpCardsBuilder() { cardsBuilder = CardsBuilder( - buildConfigWrapper, - quickActionsCardBuilder, quickStartCardBuilder, quickLinkRibbonBuilder, dashboardCardsBuilder, From e51df06652e1d866000dea4e505a8522b6271bd3 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:36:11 +0530 Subject: [PATCH 03/22] - Removes: redundant import for Quick actions car --- .../main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt index 819a348471bd..86a2b76950d0 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteViewModel.kt @@ -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 From d57a64b048d9e34780f9b8cec0afbc73128ba8d5 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:39:47 +0530 Subject: [PATCH 04/22] - Removes: redundant tests for quick action card from CardsBuilderTest --- .../ui/mysite/cards/CardsBuilderTest.kt | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt index e256cf2e04ec..250c62b03e5f 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt @@ -91,22 +91,6 @@ class CardsBuilderTest { assertThat(cards.findDomainRegistrationCard()).isNull() } - /* QUICK ACTIONS CARD */ - - @Test - fun `given quick action enabled + tabs disabled, when cards built, then quick actions card is built`() { - val cards = buildCards(isQuickActionEnabled = true, isMySiteTabsEnabled = false) - - assertThat(cards.findQuickActionsCard()).isNotNull - } - - @Test - fun `given quick action disabled, when cards built, then quick actions card is not built`() { - val cards = buildCards(isQuickActionEnabled = false) - - assertThat(cards.findQuickActionsCard()).isNull() - } - /* QUICK START CARD */ @Test @@ -147,9 +131,6 @@ class CardsBuilderTest { assertThat(cards.findQuickLinkRibbon()).isNotNull } - private fun List.findQuickActionsCard() = - this.find { it is QuickActionsCard } as QuickActionsCard? - private fun List.findQuickStartCard() = this.find { it is QuickStartCard } as QuickStartCard? private fun List.findDashboardCards() = this.find { it is DashboardCards } @@ -162,7 +143,6 @@ class CardsBuilderTest { @Suppress("LongMethod") private fun buildCards( - isQuickActionEnabled: Boolean = true, activeTask: QuickStartTask? = null, isDomainCreditAvailable: Boolean = false, isEligibleForDomainCard: Boolean = false, @@ -171,7 +151,6 @@ class CardsBuilderTest { isMySiteTabsEnabled: Boolean = false, isEligibleForDomainTransferCard: Boolean = false, ): List { - whenever(buildConfigWrapper.isQuickActionEnabled).thenReturn(isQuickActionEnabled) return cardsBuilder.build( domainRegistrationCardBuilderParams = DomainRegistrationCardBuilderParams( isDomainCreditAvailable = isDomainCreditAvailable, @@ -267,15 +246,6 @@ class CardsBuilderTest { ) } - private fun initQuickActionsCard() = QuickActionsCard( - title = UiStringText(""), - onStatsClick = mock(), - onPagesClick = mock(), - onPostsClick = mock(), - onMediaClick = mock(), - showPages = false - ) - private fun initQuickStartCard() = QuickStartCard( title = UiStringText(""), taskTypeItems = listOf( From 8578e64a13c45fdb74562d40fc36ede0393a18d5 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:40:19 +0530 Subject: [PATCH 05/22] - Removes: redundant import for quick actions card --- .../org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt index 250c62b03e5f..be0de7f6e358 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/CardsBuilderTest.kt @@ -16,7 +16,6 @@ import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTaskType import org.wordpress.android.ui.mysite.MySiteCardAndItem 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.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.QuickStartCard.QuickStartTaskTypeItem From 04fc79f74619d59bc45c4baf4504614f65170acc Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:53:51 +0530 Subject: [PATCH 06/22] - Removes: Quick action card builder and test class --- .../quickactions/QuickActionsCardBuilder.kt | 19 ----- .../QuickActionsCardBuilderTest.kt | 70 ------------------- 2 files changed, 89 deletions(-) delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilder.kt delete mode 100644 WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilderTest.kt diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilder.kt deleted file mode 100644 index 43a027011262..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilder.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.wordpress.android.ui.mysite.cards.quickactions - -import org.wordpress.android.R -import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickActionsCard -import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickActionsCardBuilderParams -import org.wordpress.android.ui.utils.ListItemInteraction -import org.wordpress.android.ui.utils.UiString.UiStringRes -import javax.inject.Inject - -class QuickActionsCardBuilder @Inject constructor() { - fun build(params: QuickActionsCardBuilderParams) = QuickActionsCard( - title = UiStringRes(R.string.my_site_quick_actions_title), - onStatsClick = ListItemInteraction.create(params.onQuickActionStatsClick), - onPagesClick = ListItemInteraction.create(params.onQuickActionPagesClick), - onPostsClick = ListItemInteraction.create(params.onQuickActionPostsClick), - onMediaClick = ListItemInteraction.create(params.onQuickActionMediaClick), - showPages = params.siteModel.isSelfHostedAdmin || params.siteModel.hasCapabilityEditPages - ) -} diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilderTest.kt deleted file mode 100644 index 401a64effb5e..000000000000 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsCardBuilderTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -package org.wordpress.android.ui.mysite.cards.quickactions - -import kotlinx.coroutines.ExperimentalCoroutinesApi -import org.assertj.core.api.Assertions.assertThat -import org.junit.Before -import org.junit.Test -import org.mockito.Mock -import org.mockito.kotlin.whenever -import org.wordpress.android.BaseUnitTest -import org.wordpress.android.R -import org.wordpress.android.fluxc.model.SiteModel -import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickActionsCard -import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.QuickActionsCardBuilderParams -import org.wordpress.android.ui.utils.UiString.UiStringRes - -@ExperimentalCoroutinesApi -class QuickActionsCardBuilderTest : BaseUnitTest() { - @Mock - lateinit var siteModel: SiteModel - private lateinit var builder: QuickActionsCardBuilder - - private val onStatsClick: () -> Unit = {} - private val onPostsClick: () -> Unit = {} - private val onPagesClick: () -> Unit = {} - private val onMediaClick: () -> Unit = {} - - @Before - fun setUp() { - builder = QuickActionsCardBuilder() - } - - /* TITLE */ - - @Test - fun `when toolbar is built, then title exists`() { - val quickActionsBlock = buildQuickActionsCard() - - assertThat(quickActionsBlock.title).isEqualTo(UiStringRes(R.string.my_site_quick_actions_title)) - } - - /* ACTION CLICKS */ - @Test - fun `when card is built, then action item click are set on the card`() { - val quickActionsCard = buildQuickActionsCard() - - assertThat(quickActionsCard.onStatsClick).isNotNull - assertThat(quickActionsCard.onPagesClick).isNotNull - assertThat(quickActionsCard.onPostsClick).isNotNull - assertThat(quickActionsCard.onMediaClick).isNotNull - } - - private fun buildQuickActionsCard( - showPages: Boolean = true - ): QuickActionsCard { - setShowPages(showPages) - return builder.build( - QuickActionsCardBuilderParams( - siteModel, - onStatsClick, - onPagesClick, - onPostsClick, - onMediaClick - ) - ) - } - - private fun setShowPages(showPages: Boolean) { - whenever(siteModel.isSelfHostedAdmin).thenReturn(showPages) - } -} From ecc2ff0a60fee963e2ce11361402d09952a68228 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 11:55:56 +0530 Subject: [PATCH 07/22] - Removes: Redundant import for quick actions card --- .../java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt index 6cfa92a4c4de..9e1d377ade31 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/CardsBuilder.kt @@ -5,16 +5,13 @@ 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( From 2ce5d35c16964848498fa0ebdb9c8fa014cdaaa9 Mon Sep 17 00:00:00 2001 From: Ajesh R Pai Date: Tue, 5 Sep 2023 12:03:12 +0530 Subject: [PATCH 08/22] - Removes: Quick actions card view classess - Removes: styles used for quick actions card - Removes: Quick action card layout files - Removes: Quick action card viewholder --- .../android/ui/mysite/MySiteAdapter.kt | 1 - .../quickactions/QuickActionsViewHolder.kt | 38 ------- .../res/layout/my_site_quick_actions_card.xml | 31 ------ .../main/res/layout/quick_actions_card.xml | 100 ------------------ WordPress/src/main/res/values/styles.xml | 22 ---- 5 files changed, 192 deletions(-) delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsViewHolder.kt delete mode 100644 WordPress/src/main/res/layout/my_site_quick_actions_card.xml delete mode 100644 WordPress/src/main/res/layout/quick_actions_card.xml diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteAdapter.kt index 61c33ae2270f..fc7a920cf6d2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteAdapter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteAdapter.kt @@ -53,7 +53,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) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsViewHolder.kt deleted file mode 100644 index e95c167445fc..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/quickactions/QuickActionsViewHolder.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.wordpress.android.ui.mysite.cards.quickactions - -import android.view.View -import android.view.ViewGroup -import org.wordpress.android.databinding.MySiteCardToolbarBinding -import org.wordpress.android.databinding.MySiteQuickActionsCardBinding -import org.wordpress.android.databinding.QuickActionsCardBinding -import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickActionsCard -import org.wordpress.android.ui.mysite.MySiteCardAndItemViewHolder -import org.wordpress.android.ui.utils.UiHelpers -import org.wordpress.android.util.extensions.viewBinding - -class QuickActionsViewHolder( - parent: ViewGroup, - private val uiHelpers: UiHelpers -) : MySiteCardAndItemViewHolder( - parent.viewBinding(MySiteQuickActionsCardBinding::inflate) -) { - fun bind(card: QuickActionsCard) = with(binding) { - quickActionsToolbar.update(card) - quickActionsCard.update(card) - } - - private fun MySiteCardToolbarBinding.update(card: QuickActionsCard) { - mySiteCardToolbarTitle.text = uiHelpers.getTextOfUiString(itemView.context, card.title) - } - - private fun QuickActionsCardBinding.update(card: QuickActionsCard) { - quickActionStatsButton.setOnClickListener { card.onStatsClick.click() } - quickActionPostsButton.setOnClickListener { card.onPostsClick.click() } - quickActionMediaButton.setOnClickListener { card.onMediaClick.click() } - quickActionPagesButton.setOnClickListener { card.onPagesClick.click() } - - val pagesVisibility = if (card.showPages) View.VISIBLE else View.GONE - quickActionPagesButton.visibility = pagesVisibility - quickActionPagesLabel.visibility = pagesVisibility - } -} diff --git a/WordPress/src/main/res/layout/my_site_quick_actions_card.xml b/WordPress/src/main/res/layout/my_site_quick_actions_card.xml deleted file mode 100644 index f31795933380..000000000000 --- a/WordPress/src/main/res/layout/my_site_quick_actions_card.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/quick_actions_card.xml b/WordPress/src/main/res/layout/quick_actions_card.xml deleted file mode 100644 index 297f05cf81c7..000000000000 --- a/WordPress/src/main/res/layout/quick_actions_card.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/WordPress/src/main/res/values/styles.xml b/WordPress/src/main/res/values/styles.xml index a42c222932ec..52285bfa6a52 100644 --- a/WordPress/src/main/res/values/styles.xml +++ b/WordPress/src/main/res/values/styles.xml @@ -474,28 +474,6 @@ @dimen/text_sz_medium - - - -