1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-16 16:23:29 +00:00

PM-6685 Fix race condition issue where the biometrics check is being done before the iOS extension is being shown. So when we need the UI, we wait until ViewDidAppear happens. (#3078)

This commit is contained in:
Federico Maccaroni
2024-03-14 18:07:52 -03:00
committed by GitHub
parent 144fc7c727
commit 74085689d3
10 changed files with 64 additions and 17 deletions

View File

@@ -270,13 +270,21 @@ namespace Bit.iOS.Autofill
userVerificationPreference,
_context.VaultUnlockedDuringThisSession,
_context.PasskeyCredentialIdentity?.RelyingPartyIdentifier,
() =>
async () =>
{
if (_context.IsExecutingWithoutUserInteraction)
{
CancelRequest(ASExtensionErrorCode.UserInteractionRequired);
throw new InvalidOperationNeedsUIException();
}
// HACK: [PM-6685] There are some devices that end up with a race condition when doing biometrics authentication
// that the check is trying to be done before the iOS extension UI is shown, which cause the bio check to fail.
// So a workaround is to show a toast which force the iOS extension UI to be shown and then awaiting for the
// precondition that the view did appear before continuing with the verification.
_platformUtilsService.Value.ShowToast(null, null, AppResources.VerifyingIdentityEllipsis);
await _conditionedAwaiterManager.Value.GetAwaiterForPrecondition(AwaiterPrecondition.AutofillIOSExtensionViewDidAppear);
})
);
}