mirror of
https://github.com/bitwarden/mobile
synced 2026-01-08 11:33:31 +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:
committed by
GitHub
parent
144fc7c727
commit
74085689d3
@@ -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);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Bit.iOS.Autofill
|
||||
private IAccountsManager _accountsManager;
|
||||
|
||||
private readonly LazyResolve<IStateService> _stateService = new LazyResolve<IStateService>();
|
||||
private readonly LazyResolve<IConditionedAwaiterManager> _conditionedAwaiterManager = new LazyResolve<IConditionedAwaiterManager>();
|
||||
|
||||
public CredentialProviderViewController(IntPtr handle)
|
||||
: base(handle)
|
||||
@@ -56,6 +57,8 @@ namespace Bit.iOS.Autofill
|
||||
{
|
||||
ExtContext = ExtensionContext
|
||||
};
|
||||
|
||||
_conditionedAwaiterManager.Value.Recreate(AwaiterPrecondition.AutofillIOSExtensionViewDidAppear);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -63,6 +66,13 @@ namespace Bit.iOS.Autofill
|
||||
}
|
||||
}
|
||||
|
||||
public override void ViewDidAppear(bool animated)
|
||||
{
|
||||
base.ViewDidAppear(animated);
|
||||
|
||||
_conditionedAwaiterManager.Value.SetAsCompleted(AwaiterPrecondition.AutofillIOSExtensionViewDidAppear);
|
||||
}
|
||||
|
||||
public override async void PrepareCredentialList(ASCredentialServiceIdentifier[] serviceIdentifiers)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user