Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plans in site creation: Plan selection screen #19304

Merged
merged 27 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5442558
Update SiteCreationStep.kt
ravishanker Oct 5, 2023
ad2692a
Create SiteCreationPlansUiState.kt
ravishanker Oct 5, 2023
012d532
Create SiteCreationPlansWebViewClient.kt
ravishanker Oct 5, 2023
363aa9a
Update strings.xml
ravishanker Oct 5, 2023
7ca8666
Update SiteCreationMainVM.kt
ravishanker Oct 5, 2023
71969f0
Create SiteCreationPlansFragment.kt
ravishanker Oct 5, 2023
8e68b03
Create SiteCreationPlansViewModel.kt
ravishanker Oct 5, 2023
3f62e76
Update SiteCreationActivity.kt
ravishanker Oct 5, 2023
62c0f59
Add params to request
ravishanker Oct 6, 2023
3b54c20
Merge branch 'trunk' into Plans-in-site-creation-Plan-Selection-Screen
ravishanker Oct 8, 2023
fb4dbd7
Detect plan selection in site creation flow
irfano Oct 12, 2023
68559c3
Update SiteCreationPlansViewModel.kt
ravishanker Oct 13, 2023
44c8e2b
Update SiteCreationPlansWebViewClient.kt
ravishanker Oct 13, 2023
3cf4396
Update DomainRegistrationCheckoutWebViewNavigationDelegate.kt
ravishanker Oct 13, 2023
fc30b40
Update SiteCreationProgressViewModel.kt
ravishanker Oct 13, 2023
b91069b
Remove unused
ravishanker Oct 13, 2023
7b80db6
Update SiteCreationFixtures.kt
ravishanker Oct 13, 2023
69fb18b
Create PlansScreenListener.kt
ravishanker Oct 13, 2023
fac06f3
Update SiteCreationPlansWebViewClient.kt
ravishanker Oct 13, 2023
f336392
Update SiteCreationPlansViewModel.kt
ravishanker Oct 13, 2023
8356847
Update SiteCreationPlansFragment.kt
ravishanker Oct 13, 2023
b92f5a8
Update SiteCreationActivity.kt
ravishanker Oct 13, 2023
a5ac692
Update SiteCreationMainVM.kt
ravishanker Oct 13, 2023
63015e7
Update SiteCreationPlansWebViewClient.kt
ravishanker Oct 14, 2023
b094d59
Update SiteCreationPlansViewModel.kt
ravishanker Oct 14, 2023
782b7b4
Update SiteCreationProgressViewModel.kt
ravishanker Oct 14, 2023
05d9682
handle free plan selection
ravishanker Oct 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add params to request
Add paid_domain_name and redirect_to params
  • Loading branch information
ravishanker committed Oct 6, 2023
commit 62c0f59972bf5e297663ff4cfc1d8dd4fb663d59
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class SiteCreationActivity : LocaleAwareActivity(),
HomePagePickerFragment.newInstance(target.wizardState.siteIntent)
}
DOMAINS -> SiteCreationDomainsFragment.newInstance(screenTitle)
PLANS -> SiteCreationPlansFragment.newInstance(screenTitle)
PLANS -> SiteCreationPlansFragment.newInstance(target.wizardState)
PROGRESS -> SiteCreationProgressFragment.newInstance(target.wizardState)
SITE_PREVIEW -> SiteCreationPreviewFragment.newInstance(screenTitle, target.wizardState)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ import org.wordpress.android.ui.compose.components.NavigationIcons
import org.wordpress.android.ui.compose.theme.AppTheme
import org.wordpress.android.ui.compose.utils.uiStringText
import org.wordpress.android.ui.main.jetpack.migration.compose.state.LoadingState
import org.wordpress.android.ui.sitecreation.SiteCreationBaseFormFragment.Companion.EXTRA_SCREEN_TITLE
import org.wordpress.android.ui.sitecreation.SiteCreationActivity.Companion.ARG_STATE
import org.wordpress.android.ui.sitecreation.SiteCreationState
import org.wordpress.android.ui.sitecreation.plans.SiteCreationPlansWebViewClient.SiteCreationPlansWebViewClientListener
import org.wordpress.android.util.extensions.getParcelableCompat

@AndroidEntryPoint
class SiteCreationPlansFragment : Fragment(), SiteCreationPlansWebViewClientListener {
Expand All @@ -68,7 +70,8 @@ class SiteCreationPlansFragment : Fragment(), SiteCreationPlansWebViewClientList

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel.start()

viewModel.start(requireNotNull(requireArguments().getParcelableCompat(ARG_STATE)))
viewModel.actionEvents.onEach(this::handleActionEvents).launchIn(viewLifecycleOwner.lifecycleScope)
}

Expand Down Expand Up @@ -201,9 +204,10 @@ class SiteCreationPlansFragment : Fragment(), SiteCreationPlansWebViewClientList

companion object {
const val TAG = "site_creation_plans_fragment_tag"
fun newInstance(screenTitle: String) = SiteCreationPlansFragment().apply {

fun newInstance(siteCreationState: SiteCreationState) = SiteCreationPlansFragment().apply {
arguments = Bundle().apply {
putString(EXTRA_SCREEN_TITLE, screenTitle)
putParcelable(ARG_STATE, siteCreationState)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import org.wordpress.android.fluxc.store.AccountStore
import org.wordpress.android.fluxc.store.SiteStore
import org.wordpress.android.ui.WPWebViewActivity
import org.wordpress.android.ui.mysite.SelectedSiteRepository
import org.wordpress.android.ui.sitecreation.SiteCreationState
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.NetworkUtilsWrapper
import javax.inject.Inject
Expand All @@ -33,7 +34,10 @@ class SiteCreationPlansViewModel @Inject constructor(
private val _actionEvents = Channel<SiteCreationPlansActionEvent>(Channel.BUFFERED)
val actionEvents = _actionEvents.receiveAsFlow()

fun start() {
private lateinit var domainName: String

fun start(siteCreationState: SiteCreationState) {
domainName = requireNotNull(siteCreationState.domain).domainName
showPlans()
}

Expand Down Expand Up @@ -95,11 +99,12 @@ class SiteCreationPlansViewModel @Inject constructor(
}.toString()


// https://container-focused-fermi.calypso.live/plans/domainspurchases.wordpress.com
// return Uri.Builder().apply {
// scheme("https")
// authority("container-amazing-stonebraker.calypso.live")
// authority("container-jolly-cerf.calypso.live")
// appendPath("jetpack-app-plans")
// appendQueryParameter(PAID_DOMAIN_NAME, domainName)
// appendQueryParameter(REDIRECT_TO, REDIRECT_SCHEME)
// build()
// }.toString()
}
Expand Down Expand Up @@ -127,8 +132,7 @@ class SiteCreationPlansViewModel @Inject constructor(
}
return WPWebViewActivity.getAuthenticationPostData(
WPCOM_LOGIN_URL,
// "https://container-amazing-stonebraker.calypso.live/jetpack-app-plans",
addressToLoad,
url, // addressToLoad,
username,
"",
accessToken?:""
Expand Down Expand Up @@ -168,7 +172,8 @@ class SiteCreationPlansViewModel @Inject constructor(

const val WP_HOST = "https://wordpress.com"
const val PLANS_PATH = "plans" // "jetpack-app-plans"
const val REDIRECT_TO = "jetpackapp://"
const val REDIRECT_TO = "redirect_to"
const val REDIRECT_SCHEME = "jetpackapp://"
const val PAID_DOMAIN_NAME = "paid_domain_name"
const val PLANS_FREQUENCY_PATH = "yearly" // not required
const val PLANS_JETPACK_APP = "jetpackAppPlans" // not required
Expand Down
Loading