Skip to content

Commit

Permalink
Check for GetCreds request when dismissing FIDO2 dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintPatrck committed Feb 11, 2025
1 parent 17f2236 commit 6474b17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.x8bit.bitwarden.data.autofill.fido2.model

import androidx.credentials.provider.BeginGetPublicKeyCredentialOption
import com.bitwarden.fido.Fido2CredentialAutofillView
import com.x8bit.bitwarden.ui.platform.base.util.Text

/**
* Represents the result of a FIDO 2 Get Credentials request.
Expand All @@ -24,5 +25,7 @@ sealed class Fido2GetCredentialsResult {
/**
* Indicates an error was encountered when querying for matching credentials.
*/
data object Error : Fido2GetCredentialsResult()
data class Error(
val message: Text,
) : Fido2GetCredentialsResult()
}
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,16 @@ class VaultItemListingViewModel @Inject constructor(
)
}

state.fido2GetCredentialsRequest != null -> {
sendEvent(
VaultItemListingEvent.CompleteFido2GetCredentialsRequest(
result = Fido2GetCredentialsResult.Error(
message = action.message,
),
),
)
}

else -> {
Timber
.tag("PASSKEY")
Expand All @@ -894,7 +904,7 @@ class VaultItemListingViewModel @Inject constructor(
it.copy(
dialogState = VaultItemListingState.DialogState.Error(
title = R.string.an_error_has_occurred.asText(),
message = R.string.generic_error_message.asText(),
message = action.message,
),
)
}
Expand Down

0 comments on commit 6474b17

Please sign in to comment.