Skip to content

Commit

Permalink
Fix embedded. (#10135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaynewstrom-stripe authored Feb 11, 2025
1 parent fc1a23f commit 8524591
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal class EmbeddedPaymentElementViewModel @Inject constructor(
override fun <T : ViewModel> create(modelClass: KClass<T>, extras: CreationExtras): T {
val component = DaggerEmbeddedPaymentElementViewModelComponent.builder()
.savedStateHandle(extras.createSavedStateHandle())
.context(extras.requireApplication())
.application(extras.requireApplication())
.statusBarColor(statusBarColor)
.build()
@Suppress("UNCHECKED_CAST")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ internal interface EmbeddedPaymentElementViewModelComponent {
@BindsInstance
fun savedStateHandle(savedStateHandle: SavedStateHandle): Builder

@BindsInstance
fun context(context: Context): Builder

@BindsInstance
fun application(application: Application): Builder

Expand Down Expand Up @@ -134,6 +131,11 @@ internal interface EmbeddedPaymentElementViewModelModule {
fun bindsEmbeddedContentHelper(helper: DefaultEmbeddedContentHelper): EmbeddedContentHelper

companion object {
@Provides
fun providesContext(application: Application): Context {
return application
}

@Provides
@Singleton
fun providesLinkAccountHolder(savedStateHandle: SavedStateHandle): LinkAccountHolder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class FormActivityViewModel @Inject constructor(
.configuration(args.configuration)
.initializationMode(args.initializationMode)
.statusBarColor(args.statusBarColor)
.context(extras.requireApplication())
.application(extras.requireApplication())
.savedStateHandle(extras.createSavedStateHandle())
.build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ internal interface FormActivityViewModelComponent {
@BindsInstance
fun initializationMode(initializationMode: PaymentElementLoader.InitializationMode): Builder

@BindsInstance
fun context(context: Context): Builder

@BindsInstance
fun application(application: Application): Builder

Expand Down Expand Up @@ -114,6 +111,11 @@ internal interface FormActivityViewModelModule {
fun bindsFormActivityStateHelper(helper: DefaultFormActivityStateHelper): FormActivityStateHelper

companion object {
@Provides
fun providesContext(application: Application): Context {
return application
}

@Provides
@Singleton
fun providesLinkAccountHolder(savedStateHandle: SavedStateHandle): LinkAccountHolder {
Expand Down

0 comments on commit 8524591

Please sign in to comment.