From 8f2d55c1466ec5a029a157c80aacb29271a87b92 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:39:11 -0400 Subject: [PATCH] [PM-14346] Run alias generation on the IO dispatcher (#4215) --- .../tools/generator/repository/GeneratorRepositoryImpl.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/tools/generator/repository/GeneratorRepositoryImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/tools/generator/repository/GeneratorRepositoryImpl.kt index f9497afa0..4a1cbf1cf 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/tools/generator/repository/GeneratorRepositoryImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/tools/generator/repository/GeneratorRepositoryImpl.kt @@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import java.time.Clock import javax.inject.Singleton @@ -190,7 +191,7 @@ class GeneratorRepositoryImpl( override suspend fun generateForwardedServiceUsername( forwardedServiceGeneratorRequest: UsernameGeneratorRequest.Forwarded, - ): GeneratedForwardedServiceUsernameResult = + ): GeneratedForwardedServiceUsernameResult = withContext(scope.coroutineContext) { generatorSdkSource.generateForwardedServiceEmail(forwardedServiceGeneratorRequest) .fold( onSuccess = { generatedEmail -> @@ -200,6 +201,7 @@ class GeneratorRepositoryImpl( GeneratedForwardedServiceUsernameResult.InvalidRequest(it.message) }, ) + } override fun getPasscodeGenerationOptions(): PasscodeGenerationOptions? { val userId = authDiskSource.userState?.activeUserId