Skip to content

Commit

Permalink
- Removes: Redundant JetpackInstallFullPluginCardBuilderParams
Browse files Browse the repository at this point in the history
  • Loading branch information
AjeshRPai committed Mar 25, 2024
1 parent 8120e49 commit cbee896
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ sealed class MySiteCardAndItemBuilderParams {
val onActionClick: () -> Unit
)

data class JetpackInstallFullPluginCardBuilderParams(
val site: SiteModel,
val onLearnMoreClick: () -> Unit,
val onHideMenuItemClick: () -> Unit,
)

data class PersonalizeCardBuilderParams(
val onClick: () -> Unit
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.lifecycle.distinctUntilChanged
import org.wordpress.android.analytics.AnalyticsTracker
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.JetpackInstallFullPluginCard
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.JetpackInstallFullPluginCardBuilderParams
import org.wordpress.android.ui.mysite.SelectedSiteRepository
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.ui.utils.ListItemInteraction
Expand Down Expand Up @@ -41,26 +40,16 @@ class JetpackInstallFullPluginCardViewModelSlice @Inject constructor(
_onOpenJetpackInstallFullPluginOnboarding.postValue(Event(Unit))
}

fun buildCard(site: SiteModel) {
build(
JetpackInstallFullPluginCardBuilderParams(
site = site,
onLearnMoreClick = this::onJetpackInstallFullPluginLearnMoreClick,
onHideMenuItemClick = this::onJetpackInstallFullPluginHideMenuItemClick
)
)
}

fun build(
params: JetpackInstallFullPluginCardBuilderParams
fun buildCard(
site: SiteModel
) {
if (shouldShowCard(params.site)) {
if (shouldShowCard(site)) {
_uiModel.postValue(
JetpackInstallFullPluginCard(
siteName = params.site.name,
pluginNames = params.site.activeIndividualJetpackPluginNames().orEmpty(),
onLearnMoreClick = ListItemInteraction.create(params.onLearnMoreClick),
onHideMenuItemClick = ListItemInteraction.create(params.onHideMenuItemClick),
siteName = site.name,
pluginNames = site.activeIndividualJetpackPluginNames().orEmpty(),
onLearnMoreClick = ListItemInteraction.create(this::onJetpackInstallFullPluginLearnMoreClick),
onHideMenuItemClick = ListItemInteraction.create(this::onJetpackInstallFullPluginHideMenuItemClick),
)
)
} else _uiModel.postValue(null)
Expand Down

0 comments on commit cbee896

Please sign in to comment.