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

Fix don't keep activities on add fragment. #4466

Merged
merged 39 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
834e92c
Works for card element
michelleb-stripe Dec 13, 2021
167eb4a
Fix add fragment save card.
michelleb-stripe Dec 13, 2021
e67917f
Fix up comments explaing the why
michelleb-stripe Dec 13, 2021
f83fc1d
Cleanup code
michelleb-stripe Dec 13, 2021
5919b77
Add a note on the save customer card flow.
michelleb-stripe Dec 15, 2021
0e1f842
Add in SaveStateHandle
michelleb-stripe Dec 17, 2021
d6c2321
Working version with lots of extra log statements.
michelleb-stripe Dec 17, 2021
e421f0e
Remove log statements
michelleb-stripe Dec 17, 2021
f33bd72
Save the selected item
michelleb-stripe Dec 17, 2021
9c6bf52
Add savedHandleState to PaymentOptionsViewModel.
michelleb-stripe Dec 17, 2021
105e4eb
Returning user, on authentication screen, home, recent activities, Ca…
michelleb-stripe Dec 17, 2021
a54bbc5
Guest, Complete, home, recent, makes so not in processing state
michelleb-stripe Dec 17, 2021
110cf4b
PaymentSheet Complete working.
michelleb-stripe Dec 18, 2021
27fb25d
Fix problem in options flow
michelleb-stripe Dec 18, 2021
430175a
Merge branch 'master' into michelleb/dka-add-fragment
michelleb-stripe Dec 20, 2021
3ec4d42
All working.
michelleb-stripe Dec 21, 2021
a8558c1
Cleanup event reporter and other code.
michelleb-stripe Dec 21, 2021
1b5a9a6
Working on unit tests.
michelleb-stripe Dec 21, 2021
2bd6640
Unit tests passing and manual testing complete
michelleb-stripe Dec 22, 2021
6251944
Undo weak registry map changes.
michelleb-stripe Dec 22, 2021
4b6d36c
Add injection and injection fallback tests.
michelleb-stripe Dec 22, 2021
fb63654
format and apiDump
michelleb-stripe Dec 22, 2021
97ffad6
format and apiDump
michelleb-stripe Dec 22, 2021
53c68b0
Fix intermittent failures
michelleb-stripe Dec 22, 2021
a1823a6
Merge with master
michelleb-stripe Jan 10, 2022
281158e
format
michelleb-stripe Jan 10, 2022
bcfb35c
Merge remote-tracking branch 'origin/master' into michelleb/dka-add-f…
michelleb-stripe Jan 31, 2022
040b914
Fix bug launching google pay.
michelleb-stripe Jan 31, 2022
78d1113
Fix bug on add button.
michelleb-stripe Feb 2, 2022
a67a496
Fix bug launching google pay.
michelleb-stripe Feb 3, 2022
ce57694
Update payments-core/src/test/java/com/stripe/android/googlepaylaunch…
michelleb-stripe Feb 7, 2022
2734828
Merge with master
michelleb-stripe Feb 7, 2022
ec9fd9b
Merge branch 'michelleb/dka-add-fragment' of github.com:stripe/stripe…
michelleb-stripe Feb 7, 2022
40bf19b
Remove parcelable on TransitionTarget and fix test dispatcher class.
michelleb-stripe Feb 7, 2022
fb1bb27
Cleanup
michelleb-stripe Feb 7, 2022
57607bd
Update paymentsheet/src/main/java/com/stripe/android/paymentsheet/Pay…
michelleb-stripe Feb 8, 2022
7cb4342
Update paymentsheet/src/main/java/com/stripe/android/paymentsheet/Pay…
michelleb-stripe Feb 8, 2022
314f5a3
Remove println
michelleb-stripe Feb 8, 2022
f0a9994
Merge branch 'michelleb/dka-add-fragment' of github.com:stripe/stripe…
michelleb-stripe Feb 8, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class GooglePayPaymentMethodLauncherViewModelTest {
verify(factorySpy, times(0)).fallbackInitialize(any())
assertThat(createdViewModel).isEqualTo(viewModel)

WeakMapInjectorRegistry.staticCacheMap.clear()
WeakMapInjectorRegistry.clear()
michelleb-stripe marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Stripe3ds2TransactionActivityTest {

@After
fun cleanUpInjector() {
WeakMapInjectorRegistry.staticCacheMap.clear()
WeakMapInjectorRegistry.clear()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Stripe3ds2TransactionViewModelFactoryTest {
verify(factorySpy, times(0)).fallbackInitialize(any())
assertThat(createdViewModel).isEqualTo(viewModel)

WeakMapInjectorRegistry.staticCacheMap.clear()
WeakMapInjectorRegistry.clear()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class WeakMapInjectorRegistryTest {

@Before
fun clearStaticCache() {
WeakMapInjectorRegistry.staticCacheMap.clear()
WeakMapInjectorRegistry.clear()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ class PaymentLauncherViewModelTest {
verify(factorySpy, times(0)).fallbackInitialize(any())
assertThat(createdViewModel).isEqualTo(vmToBeReturned)

WeakMapInjectorRegistry.staticCacheMap.clear()
WeakMapInjectorRegistry.clear()
}

@Test
Expand Down
12 changes: 6 additions & 6 deletions paymentsheet/api/paymentsheet.api
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public abstract interface class com/stripe/android/paymentsheet/PaymentOptionCal
}

public final class com/stripe/android/paymentsheet/PaymentOptionsViewModel_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel_Factory;
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel_Factory;
public fun get ()Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel;
public synthetic fun get ()Ljava/lang/Object;
public static fun newInstance (Lcom/stripe/android/paymentsheet/PaymentOptionContract$Args;Lkotlin/jvm/functions/Function1;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Lcom/stripe/android/paymentsheet/repositories/CustomerRepository;Lkotlin/coroutines/CoroutineContext;Landroid/app/Application;Lcom/stripe/android/core/Logger;Ljava/lang/String;Lcom/stripe/android/ui/core/forms/resources/ResourceRepository;)Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel;
public static fun newInstance (Lcom/stripe/android/paymentsheet/PaymentOptionContract$Args;Lkotlin/jvm/functions/Function1;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Lcom/stripe/android/paymentsheet/repositories/CustomerRepository;Lkotlin/coroutines/CoroutineContext;Landroid/app/Application;Lcom/stripe/android/core/Logger;Ljava/lang/String;Lcom/stripe/android/ui/core/forms/resources/ResourceRepository;Landroidx/lifecycle/SavedStateHandle;)Lcom/stripe/android/paymentsheet/PaymentOptionsViewModel;
}

public final class com/stripe/android/paymentsheet/PaymentOptionsViewModel_Factory_MembersInjector : dagger/MembersInjector {
Expand Down Expand Up @@ -309,11 +309,11 @@ public abstract interface class com/stripe/android/paymentsheet/PaymentSheetResu
}

public final class com/stripe/android/paymentsheet/PaymentSheetViewModel_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/PaymentSheetViewModel_Factory;
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/PaymentSheetViewModel_Factory;
public fun get ()Lcom/stripe/android/paymentsheet/PaymentSheetViewModel;
public synthetic fun get ()Ljava/lang/Object;
public static fun newInstance (Landroid/app/Application;Lcom/stripe/android/paymentsheet/PaymentSheetContract$Args;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Ldagger/Lazy;Lcom/stripe/android/paymentsheet/repositories/StripeIntentRepository;Lcom/stripe/android/paymentsheet/model/StripeIntentValidator;Lcom/stripe/android/paymentsheet/repositories/CustomerRepository;Lcom/stripe/android/paymentsheet/PrefsRepository;Lcom/stripe/android/ui/core/forms/resources/ResourceRepository;Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;Lcom/stripe/android/googlepaylauncher/injection/GooglePayPaymentMethodLauncherFactory;Lcom/stripe/android/core/Logger;Lkotlin/coroutines/CoroutineContext;Ljava/lang/String;)Lcom/stripe/android/paymentsheet/PaymentSheetViewModel;
public static fun newInstance (Landroid/app/Application;Lcom/stripe/android/paymentsheet/PaymentSheetContract$Args;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Ldagger/Lazy;Lcom/stripe/android/paymentsheet/repositories/StripeIntentRepository;Lcom/stripe/android/paymentsheet/model/StripeIntentValidator;Lcom/stripe/android/paymentsheet/repositories/CustomerRepository;Lcom/stripe/android/paymentsheet/PrefsRepository;Lcom/stripe/android/ui/core/forms/resources/ResourceRepository;Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;Lcom/stripe/android/googlepaylauncher/injection/GooglePayPaymentMethodLauncherFactory;Lcom/stripe/android/core/Logger;Lkotlin/coroutines/CoroutineContext;Ljava/lang/String;Landroidx/lifecycle/SavedStateHandle;)Lcom/stripe/android/paymentsheet/PaymentSheetViewModel;
}

public final class com/stripe/android/paymentsheet/PaymentSheetViewModel_Factory_MembersInjector : dagger/MembersInjector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,28 @@ import androidx.fragment.app.commit
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.stripe.android.model.StripeIntent
import com.stripe.android.core.injection.InjectorKey
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.model.StripeIntent
import com.stripe.android.paymentsheet.databinding.FragmentPaymentsheetAddPaymentMethodBinding
import com.stripe.android.paymentsheet.forms.FormFieldValues
import com.stripe.android.ui.core.Amount
import com.stripe.android.paymentsheet.model.PaymentSelection
import com.stripe.android.paymentsheet.model.SupportedPaymentMethod
import com.stripe.android.paymentsheet.paymentdatacollection.CardDataCollectionFragment
import com.stripe.android.paymentsheet.paymentdatacollection.ComposeFormDataCollectionFragment
import com.stripe.android.paymentsheet.paymentdatacollection.FormFragmentArguments
import com.stripe.android.paymentsheet.paymentdatacollection.TransformToPaymentMethodCreateParams
import com.stripe.android.paymentsheet.ui.AddPaymentMethodsFragmentFactory
import com.stripe.android.paymentsheet.ui.AnimationConstants
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel
import com.stripe.android.ui.core.Amount
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch

internal abstract class BaseAddPaymentMethodFragment(
private val eventReporter: EventReporter
) : Fragment() {
internal abstract class BaseAddPaymentMethodFragment : Fragment() {
abstract val viewModelFactory: ViewModelProvider.Factory
abstract val sheetViewModel: BaseSheetViewModel<*>

protected lateinit var addPaymentMethodHeader: TextView

private lateinit var selectedPaymentMethod: SupportedPaymentMethod

override fun onCreate(savedInstanceState: Bundle?) {
// When the fragment is destroyed and recreated, the child fragment is re-instantiated
// during onCreate, so the factory must be set before calling super.
childFragmentManager.fragmentFactory = AddPaymentMethodsFragmentFactory(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have to re-create the fragment, then the viewModel will be created, but the SavedStateHandle can not be observed until after create is complete.

sheetViewModel::class.java, viewModelFactory
)
super.onCreate(savedInstanceState)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand Down Expand Up @@ -85,40 +70,54 @@ internal abstract class BaseAddPaymentMethodFragment(
)

val selectedPaymentMethodIndex = paymentMethods.indexOf(
SupportedPaymentMethod.fromCode(savedInstanceState?.getString(SELECTED_PAYMENT_METHOD))
sheetViewModel.getAddFragmentSelectedLPM()
).takeUnless { it == -1 } ?: 0

if (paymentMethods.size > 1) {
setupRecyclerView(viewBinding, paymentMethods, selectedPaymentMethodIndex)
}

if (paymentMethods.isNotEmpty()) {
replacePaymentMethodFragment(paymentMethods[selectedPaymentMethodIndex])
// If the activity is destroyed and recreated, then the fragment is already present
// and doesn't need to be replaced, only the selected payment method needs to be set
if (savedInstanceState == null) {
replacePaymentMethodFragment(paymentMethods[selectedPaymentMethodIndex])
}
}

sheetViewModel.processing.observe(viewLifecycleOwner) { isProcessing ->
(getFragment() as? ComposeFormDataCollectionFragment)?.setProcessing(isProcessing)
}

// If the activity was destroyed and recreated then we need to re-attach the fragment,
// as attach will not be called again.
childFragmentManager.fragments.forEach { fragment ->
attachComposeFragmentViewModel(fragment)
}

childFragmentManager.addFragmentOnAttachListener { _, fragment ->
(fragment as? ComposeFormDataCollectionFragment)?.let { formFragment ->
// Need to access the formViewModel so it is constructed.
val formViewModel = formFragment.formViewModel
viewLifecycleOwner.lifecycleScope.launch {
formViewModel.completeFormValues.collect { formFieldValues ->
sheetViewModel.updateSelection(
transformToPaymentSelection(
formFieldValues,
formFragment.paramKeySpec,
selectedPaymentMethod
)
attachComposeFragmentViewModel(fragment)
}

sheetViewModel.eventReporter.onShowNewPaymentOptionForm()
}

private fun attachComposeFragmentViewModel(fragment: Fragment) {
(fragment as? ComposeFormDataCollectionFragment)?.let { formFragment ->
// Need to access the formViewModel so it is constructed.
val formViewModel = formFragment.formViewModel
viewLifecycleOwner.lifecycleScope.launch {
formViewModel.completeFormValues.collect { formFieldValues ->
sheetViewModel.updateSelection(
transformToPaymentSelection(
formFieldValues,
formFragment.paramKeySpec,
sheetViewModel.getAddFragmentSelectedLPM()
)
}
)
}
}
}

eventReporter.onShowNewPaymentOptionForm()
}

private fun setupRecyclerView(
Expand Down Expand Up @@ -168,13 +167,8 @@ internal abstract class BaseAddPaymentMethodFragment(
replacePaymentMethodFragment(paymentMethod)
}

override fun onSaveInstanceState(outState: Bundle) {
outState.putString(SELECTED_PAYMENT_METHOD, selectedPaymentMethod.type.code)
super.onSaveInstanceState(outState)
}

private fun replacePaymentMethodFragment(paymentMethod: SupportedPaymentMethod) {
selectedPaymentMethod = paymentMethod
sheetViewModel.setAddFragmentSelectedLPM(paymentMethod)

val args = requireArguments()
args.putParcelable(
Expand Down Expand Up @@ -208,12 +202,15 @@ internal abstract class BaseAddPaymentMethodFragment(
childFragmentManager.findFragmentById(R.id.payment_method_fragment_container)

companion object {
private const val SELECTED_PAYMENT_METHOD = "selected_pm"

private fun fragmentForPaymentMethod(paymentMethod: SupportedPaymentMethod) =
when (paymentMethod) {
SupportedPaymentMethod.Card -> CardDataCollectionFragment::class.java
else -> ComposeFormDataCollectionFragment::class.java
SupportedPaymentMethod.Card -> {
CardDataCollectionFragment::class.java
}
else -> {
ComposeFormDataCollectionFragment::class.java
}
}

private val transformToPaymentMethodCreateParams = TransformToPaymentMethodCreateParams()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.databinding.FragmentPaymentsheetPaymentMethodsListBinding
import com.stripe.android.paymentsheet.model.FragmentConfig
import com.stripe.android.paymentsheet.model.PaymentSelection
Expand All @@ -18,8 +17,7 @@ import com.stripe.android.paymentsheet.ui.BaseSheetActivity
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel

internal abstract class BasePaymentMethodsListFragment(
private val canClickSelectedItem: Boolean,
private val eventReporter: EventReporter
private val canClickSelectedItem: Boolean
) : Fragment(
R.layout.fragment_paymentsheet_payment_methods_list
) {
Expand Down Expand Up @@ -53,7 +51,7 @@ internal abstract class BasePaymentMethodsListFragment(
this.config = nullableConfig

setHasOptionsMenu(!sheetViewModel.paymentMethods.value.isNullOrEmpty())
eventReporter.onShowExistingPaymentOptions()
sheetViewModel.eventReporter.onShowExistingPaymentOptions()
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ internal class PaymentOptionsActivity : BaseSheetActivity<PaymentOptionResult>()
internal var viewModelFactory: ViewModelProvider.Factory =
PaymentOptionsViewModel.Factory(
{ application },
{ requireNotNull(starterArgs) }
{ requireNotNull(starterArgs) },
this,
intent?.extras
)

override val viewModel: PaymentOptionsViewModel by viewModels { viewModelFactory }
Expand Down Expand Up @@ -78,13 +80,13 @@ internal class PaymentOptionsActivity : BaseSheetActivity<PaymentOptionResult>()
setupContinueButton(viewBinding.continueButton)

viewModel.transition.observe(this) { event ->
val transitionTarget = event.getContentIfNotHandled()
if (transitionTarget != null) {
event?.getContentIfNotHandled()?.let { transitionTarget ->
onTransitionTarget(
transitionTarget,
bundleOf(
EXTRA_STARTER_ARGS to starterArgs,
EXTRA_FRAGMENT_CONFIG to transitionTarget.fragmentConfig
PaymentSheetActivity.EXTRA_STARTER_ARGS to starterArgs,
PaymentSheetActivity.EXTRA_FRAGMENT_CONFIG to
transitionTarget.fragmentConfig
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.stripe.android.paymentsheet

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.ViewModelProvider
import com.stripe.android.paymentsheet.analytics.EventReporter

internal class PaymentOptionsAddPaymentMethodFragment(
eventReporter: EventReporter
) : BaseAddPaymentMethodFragment(eventReporter) {
internal class PaymentOptionsAddPaymentMethodFragment : BaseAddPaymentMethodFragment() {
override val viewModelFactory: ViewModelProvider.Factory = PaymentOptionsViewModel.Factory(
{ requireActivity().application },
{
requireNotNull(
requireArguments().getParcelable(PaymentOptionsActivity.EXTRA_STARTER_ARGS)
)
}
},
(activity as? AppCompatActivity) ?: this
)

override val sheetViewModel by activityViewModels<PaymentOptionsViewModel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ package com.stripe.android.paymentsheet

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.fragment.app.activityViewModels
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.databinding.FragmentPaymentsheetPaymentMethodsListBinding
import com.stripe.android.paymentsheet.model.PaymentSelection

internal class PaymentOptionsListFragment(
eventReporter: EventReporter
) : BasePaymentMethodsListFragment(
canClickSelectedItem = true,
eventReporter
internal class PaymentOptionsListFragment() : BasePaymentMethodsListFragment(
canClickSelectedItem = true
) {
private val activityViewModel by activityViewModels<PaymentOptionsViewModel> {
PaymentOptionsViewModel.Factory(
Expand All @@ -21,7 +18,8 @@ internal class PaymentOptionsListFragment(
requireNotNull(
requireArguments().getParcelable(PaymentOptionsActivity.EXTRA_STARTER_ARGS)
)
}
},
(activity as? AppCompatActivity) ?: this
)
}

Expand Down
Loading