mirror of
https://github.com/bitwarden/android.git
synced 2024-11-29 06:18:52 +03:00
Display SDK error message when generating email alias (#1219)
This commit is contained in:
parent
22a6825992
commit
af37f1c03c
4 changed files with 13 additions and 5 deletions
|
@ -200,7 +200,7 @@ class GeneratorRepositoryImpl(
|
|||
GeneratedForwardedServiceUsernameResult.Success(generatedEmail)
|
||||
},
|
||||
onFailure = {
|
||||
GeneratedForwardedServiceUsernameResult.InvalidRequest
|
||||
GeneratedForwardedServiceUsernameResult.InvalidRequest(it.message)
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ sealed class GeneratedForwardedServiceUsernameResult {
|
|||
/**
|
||||
* There was an error during the operation.
|
||||
*/
|
||||
data object InvalidRequest : GeneratedForwardedServiceUsernameResult()
|
||||
data class InvalidRequest(val message: String?) : GeneratedForwardedServiceUsernameResult()
|
||||
}
|
||||
|
|
|
@ -651,8 +651,13 @@ class GeneratorViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
GeneratedForwardedServiceUsernameResult.InvalidRequest -> {
|
||||
sendEvent(GeneratorEvent.ShowSnackbar(R.string.an_error_has_occurred.asText()))
|
||||
is GeneratedForwardedServiceUsernameResult.InvalidRequest -> {
|
||||
sendEvent(
|
||||
GeneratorEvent.ShowSnackbar(
|
||||
message = result.message?.asText()
|
||||
?: R.string.an_error_has_occurred.asText(),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,7 +410,10 @@ class GeneratorRepositoryTest {
|
|||
|
||||
val result = repository.generateForwardedServiceUsername(request)
|
||||
|
||||
assertEquals(GeneratedForwardedServiceUsernameResult.InvalidRequest, result)
|
||||
assertEquals(
|
||||
GeneratedForwardedServiceUsernameResult.InvalidRequest(exception.message),
|
||||
result,
|
||||
)
|
||||
coVerify { generatorSdkSource.generateForwardedServiceEmail(request) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue