Skip to content

Commit

Permalink
Merge pull request #19135 from wordpress-mobile/Domain-Dashboard-Card…
Browse files Browse the repository at this point in the history
…-Remove-Feature-Flag

Domain dashboard card: Remove feature flag
  • Loading branch information
ravishanker authored Sep 7, 2023
2 parents eed6684 + 8f19123 commit 0ad3abc
Show file tree
Hide file tree
Showing 32 changed files with 4 additions and 880 deletions.
1 change: 0 additions & 1 deletion WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ android {
buildConfigField "boolean", "JETPACK_INSTALL_FULL_PLUGIN", "false"
buildConfigField "boolean", "ENABLE_BLAZE_FEATURE", "false"
buildConfigField "boolean", "WP_INDIVIDUAL_PLUGIN_OVERLAY", "false"
buildConfigField "boolean", "DASHBOARD_CARD_DOMAIN", "false"
buildConfigField "boolean", "DASHBOARD_CARD_FREE_TO_PAID_PLANS", "false"
buildConfigField "boolean", "SITE_EDITOR_MVP", "false"
buildConfigField "boolean", "JETPACK_SOCIAL", "false"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -286,45 +286,6 @@ class MySitesPage {
WPSupportUtils.clickOn(elementID)
}

// "Domains" Dashboard Card

fun scrollToDomainsCard(): MySitesPage {
return scrollToCard(R.id.dashboard_card_domain_cta)
}

fun tapDomainsCard(): DomainsScreen {
tapCard(R.id.dashboard_card_domain_cta)
return DomainsScreen()
}

fun assertDomainsCard(): MySitesPage {
Espresso.onView(
Matchers.allOf(
ViewMatchers.withId(R.id.dashboard_card_domain_cta),
ViewMatchers.isDescendantOfA(ViewMatchers.withId(R.id.dashboard_cards)),
ViewMatchers.hasDescendant(ViewMatchers.withId(R.id.dashboard_domain_card_more)),
ViewMatchers.hasDescendant(ViewMatchers.withId(R.id.dashboard_card_domain_image)),

ViewMatchers.hasDescendant(
Matchers.allOf(
ViewMatchers.withText(R.string.dashboard_card_domain_title),
ViewMatchers.withId(R.id.dashboard_card_domain_title),
)
),

ViewMatchers.hasDescendant(
Matchers.allOf(
ViewMatchers.withText(R.string.dashboard_card_domain_sub_title),
ViewMatchers.withId(R.id.dashboard_card_domain_sub_title),
)
)
)
)
.check(ViewAssertions.matches(ViewMatchers.isCompletelyDisplayed()))

return this
}

// "Pages" Dashboard Card

fun scrollToPagesCard(): MySitesPage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ class DashboardTests : BaseTest() {
wpLogin()
}

@Test
fun e2eDomainsCardNavigation() {
MySitesPage()
.scrollToDomainsCard()
.assertDomainsCard()
.tapDomainsCard()
.assertDomainsScreenLoaded()
}

@Test
fun e2ePagesCardNavigation() {
MySitesPage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartIte
PROMOTE_WITH_BLAZE_CARD,
DASHBOARD_DOMAIN_TRANSFER_CARD,
BLAZE_CAMPAIGNS_CARD,
DASHBOARD_DOMAIN_CARD,
DASHBOARD_PLANS_CARD,
PAGES_CARD_ERROR,
PAGES_CARD,
Expand Down Expand Up @@ -370,14 +369,6 @@ sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartIte
}
}

data class DashboardDomainCard(
val title: UiString?,
val subtitle: UiString?,
val onClick: ListItemInteraction,
val onHideMenuItemClick: ListItemInteraction,
val onMoreMenuClick: ListItemInteraction,
) : DashboardCard(dashboardCardType = DashboardCardType.DASHBOARD_DOMAIN_CARD)

data class DashboardPlansCard(
val title: UiString?,
val subtitle: UiString?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ sealed class MySiteCardAndItemBuilderParams {
val bloggingPromptCardBuilderParams: BloggingPromptCardBuilderParams,
val domainTransferCardBuilderParams: DomainTransferCardBuilderParams? = null,
val blazeCardBuilderParams: BlazeCardBuilderParams? = null,
val dashboardCardDomainBuilderParams: DashboardCardDomainBuilderParams,
val dashboardCardPlansBuilderParams: DashboardCardPlansBuilderParams,
val pagesCardBuilderParams: PagesCardBuilderParams,
val activityCardBuilderParams: ActivityCardBuilderParams
Expand Down Expand Up @@ -192,13 +191,6 @@ sealed class MySiteCardAndItemBuilderParams {
val onMoreMenuClick: () -> Unit
) : MySiteCardAndItemBuilderParams()

data class DashboardCardDomainBuilderParams(
val isEligible: Boolean = false,
val onClick: () -> Unit,
val onHideMenuItemClick: () -> Unit,
val onMoreMenuClick: () -> Unit
) : MySiteCardAndItemBuilderParams()

data class DashboardCardPlansBuilderParams(
val isEligible: Boolean = false,
val onClick: () -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.wordpress.android.ui.mysite.MySiteUiState.PartialState
import org.wordpress.android.ui.mysite.cards.blaze.BlazeCardSource
import org.wordpress.android.ui.mysite.cards.dashboard.CardsSource
import org.wordpress.android.ui.mysite.cards.dashboard.bloggingprompts.BloggingPromptCardSource
import org.wordpress.android.ui.mysite.cards.dashboard.domain.DashboardCardDomainSource
import org.wordpress.android.ui.mysite.cards.domainregistration.DomainRegistrationSource
import org.wordpress.android.ui.mysite.cards.quickstart.QuickStartCardSource
import javax.inject.Inject
Expand All @@ -25,7 +24,6 @@ class MySiteSourceManager @Inject constructor(
private val bloggingPromptCardSource: BloggingPromptCardSource,
blazeCardSource: BlazeCardSource,
private val selectedSiteRepository: SelectedSiteRepository,
dashboardCardDomainSource: DashboardCardDomainSource,
private val jetpackFeatureRemovalPhaseHelper: JetpackFeatureRemovalPhaseHelper
) {
private val mySiteSources: List<MySiteSource<*>> = listOf(
Expand All @@ -38,7 +36,6 @@ class MySiteSourceManager @Inject constructor(
cardsSource,
bloggingPromptCardSource,
blazeCardSource,
dashboardCardDomainSource,
)

private val showDashboardCards: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ data class MySiteUiState(
val cardsUpdate: CardsUpdate? = null,
val bloggingPromptsUpdate: BloggingPromptUpdate? = null,
val blazeCardUpdate: PartialState.BlazeCardUpdate? = null,
val hasSiteCustomDomains: Boolean? = null
) {
sealed class PartialState {
data class CurrentAvatarUrl(val url: String) : PartialState()
data class SelectedSite(val site: SiteModel?) : PartialState()
data class ShowSiteIconProgressBar(val showSiteIconProgressBar: Boolean) : PartialState()
data class DomainCreditAvailable(val isDomainCreditAvailable: Boolean) : PartialState()
data class CustomDomainsAvailable(val hasSiteCustomDomains: Boolean?) : PartialState()

data class JetpackCapabilities(val scanAvailable: Boolean, val backupAvailable: Boolean) : PartialState()
data class QuickStartUpdate(
val activeTask: QuickStartTask? = null,
Expand Down Expand Up @@ -67,9 +64,6 @@ data class MySiteUiState(
is SelectedSite -> uiState.copy(site = partialState.site)
is ShowSiteIconProgressBar -> uiState.copy(showSiteIconProgressBar = partialState.showSiteIconProgressBar)
is DomainCreditAvailable -> uiState.copy(isDomainCreditAvailable = partialState.isDomainCreditAvailable)
is PartialState.CustomDomainsAvailable -> uiState.copy(
hasSiteCustomDomains = partialState.hasSiteCustomDomains
)
is JetpackCapabilities -> uiState.copy(
scanAvailable = partialState.scanAvailable,
backupAvailable = partialState.backupAvailable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.JetpackBadge
import org.wordpress.android.ui.mysite.MySiteCardAndItem.SiteInfoHeaderCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.BloggingPromptCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardCardDomainBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardCardPlansBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardCardsBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DomainRegistrationCardBuilderParams
Expand All @@ -83,7 +82,6 @@ import org.wordpress.android.ui.mysite.cards.DomainRegistrationCardShownTracker
import org.wordpress.android.ui.mysite.cards.dashboard.CardsTracker
import org.wordpress.android.ui.mysite.cards.dashboard.activity.ActivityLogCardViewModelSlice
import org.wordpress.android.ui.mysite.cards.dashboard.bloggingprompts.BloggingPromptsCardAnalyticsTracker
import org.wordpress.android.ui.mysite.cards.dashboard.domain.DashboardCardDomainUtils
import org.wordpress.android.ui.mysite.cards.dashboard.domaintransfer.DomainTransferCardViewModel
import org.wordpress.android.ui.mysite.cards.dashboard.pages.PagesCardViewModelSlice
import org.wordpress.android.ui.mysite.cards.dashboard.plans.PlansCardUtils
Expand Down Expand Up @@ -197,7 +195,6 @@ class MySiteViewModel @Inject constructor(
private val bloggingPromptsCardTrackHelper: BloggingPromptsCardTrackHelper,
private val getShowJetpackFullPluginInstallOnboardingUseCase: GetShowJetpackFullPluginInstallOnboardingUseCase,
private val jetpackInstallFullPluginShownTracker: JetpackInstallFullPluginShownTracker,
private val dashboardCardDomainUtils: DashboardCardDomainUtils,
private val dashboardCardPlansUtils: PlansCardUtils,
private val jetpackFeatureRemovalPhaseHelper: JetpackFeatureRemovalPhaseHelper,
private val wpJetpackIndividualPluginHelper: WPJetpackIndividualPluginHelper,
Expand Down Expand Up @@ -354,8 +351,7 @@ class MySiteViewModel @Inject constructor(
scanAvailable,
cardsUpdate,
bloggingPromptsUpdate,
blazeCardUpdate,
hasSiteCustomDomains
blazeCardUpdate
)
selectDefaultTabIfNeeded()
trackCardsAndItemsShownIfNeeded(state)
Expand All @@ -372,8 +368,6 @@ class MySiteViewModel @Inject constructor(

bloggingPromptsCardTrackHelper.onSiteChanged(site?.id)

dashboardCardDomainUtils.onSiteChanged(site?.id, state as? SiteSelected)

dashboardCardPlansUtils.onSiteChanged(site?.id, state as? SiteSelected)

domainTransferCardViewModel.onSiteChanged(site?.id, state as? SiteSelected)
Expand Down Expand Up @@ -405,8 +399,7 @@ class MySiteViewModel @Inject constructor(
scanAvailable: Boolean,
cardsUpdate: CardsUpdate?,
bloggingPromptUpdate: BloggingPromptUpdate?,
blazeCardUpdate: BlazeCardUpdate?,
hasSiteCustomDomains: Boolean?
blazeCardUpdate: BlazeCardUpdate?
): SiteSelected {
val siteItems = buildSiteSelectedState(
site,
Expand All @@ -417,8 +410,7 @@ class MySiteViewModel @Inject constructor(
scanAvailable,
cardsUpdate,
bloggingPromptUpdate,
blazeCardUpdate,
hasSiteCustomDomains
blazeCardUpdate
)

val siteInfoCardBuilderParams = SiteInfoCardBuilderParams(
Expand Down Expand Up @@ -505,8 +497,7 @@ class MySiteViewModel @Inject constructor(
scanAvailable: Boolean,
cardsUpdate: CardsUpdate?,
bloggingPromptUpdate: BloggingPromptUpdate?,
blazeCardUpdate: BlazeCardUpdate?,
hasSiteCustomDomains: Boolean?
blazeCardUpdate: BlazeCardUpdate?
): Map<MySiteTabType, List<MySiteCardAndItem>> {
val infoItem = siteItemsBuilder.build(
InfoItemBuilderParams(
Expand Down Expand Up @@ -594,14 +585,6 @@ class MySiteViewModel @Inject constructor(
uiModel.value?.state as? SiteSelected
),
blazeCardBuilderParams = blazeCardViewModelSlice.getBlazeCardBuilderParams(blazeCardUpdate),
dashboardCardDomainBuilderParams = DashboardCardDomainBuilderParams(
isEligible = dashboardCardDomainUtils.shouldShowCard(
site, isDomainCreditAvailable, hasSiteCustomDomains
),
onClick = this::onDashboardCardDomainClick,
onHideMenuItemClick = this::onDashboardCardDomainHideMenuItemClick,
onMoreMenuClick = this::onDashboardCardDomainMoreMenuClick
),
dashboardCardPlansBuilderParams = DashboardCardPlansBuilderParams(
isEligible = dashboardCardPlansUtils.shouldShowCard(site),
onClick = this::onDashboardCardPlansClick,
Expand Down Expand Up @@ -1018,7 +1001,6 @@ class MySiteViewModel @Inject constructor(
checkAndShowJetpackFullPluginInstallOnboarding()
checkAndShowQuickStartNotice()
bloggingPromptsCardTrackHelper.onResume(currentTab)
dashboardCardDomainUtils.onResume(currentTab, uiModel.value?.state as? SiteSelected)
dashboardCardPlansUtils.onResume(currentTab, uiModel.value?.state as? SiteSelected)
}

Expand Down Expand Up @@ -1426,24 +1408,6 @@ class MySiteViewModel @Inject constructor(
_onOpenJetpackInstallFullPluginOnboarding.postValue(Event(Unit))
}

private fun onDashboardCardDomainMoreMenuClick() {
dashboardCardDomainUtils.trackDashboardCardDomainMoreMenuTapped(uiModel.value?.state as? SiteSelected)
}

private fun onDashboardCardDomainClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
dashboardCardDomainUtils.trackDashboardCardDomainTapped(uiModel.value?.state as? SiteSelected)
_onNavigation.value = Event(SiteNavigationAction.OpenPaidDomainSearch(selectedSite))
}

private fun onDashboardCardDomainHideMenuItemClick() {
dashboardCardDomainUtils.trackDashboardCardDomainHiddenByUser(uiModel.value?.state as? SiteSelected)
selectedSiteRepository.getSelectedSite()?.let {
dashboardCardDomainUtils.hideCard(it.siteId)
}
refresh()
}

private fun onDashboardCardPlansClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
dashboardCardPlansUtils.trackCardTapped(uiModel.value?.state as? SiteSelected)
Expand Down Expand Up @@ -1541,7 +1505,6 @@ class MySiteViewModel @Inject constructor(
.forEach { jetpackFeatureCardShownTracker.trackShown(it.type) }
siteSelected.cardAndItems.filterIsInstance<JetpackInstallFullPluginCard>()
.forEach { jetpackInstallFullPluginShownTracker.trackShown(it.type, quickStartRepository.currentTab) }
dashboardCardDomainUtils.trackDashboardCardDomainShown(viewModelScope, siteSelected)
dashboardCardPlansUtils.trackCardShown(viewModelScope, siteSelected)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.recyclerview.widget.DiffUtil.Callback
import androidx.recyclerview.widget.RecyclerView.Adapter
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.DashboardCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.DashboardCard.ActivityCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.DashboardCard.DashboardDomainCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.DashboardCard.DomainTransferCardModel
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.DashboardCard.DashboardPlansCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.DashboardCard.BlazeCard.PromoteWithBlazeCard
Expand All @@ -29,7 +28,6 @@ import org.wordpress.android.ui.mysite.cards.dashboard.error.ErrorWithinCardView
import org.wordpress.android.ui.mysite.cards.dashboard.pages.PagesCardViewHolder
import org.wordpress.android.ui.mysite.cards.dashboard.posts.PostCardViewHolder
import org.wordpress.android.ui.mysite.cards.dashboard.todaysstats.TodaysStatsCardViewHolder
import org.wordpress.android.ui.mysite.cards.dashboard.domain.DashboardDomainCardViewHolder
import org.wordpress.android.ui.mysite.cards.dashboard.domaintransfer.DomainTransferCardViewHolder
import org.wordpress.android.ui.mysite.cards.dashboard.plans.PlansCardViewHolder
import org.wordpress.android.ui.utils.UiHelpers
Expand Down Expand Up @@ -62,7 +60,6 @@ class CardsAdapter(
DashboardCardType.DASHBOARD_DOMAIN_TRANSFER_CARD.ordinal -> DomainTransferCardViewHolder(parent)
DashboardCardType.PROMOTE_WITH_BLAZE_CARD.ordinal -> PromoteWithBlazeCardViewHolder(parent, uiHelpers)
DashboardCardType.BLAZE_CAMPAIGNS_CARD.ordinal -> BlazeCampaignsCardViewHolder(parent)
DashboardCardType.DASHBOARD_DOMAIN_CARD.ordinal -> DashboardDomainCardViewHolder(parent, uiHelpers)
DashboardCardType.DASHBOARD_PLANS_CARD.ordinal -> PlansCardViewHolder(parent, uiHelpers)
DashboardCardType.PAGES_CARD.ordinal -> PagesCardViewHolder(parent, uiHelpers)
DashboardCardType.ACTIVITY_CARD.ordinal -> ActivityCardViewHolder(parent, uiHelpers)
Expand All @@ -82,7 +79,6 @@ class CardsAdapter(
is DomainTransferCardViewHolder -> holder.bind(items[position] as DomainTransferCardModel)
is PromoteWithBlazeCardViewHolder -> holder.bind(items[position] as PromoteWithBlazeCard)
is BlazeCampaignsCardViewHolder -> holder.bind(items[position] as BlazeCampaignsCardModel)
is DashboardDomainCardViewHolder -> holder.bind(items[position] as DashboardDomainCard)
is PlansCardViewHolder -> holder.bind(items[position] as DashboardPlansCard)
is PagesCardViewHolder -> holder.bind(items[position] as PagesCard)
is ActivityCardViewHolder -> holder.bind(items[position] as ActivityCard)
Expand Down Expand Up @@ -115,7 +111,6 @@ class CardsAdapter(
oldItem is BloggingPromptCardWithData && newItem is BloggingPromptCardWithData -> true
oldItem is PromoteWithBlazeCard && newItem is PromoteWithBlazeCard -> true
oldItem is BlazeCampaignsCardModel && newItem is BlazeCampaignsCardModel -> true
oldItem is DashboardDomainCard && newItem is DashboardDomainCard -> true
oldItem is DomainTransferCardModel && newItem is DomainTransferCardModel -> true
oldItem is DashboardPlansCard && newItem is DashboardPlansCard -> true
oldItem is PagesCard && newItem is PagesCard -> true
Expand Down
Loading

0 comments on commit 0ad3abc

Please sign in to comment.