Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify async-delegate continuations and fix autofill-to-modal data race #29

Merged
merged 13 commits into from
Jul 28, 2024

Conversation

Firehed
Copy link
Contributor

@Firehed Firehed commented Jul 27, 2024

Instead of maintaining a bunch of internal state and logic to figure out whether a registration, modal authentication, or autofill authentication is currently being processed, this collapses the logic significantly to have a single continuation that manages both modal paths. Now at the start of all public calls, reset() is triggered which should reliably reset (and clear out) all of the continuation stuff and

Autofill is a little finicky still, but upon further testing on different branches, it looks like some of the assumptions made in the initial design (with a delegate class for clients) were incorrect and it should be possible to move that to async as well. That'll be addressed separately; for the moment the existing API will continue to work,

Fixes #25

@Firehed Firehed merged commit 18f7e89 into main Jul 28, 2024
1 check passed
@Firehed Firehed deleted the unify-continuations branch July 28, 2024 18:24
Firehed added a commit that referenced this pull request Jul 28, 2024
As noted in #29, the initial design of the autofill interactions used a
delegate-based system, rather than async/await like the modal APIs. This
was based on an incorrect assumption (carried over from web, where it
may also be flawed) on how promises resolve. Upon further
experimentation, it seems perfectly fine and non-problematic to have a
promise that might take minutes to resolve and not have it block other
interactions.

This (breaking) change adjusts the autofill API to also use async/await
instead of delegates. Client code is a lot more straightforward, and the
internals become more reliable since a bunch of conditional paths are
eliminated.

In the same vein, I've also added a new `.unsupportedOnPlatform` error
code so that clients can have fewer availability checks, part of #30.
The API as a whole is still `#if`'d to iOS+visionOS, but that will get
lifted eventually in a separate PR (see #16).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data race: transition from autofill to modal authn
1 participant