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

Rework autofill to also use async/await #31

Merged
merged 6 commits into from
Jul 28, 2024
Merged

Conversation

Firehed
Copy link
Contributor

@Firehed Firehed commented 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).

@Firehed Firehed merged commit cf352c5 into main Jul 28, 2024
1 check passed
@Firehed Firehed deleted the move-autofill-to-async branch July 28, 2024 19:28
Firehed added a commit that referenced this pull request Jul 28, 2024
#31 adjusted the assertion during sending errors back, and reintroduced
the data race from canceling the autofill request due to starting a
modal one (explicitly returning a failure to the continuation, clearing
it out, and canceling the authController - which went back to sendError)

This removes the assertion, since it was logically unsound, not to
mention unhelpful. I've done another bunch of manual testing in a sample
app and can no longer reproduce the issue. I'm not sure how to cover
this in automated tests to prevent another regression, but I'll file a
ticket in case someone finds a way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant