diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/ActivityRetainedScope.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/ActivityRetainedScope.kt index 3e50e6eefd0..7d6aab7de7a 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/ActivityRetainedScope.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/ActivityRetainedScope.kt @@ -1,4 +1,12 @@ package com.stripe.android.financialconnections.di -class ActivityRetainedScope { -} \ No newline at end of file +import javax.inject.Scope + +/** + * Scope annotation for bindings that should exist for the life of an activity, surviving configuration. + * + * Note: Dependencies scoped to this won't be shared across activities. + */ +@Scope +@Retention(AnnotationRetention.RUNTIME) +annotation class ActivityRetainedScope 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 893ac0fce29..a4272995332 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 @@ -2,23 +2,18 @@ package com.stripe.android.financialconnections.di import android.app.Application import androidx.lifecycle.SavedStateHandle -import com.stripe.android.core.injection.CoreCommonModule -import com.stripe.android.core.injection.CoroutineContextModule import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.FinancialConnectionsSheetState import com.stripe.android.financialconnections.FinancialConnectionsSheetViewModel import dagger.BindsInstance import dagger.Component -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope @Component( dependencies = [FinancialConnectionsSingletonSharedComponent::class], modules = [ FinancialConnectionsSheetModule::class, FinancialConnectionsSheetSharedModule::class, - CoroutineContextModule::class, - CoreCommonModule::class ] ) internal interface FinancialConnectionsSheetComponent { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetConfigurationModule.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetConfigurationModule.kt index 2b4cff15413..34734fc87a2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetConfigurationModule.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetConfigurationModule.kt @@ -9,39 +9,38 @@ import com.stripe.android.financialconnections.FinancialConnectionsSheet import dagger.Module import dagger.Provides import javax.inject.Named -import javax.inject.Singleton @Module internal object FinancialConnectionsSheetConfigurationModule { @Provides @Named(PUBLISHABLE_KEY) - @Singleton + @ActivityRetainedScope fun providesPublishableKey( configuration: FinancialConnectionsSheet.Configuration ): String = configuration.publishableKey @Provides @Named(STRIPE_ACCOUNT_ID) - @Singleton + @ActivityRetainedScope fun providesStripeAccountId( configuration: FinancialConnectionsSheet.Configuration ): String? = configuration.stripeAccountId @Provides @Named(ENABLE_LOGGING) - @Singleton + @ActivityRetainedScope fun providesEnableLogging(): Boolean = BuildConfig.DEBUG @Provides - @Singleton + @ActivityRetainedScope @Named(APPLICATION_ID) fun providesApplicationId( application: Application ): String = application.packageName @Provides - @Singleton + @ActivityRetainedScope fun providesApiVersion(): ApiVersion = ApiVersion( betas = setOf("financial_connections_client_api_beta=v1") ) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetModule.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetModule.kt index 73609dc21d2..909b4268ded 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetModule.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetModule.kt @@ -8,12 +8,11 @@ import com.stripe.android.financialconnections.repository.api.ProvideApiRequestO import dagger.Module import dagger.Provides import java.util.Locale -import javax.inject.Singleton @Module internal object FinancialConnectionsSheetModule { - @Singleton + @ActivityRetainedScope @Provides internal fun providesProvideApiRequestOptions( apiRequestOptions: ApiRequest.Options, @@ -22,7 +21,7 @@ internal object FinancialConnectionsSheetModule { return ProvideApiRequestOptions { apiRequestOptions } } - @Singleton + @ActivityRetainedScope @Provides fun providesFinancialConnectionsManifestRepository( requestExecutor: FinancialConnectionsRequestExecutor, 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 471ba074527..400bd490684 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 @@ -2,8 +2,6 @@ package com.stripe.android.financialconnections.di import android.app.Application import androidx.lifecycle.SavedStateHandle -import com.stripe.android.core.injection.CoreCommonModule -import com.stripe.android.core.injection.CoroutineContextModule import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.features.accountpicker.AccountPickerViewModel import com.stripe.android.financialconnections.features.accountupdate.AccountUpdateRequiredViewModel @@ -32,16 +30,13 @@ import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativ import dagger.BindsInstance import dagger.Component import javax.inject.Named -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope @Component( dependencies = [FinancialConnectionsSingletonSharedComponent::class], modules = [ FinancialConnectionsSheetNativeModule::class, - FinancialConnectionsSheetSharedModule::class, - CoreCommonModule::class, - CoroutineContextModule::class + FinancialConnectionsSheetSharedModule::class ] ) internal interface FinancialConnectionsSheetNativeComponent { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt index ce2ef47fbc4..dc254b77f44 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt @@ -43,7 +43,6 @@ import dagger.Provides import java.util.Locale import javax.inject.Named import javax.inject.Provider -import javax.inject.Singleton @Module internal interface FinancialConnectionsSheetNativeModule { @@ -51,7 +50,7 @@ internal interface FinancialConnectionsSheetNativeModule { @Binds fun bindsPresentNoticeSheet(impl: RealPresentSheet): PresentSheet - @Singleton + @ActivityRetainedScope @Binds fun bindsNavigationManager( impl: NavigationManagerImpl @@ -63,7 +62,7 @@ internal interface FinancialConnectionsSheetNativeModule { ): HandleError @Binds - @Singleton + @ActivityRetainedScope fun bindsProvideApiRequestOptions(impl: RealProvideApiRequestOptions): ProvideApiRequestOptions @Binds @@ -78,7 +77,7 @@ internal interface FinancialConnectionsSheetNativeModule { companion object { @Provides - @Singleton + @ActivityRetainedScope fun provideConsumersApiService( apiVersion: ApiVersion, stripeNetworkClient: StripeNetworkClient, @@ -89,7 +88,7 @@ internal interface FinancialConnectionsSheetNativeModule { stripeNetworkClient = stripeNetworkClient ) - @Singleton + @ActivityRetainedScope @Provides fun providesImageLoader( context: Application @@ -98,7 +97,7 @@ internal interface FinancialConnectionsSheetNativeModule { diskCache = null, ) - @Singleton + @ActivityRetainedScope @Provides fun providesFinancialConnectionsManifestRepository( requestExecutor: FinancialConnectionsRequestExecutor, @@ -116,7 +115,7 @@ internal interface FinancialConnectionsSheetNativeModule { initialSync = initialSynchronizeSessionResponse ) - @Singleton + @ActivityRetainedScope @Provides fun providesFinancialConnectionsConsumerSessionRepository( consumersApiService: ConsumersApiService, @@ -140,7 +139,7 @@ internal interface FinancialConnectionsSheetNativeModule { elementsSessionContext = elementsSessionContext, ) - @Singleton + @ActivityRetainedScope @Provides fun providesFinancialConnectionsAccountsRepository( requestExecutor: FinancialConnectionsRequestExecutor, @@ -156,7 +155,7 @@ internal interface FinancialConnectionsSheetNativeModule { savedStateHandle = savedStateHandle, ) - @Singleton + @ActivityRetainedScope @Provides fun providesFinancialConnectionsInstitutionsRepository( requestExecutor: FinancialConnectionsRequestExecutor, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetSharedModule.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetSharedModule.kt index 73ae5e32d74..27ac5771936 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetSharedModule.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetSharedModule.kt @@ -1,11 +1,14 @@ package com.stripe.android.financialconnections.di import android.app.Application +import androidx.core.os.LocaleListCompat import com.stripe.android.core.ApiVersion import com.stripe.android.core.Logger import com.stripe.android.core.frauddetection.FraudDetectionDataRepository +import com.stripe.android.core.injection.ENABLE_LOGGING import com.stripe.android.core.injection.IOContext import com.stripe.android.core.injection.STRIPE_ACCOUNT_ID +import com.stripe.android.core.injection.UIContext import com.stripe.android.core.networking.AnalyticsRequestExecutor import com.stripe.android.core.networking.AnalyticsRequestFactory import com.stripe.android.core.networking.AnalyticsRequestV2Executor @@ -43,7 +46,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.serialization.json.Json import java.util.Locale import javax.inject.Named -import javax.inject.Singleton import kotlin.coroutines.CoroutineContext /** @@ -66,19 +68,19 @@ import kotlin.coroutines.CoroutineContext internal interface FinancialConnectionsSheetSharedModule { @Binds - @Singleton + @ActivityRetainedScope fun bindsAnalyticsRequestV2Storage(impl: RealAnalyticsRequestV2Storage): AnalyticsRequestV2Storage @Binds - @Singleton + @ActivityRetainedScope fun bindsAnalyticsRequestV2Executor(impl: DefaultAnalyticsRequestV2Executor): AnalyticsRequestV2Executor @Binds - @Singleton + @ActivityRetainedScope fun bindsConsumerSessionRepository(impl: RealConsumerSessionRepository): ConsumerSessionRepository @Binds - @Singleton + @ActivityRetainedScope fun bindsConsumerSessionProvider(impl: RealConsumerSessionRepository): ConsumerSessionProvider @Binds @@ -87,7 +89,27 @@ internal interface FinancialConnectionsSheetSharedModule { companion object { @Provides - @Singleton + @ActivityRetainedScope + @IOContext + fun provideWorkContext(): CoroutineContext = Dispatchers.IO + + @Provides + @ActivityRetainedScope + @UIContext + fun provideUIContext(): CoroutineContext = Dispatchers.Main + + @Provides + @ActivityRetainedScope + internal fun provideLogger(@Named(ENABLE_LOGGING) enableLogging: Boolean) = + Logger.getInstance(enableLogging) + + @Provides + @ActivityRetainedScope + internal fun provideLocale() = + LocaleListCompat.getAdjustedDefault().takeUnless { it.isEmpty }?.get(0) + + @Provides + @ActivityRetainedScope internal fun providesApiOptions( @Named(PUBLISHABLE_KEY) publishableKey: String, @Named(STRIPE_ACCOUNT_ID) stripeAccountId: String? @@ -97,7 +119,7 @@ internal interface FinancialConnectionsSheetSharedModule { ) @Provides - @Singleton + @ActivityRetainedScope internal fun providesJson(): Json = Json { coerceInputValues = true ignoreUnknownKeys = true @@ -106,7 +128,7 @@ internal interface FinancialConnectionsSheetSharedModule { } @Provides - @Singleton + @ActivityRetainedScope fun provideStripeNetworkClient( @IOContext context: CoroutineContext, logger: Logger @@ -115,8 +137,8 @@ internal interface FinancialConnectionsSheetSharedModule { logger = logger ) - @Singleton @Provides + @ActivityRetainedScope fun providesAnalyticsTracker( context: Application, getOrFetchSync: GetOrFetchSync, @@ -132,7 +154,7 @@ internal interface FinancialConnectionsSheetSharedModule { ) @Provides - @Singleton + @ActivityRetainedScope fun providesApiRequestFactory( apiVersion: ApiVersion ): ApiRequest.Factory = ApiRequest.Factory( @@ -140,25 +162,25 @@ internal interface FinancialConnectionsSheetSharedModule { ) @Provides - @Singleton + @ActivityRetainedScope fun provideConnectionsRepository( repository: FinancialConnectionsRepositoryImpl ): FinancialConnectionsRepository = repository @Provides - @Singleton + @ActivityRetainedScope fun provideEventReporter( defaultFinancialConnectionsEventReporter: DefaultFinancialConnectionsEventReporter ): FinancialConnectionsEventReporter = defaultFinancialConnectionsEventReporter @Provides - @Singleton + @ActivityRetainedScope internal fun providesAnalyticsRequestExecutor( executor: DefaultAnalyticsRequestExecutor ): AnalyticsRequestExecutor = executor @Provides - @Singleton + @ActivityRetainedScope internal fun provideAnalyticsRequestFactory( application: Application, @Named(PUBLISHABLE_KEY) publishableKey: String @@ -171,7 +193,7 @@ internal interface FinancialConnectionsSheetSharedModule { ) @Provides - @Singleton + @ActivityRetainedScope internal fun providesIsWorkManagerAvailable( getOrFetchSync: GetOrFetchSync, ): IsWorkManagerAvailable { @@ -181,7 +203,7 @@ internal interface FinancialConnectionsSheetSharedModule { } @Provides - @Singleton + @ActivityRetainedScope internal fun providesIoDispatcher(): CoroutineDispatcher { return Dispatchers.IO } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt index c7901b34994..0a151dd3d75 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSingletonSharedComponentHolder.kt @@ -10,6 +10,7 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides +import javax.inject.Singleton /** * A singleton holder for the [FinancialConnectionsSingletonSharedComponent], ensuring it is initialized only once and @@ -33,6 +34,7 @@ internal object FinancialConnectionsSingletonSharedComponentHolder { } } +@Singleton @Component(modules = [FinancialConnectionsSingletonSharedModule::class]) internal interface FinancialConnectionsSingletonSharedComponent { @@ -47,10 +49,11 @@ internal interface FinancialConnectionsSingletonSharedComponent { } } -@Module() +@Module internal class FinancialConnectionsSingletonSharedModule { @Provides + @Singleton fun providesIntegrityStandardRequestManager( context: Application ): IntegrityRequestManager = IntegrityStandardRequestManager( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/NativeAuthFlowCoordinator.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/NativeAuthFlowCoordinator.kt index e5f57817104..76323c02782 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/NativeAuthFlowCoordinator.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/NativeAuthFlowCoordinator.kt @@ -1,9 +1,9 @@ package com.stripe.android.financialconnections.domain +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate import kotlinx.coroutines.flow.MutableSharedFlow import javax.inject.Inject -import javax.inject.Singleton /** * The AuthFlow state is centralized in the parent viewModel. @@ -12,7 +12,7 @@ import javax.inject.Singleton * [com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeViewModel] * */ -@Singleton +@ActivityRetainedScope internal class NativeAuthFlowCoordinator @Inject constructor() { private val flow = MutableSharedFlow() diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt index 8cfcec85202..6467d10bf47 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt @@ -34,6 +34,7 @@ import com.stripe.android.financialconnections.utils.Experiment.CONNECTIONS_CONS import com.stripe.android.financialconnections.utils.error import com.stripe.android.financialconnections.utils.experimentAssignment import com.stripe.android.financialconnections.utils.trackExposure +import com.stripe.attestation.IntegrityRequestManager import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -44,6 +45,7 @@ internal class ConsentViewModel @AssistedInject constructor( @Assisted initialState: ConsentState, nativeAuthFlowCoordinator: NativeAuthFlowCoordinator, private val acceptConsent: AcceptConsent, + private val integrityRequestManager: IntegrityRequestManager, private val getOrFetchSync: GetOrFetchSync, private val navigationManager: NavigationManager, private val eventTracker: FinancialConnectionsAnalyticsTracker, @@ -53,6 +55,11 @@ internal class ConsentViewModel @AssistedInject constructor( ) : FinancialConnectionsViewModel(initialState, nativeAuthFlowCoordinator) { init { + viewModelScope.launch { + integrityRequestManager.requestToken() + .onSuccess { logger.debug("Integrity token: $it") } + .onFailure { logger.error("Failed to get integrity token", it) } + } logErrors() suspend { val sync = getOrFetchSync() 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 43a12c99267..09d5023a004 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 @@ -26,6 +26,7 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.di.APPLICATION_ID +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.di.FinancialConnectionsSingletonSharedComponentHolder @@ -74,9 +75,8 @@ import kotlinx.coroutines.sync.withLock import kotlinx.parcelize.Parcelize import javax.inject.Inject import javax.inject.Named -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( /** * Exposes parent dagger component (activity viewModel scoped so that it survives config changes) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AccountUpdateRequiredContentRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AccountUpdateRequiredContentRepository.kt index cc27527aaf5..52c84474684 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AccountUpdateRequiredContentRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AccountUpdateRequiredContentRepository.kt @@ -2,13 +2,13 @@ package com.stripe.android.financialconnections.repository import android.os.Parcelable import androidx.lifecycle.SavedStateHandle +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.features.notice.NoticeSheetState.NoticeSheetContent.UpdateRequired import com.stripe.android.financialconnections.repository.AccountUpdateRequiredContentRepository.State import kotlinx.parcelize.Parcelize import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope internal class AccountUpdateRequiredContentRepository @Inject constructor( savedStateHandle: SavedStateHandle, ) : PersistingRepository( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AttachedPaymentAccountRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AttachedPaymentAccountRepository.kt index eb7aad7319c..01119a4b083 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AttachedPaymentAccountRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/AttachedPaymentAccountRepository.kt @@ -3,15 +3,15 @@ package com.stripe.android.financialconnections.repository import android.os.Parcelable import androidx.lifecycle.SavedStateHandle import com.stripe.android.core.Logger +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.model.PaymentAccountParams import kotlinx.parcelize.Parcelize import javax.inject.Inject -import javax.inject.Singleton /** * Repository for attached payment accounts. */ -@Singleton +@ActivityRetainedScope internal class AttachedPaymentAccountRepository @Inject constructor( savedStateHandle: SavedStateHandle, private val logger: Logger, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt index 3c1425cf050..da86c3ed69f 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt @@ -2,12 +2,12 @@ package com.stripe.android.financialconnections.repository import android.os.Parcelable import androidx.lifecycle.SavedStateHandle +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.repository.FinancialConnectionsErrorRepository.State import kotlinx.parcelize.Parcelize import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope internal class FinancialConnectionsErrorRepository @Inject constructor( savedStateHandle: SavedStateHandle, ) : PersistingRepository( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/NoticeSheetContentRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/NoticeSheetContentRepository.kt index 0370b7b8a8a..2df54fc50b5 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/NoticeSheetContentRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/NoticeSheetContentRepository.kt @@ -2,13 +2,13 @@ package com.stripe.android.financialconnections.repository import android.os.Parcelable import androidx.lifecycle.SavedStateHandle +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.features.notice.NoticeSheetState.NoticeSheetContent import com.stripe.android.financialconnections.repository.NoticeSheetContentRepository.State import kotlinx.parcelize.Parcelize import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope internal class NoticeSheetContentRepository @Inject constructor( savedStateHandle: SavedStateHandle, ) : PersistingRepository( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt index 9fb52309dc2..e5796482b9c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt @@ -2,13 +2,13 @@ package com.stripe.android.financialconnections.repository import android.os.Parcelable import androidx.lifecycle.SavedStateHandle +import com.stripe.android.financialconnections.di.ActivityRetainedScope import com.stripe.android.financialconnections.repository.SuccessContentRepository.State import com.stripe.android.financialconnections.ui.TextResource import kotlinx.parcelize.Parcelize import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@ActivityRetainedScope internal class SuccessContentRepository @Inject constructor( savedStateHandle: SavedStateHandle, ) : PersistingRepository( diff --git a/stripe-attestation/src/main/java/com/stripe/attestation/IntegrityStandardRequestManager.kt b/stripe-attestation/src/main/java/com/stripe/attestation/IntegrityStandardRequestManager.kt index 415eb4b8952..2d7cd5b8ae0 100644 --- a/stripe-attestation/src/main/java/com/stripe/attestation/IntegrityStandardRequestManager.kt +++ b/stripe-attestation/src/main/java/com/stripe/attestation/IntegrityStandardRequestManager.kt @@ -40,6 +40,10 @@ class IntegrityStandardRequestManager( private var integrityTokenProvider: StandardIntegrityTokenProvider? = null override suspend fun prepare(): Result = runCatching { + if (integrityTokenProvider != null) { + return Result.success(Unit) + } + val finishedTask: Task = standardIntegrityManager .prepareIntegrityToken( PrepareIntegrityTokenRequest.builder()