From dae2c6920b40509253ff0db88e9c88a80a829b2a Mon Sep 17 00:00:00 2001 From: Carlos Munoz Date: Mon, 23 Dec 2024 11:40:24 +0100 Subject: [PATCH] Renames components. --- .../FinancialConnectionsSheetViewModel.kt | 4 +-- .../di/FinancialConnectionsSheetComponent.kt | 4 +-- ...inancialConnectionsSheetNativeComponent.kt | 4 +-- ...nectionsSingletonSharedComponentHolder.kt} | 26 +++++++++---------- ...inancialConnectionsSheetNativeViewModel.kt | 4 +-- 5 files changed, 21 insertions(+), 21 deletions(-) rename financial-connections/src/main/java/com/stripe/android/financialconnections/di/{SharedComponentHolder.kt => FinancialConnectionsSingletonSharedComponentHolder.kt} (56%) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt index 73be3b93ad5..071b07291e1 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt @@ -31,7 +31,7 @@ import com.stripe.android.financialconnections.analytics.logError import com.stripe.android.financialconnections.browser.BrowserManager import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetComponent -import com.stripe.android.financialconnections.di.SharedComponentHolder +import com.stripe.android.financialconnections.di.FinancialConnectionsSingletonSharedComponentHolder import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSession import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSessionForToken import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -548,7 +548,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( .builder() .application(app) .savedStateHandle(savedStateHandle) - .sharedComponent(SharedComponentHolder.getComponent(app)) + .sharedComponent(FinancialConnectionsSingletonSharedComponentHolder.getComponent(app)) .initialState(state) .configuration(state.initialArgs.configuration) .build().viewModel diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt index fbb5f706a5d..893ac0fce29 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt @@ -13,7 +13,7 @@ import javax.inject.Singleton @Singleton @Component( - dependencies = [SharedComponent::class], + dependencies = [FinancialConnectionsSingletonSharedComponent::class], modules = [ FinancialConnectionsSheetModule::class, FinancialConnectionsSheetSharedModule::class, @@ -38,7 +38,7 @@ internal interface FinancialConnectionsSheetComponent { @BindsInstance fun configuration(configuration: FinancialConnectionsSheet.Configuration): Builder - fun sharedComponent(component: SharedComponent): Builder + fun sharedComponent(component: FinancialConnectionsSingletonSharedComponent): Builder fun build(): FinancialConnectionsSheetComponent } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt index 63fd073faab..471ba074527 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt @@ -36,7 +36,7 @@ import javax.inject.Singleton @Singleton @Component( - dependencies = [SharedComponent::class], + dependencies = [FinancialConnectionsSingletonSharedComponent::class], modules = [ FinancialConnectionsSheetNativeModule::class, FinancialConnectionsSheetSharedModule::class, @@ -92,7 +92,7 @@ internal interface FinancialConnectionsSheetNativeComponent { @BindsInstance fun configuration(configuration: FinancialConnectionsSheet.Configuration): Builder - fun sharedComponent(component: SharedComponent): Builder + fun sharedComponent(component: FinancialConnectionsSingletonSharedComponent): Builder fun build(): FinancialConnectionsSheetNativeComponent } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/SharedComponentHolder.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt similarity index 56% rename from financial-connections/src/main/java/com/stripe/android/financialconnections/di/SharedComponentHolder.kt rename to financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt index 58aef1a2888..b4718808694 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/SharedComponentHolder.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt @@ -12,29 +12,29 @@ import dagger.Module import dagger.Provides /** - * A singleton holder for the [SharedComponent], ensuring it is initialized only once and + * A singleton holder for the [FinancialConnectionsSingletonSharedComponent], ensuring it is initialized only once and * shared across activities. */ -internal object SharedComponentHolder { +internal object FinancialConnectionsSingletonSharedComponentHolder { @Volatile - private var sharedComponent: SharedComponent? = null + private var component: FinancialConnectionsSingletonSharedComponent? = null - fun getComponent(application: Application): SharedComponent { - return sharedComponent ?: synchronized(this) { - sharedComponent ?: buildComponent(application).also { sharedComponent = it } + fun getComponent(application: Application): FinancialConnectionsSingletonSharedComponent { + return component ?: synchronized(this) { + component ?: buildComponent(application).also { component = it } } } - private fun buildComponent(application: Application): SharedComponent { + private fun buildComponent(application: Application): FinancialConnectionsSingletonSharedComponent { return DaggerSharedComponent.builder() .application(application) .build() } } -@Component(modules = [SharedModule::class]) -internal interface SharedComponent { +@Component(modules = [FinancialConnectionsSingletonSharedModule::class]) +internal interface FinancialConnectionsSingletonSharedComponent { fun providesIntegrityRequestManager(): IntegrityRequestManager @@ -43,19 +43,19 @@ internal interface SharedComponent { @BindsInstance fun application(app: Application): Builder - fun build(): SharedComponent + fun build(): FinancialConnectionsSingletonSharedComponent } } @Module() -internal class SharedModule { +internal class FinancialConnectionsSingletonSharedModule { @Provides fun providesIntegrityStandardRequestManager( - context: Application, + context: Application ): IntegrityRequestManager = IntegrityStandardRequestManager( cloudProjectNumber = 527113280969, // stripe-financial-connections - logError = { message, error -> Logger.getInstance(BuildConfig.DEBUG) }, + logError = { message, error -> Logger.getInstance(BuildConfig.DEBUG).error(message, error) }, factory = RealStandardIntegrityManagerFactory(context) ) } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt index 21fd6dd7538..43a12c99267 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt @@ -28,7 +28,7 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsEve import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent -import com.stripe.android.financialconnections.di.SharedComponentHolder +import com.stripe.android.financialconnections.di.FinancialConnectionsSingletonSharedComponentHolder import com.stripe.android.financialconnections.domain.CompleteFinancialConnectionsSession import com.stripe.android.financialconnections.domain.CreateInstantDebitsResult import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -494,7 +494,7 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( .initialSyncResponse(args.initialSyncResponse.takeIf { state.firstInit }) .application(app) .configuration(state.configuration) - .sharedComponent(SharedComponentHolder.getComponent(app)) + .sharedComponent(FinancialConnectionsSingletonSharedComponentHolder.getComponent(app)) .savedStateHandle(savedStateHandle) .initialState(state) .build()