mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
Fix minor optimization issues (#979)
This commit is contained in:
parent
80a024f9dd
commit
0ebddadcae
5 changed files with 8 additions and 10 deletions
|
@ -736,11 +736,11 @@ class AuthRepositoryImpl(
|
|||
.userState
|
||||
?.activeAccount
|
||||
?: return ResetPasswordResult.Error
|
||||
val currentPasswordHash = currentPassword?.let {
|
||||
val currentPasswordHash = currentPassword?.let { password ->
|
||||
authSdkSource
|
||||
.hashPassword(
|
||||
email = activeAccount.profile.email,
|
||||
password = it,
|
||||
password = password,
|
||||
kdf = activeAccount.profile.toSdkParams(),
|
||||
purpose = HashPurpose.SERVER_AUTHORIZATION,
|
||||
)
|
||||
|
|
|
@ -309,8 +309,7 @@ class EnterpriseSignOnViewModel @Inject constructor(
|
|||
showLoading()
|
||||
|
||||
viewModelScope.launch {
|
||||
val prevalidateSsoResult = authRepository.prevalidateSso(organizationIdentifier)
|
||||
when (prevalidateSsoResult) {
|
||||
when (val prevalidateSso = authRepository.prevalidateSso(organizationIdentifier)) {
|
||||
is PrevalidateSsoResult.Failure -> {
|
||||
sendAction(EnterpriseSignOnAction.Internal.OnSsoPrevalidationFailure)
|
||||
}
|
||||
|
@ -318,7 +317,7 @@ class EnterpriseSignOnViewModel @Inject constructor(
|
|||
is PrevalidateSsoResult.Success -> {
|
||||
prepareAndLaunchCustomTab(
|
||||
organizationIdentifier = organizationIdentifier,
|
||||
prevalidateSsoResult = prevalidateSsoResult,
|
||||
prevalidateSsoResult = prevalidateSso,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseViewModel<S, E, A>(
|
|||
initialState: S,
|
||||
) : ViewModel() {
|
||||
protected val mutableStateFlow: MutableStateFlow<S> = MutableStateFlow(initialState)
|
||||
protected val eventChannel: Channel<E> = Channel(capacity = Channel.UNLIMITED)
|
||||
private val eventChannel: Channel<E> = Channel(capacity = Channel.UNLIMITED)
|
||||
private val internalActionChannel: Channel<A> = Channel(capacity = Channel.UNLIMITED)
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,9 +59,9 @@ class LoginApprovalViewModel @Inject constructor(
|
|||
init {
|
||||
state
|
||||
.specialCircumstance
|
||||
?.let {
|
||||
?.let { circumstance ->
|
||||
authRepository
|
||||
.getAuthRequestByIdFlow(it.passwordlessRequestData.loginRequestId)
|
||||
.getAuthRequestByIdFlow(circumstance.passwordlessRequestData.loginRequestId)
|
||||
.map { LoginApprovalAction.Internal.AuthRequestResultReceive(it) }
|
||||
.onEach(::sendAction)
|
||||
.launchIn(viewModelScope)
|
||||
|
|
|
@ -105,10 +105,9 @@ class BlockAutoFillViewModel @Inject constructor(
|
|||
.filter { uri ->
|
||||
uri in settingsRepository.blockedAutofillUris || !uri.isValidPattern()
|
||||
}
|
||||
.mapNotNull { uri ->
|
||||
.firstNotNullOfOrNull { uri ->
|
||||
uri.validateUri(settingsRepository.blockedAutofillUris)
|
||||
}
|
||||
.firstOrNull()
|
||||
|
||||
if (errorText != null) {
|
||||
mutableStateFlow.update { currentState ->
|
||||
|
|
Loading…
Reference in a new issue