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

Improvements to AutofillSettingStatus to remove unnecessary LAContext() calls #3606

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

amddg44
Copy link
Contributor

@amddg44 amddg44 commented Nov 21, 2024

Task/Issue URL: https://app.asana.com/0/1201462886803403/1208801010014864/f
Tech Design URL:
CC:

Description:
AutofillSettingStatus refactored to cache a users device authentication status (i.e. do they have a passcode set on their device which is a requirement for the autofill feature) while the app is in foreground instead of constantly querying every time a check is required.

  • This should greatly reduce the number of times LAcontext().canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) is called which is currently the source of a steady number of ongoing crashes.
  • I’ve also explicitly set the LAcontext() call to run on main which should prevent future crashes.
    While testing I also discovered that the incorrect UI state was being presented on the Passwords screen for users who do not have any device security enabled, which I’ve fixed here also

Steps to test this PR:

  1. Testing on device which has (at a minimum) a passcode set
  2. Ensure there are some passwords saved and that Save and autofill passwords enabled
  3. In AutofillSettingStatus set a breakpoint at line 48 result = LAContext().canEvaluatePolicy(.deviceOwnerAuthentication, error: &error)
  4. Launch the app and load a webpage. Confirm the breakpoint only hits once
  5. Visit [fill.dev](https://fill.dev/form/login-simple), enter new credentials and save them when prompted
  6. Minimise the app, go to system Settings and disable the passcode on the device
  7. Reload the tab and go back to the fill.dev login screen. Confirm the breakpoint hits again (but just once)
  8. Confirm that you are not prompted to fill the login that was saved in step 5 and that there is no key icon in the login fields
  9. Go to the Passwords screen and confirm you are presented with a screen stating that a passcode is required (and no passwords are visible)
  10. Re-enable a passcode on your device and return to the app
  11. Reload the fill.dev login webpage and confirm that autofill prompts are back

<!—
Before submitting a PR, please ensure you have tested the combinations you expect the reviewer to test, then delete configurations you know do not need explicit testing.

Using a simulator where a physical device is unavailable is acceptable.
—>

Definition of Done (Internal Only):

Copy Testing:

  • Use of correct apostrophes in new copy, ie rather than

Orientation Testing:

  • Portrait
  • Landscape

Device Testing:

  • iPhone SE (1st Gen)
  • iPhone 8
  • iPhone X
  • iPhone 14 Pro
  • iPad

OS Testing:

  • iOS 15
  • iOS 16
  • iOS 17

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

… and that its result is cached to prevent having to repeatedly making this expensive call
@amddg44 amddg44 requested a review from graeme November 21, 2024 14:32
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.

1 participant