Skip to content

Commit

Permalink
handle free plan selection
Browse files Browse the repository at this point in the history
handle free plan with free domain selection after first selecting paid domain
  • Loading branch information
ravishanker committed Oct 15, 2023
1 parent 782b7b4 commit 05d9682
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ class SiteCreationMainVM @Inject constructor(
siteCreationState = siteCreationState.copy(domain = null)
}
}
if (wizardStep == SiteCreationStep.PLANS) {
siteCreationState.plan?.let {
siteCreationState = siteCreationState.copy(plan = null)
}
}
}

fun onDomainsScreenFinished(domain: DomainModel) {
Expand All @@ -271,6 +276,18 @@ class SiteCreationMainVM @Inject constructor(

fun onPlanSelection(plan: PlanModel) {
siteCreationState = siteCreationState.copy(plan = plan)
if (plan.productSlug == "free_plan") {
// if they select a paid domain, then choose a free plan, with free domain on plan selection screen
siteCreationState = siteCreationState.copy(
domain = DomainModel(
domainName = plan.productName.orEmpty(),
isFree = true,
cost = "",
productId = 0,
supportsPrivacy = false
)
)
}
wizardManager.showNextStep()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ class SiteCreationPlansViewModel @Inject constructor(

val planId = uri.getQueryParameter(PLAN_ID_PARAM)?.toInt() ?: 0
val planSlug = uri.getQueryParameter(PLAN_SLUG_PARAM).orEmpty()
val domainName = uri.getQueryParameter(PAID_DOMAIN_NAME).orEmpty()

val planModel = PlanModel(
productId = planId,
productSlug = planSlug,
productName = "",
productName = domainName, // using domainName here
isCurrentPlan = false,
hasDomainCredit = false
)
Expand Down

0 comments on commit 05d9682

Please sign in to comment.