Uploaded image for project: 'SimplyE 2.0'
  1. SimplyE 2.0
  2. SIMPLY-2510

[iOS] Refactor duplicate account login code

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 3.6.2 (iOS)
    • iOS
    • SIMPLY 22 Oct 14 - Oct 27, SIMPLY S23 Oct 27 - Nov 10, SIMPLY S24 Nov 10 - 24, SIMPLY S25 Nov 24 - Dec 8, SIMPLY Sprint 26 Dec 8 - 22

      We currently allow login from a login popup (NYPLAccountSignInViewController) and from the settings panel (NYPLSettingsAccountDetailViewController).
      There's a lot of code duplication regarding the login sequence that should be centralized to avoid mistakes. It has increased since the SAML work was added. Some functions are duplicated almost verbatim, for example:

      • logIn
      • oauthLogIn
      • samlLogin
      • barcodeLogIn
      • handleRedirectURL:

      The credential validation logic (validateCredentials) is also probably identical, but it's hard to see because in NYPLAccountSignInViewController it's just one giant 200 lines blob of messy code, while on the Settings tab is at least broken down into smaller functions.

      Most of this code is business logic code and should be moved into the NYPLSignInBusinessLogic swift class. As a first step it might be possible to keep the ObjC code and move it into ObjC classes whose instances are owned by NYPLSignInBusinessLogic. However, rewriting the duplicated code in swift will always be best.

      We should create subtasks to do this work in small chunks, because it will be very difficult to track any functionality changes introduced involuntarily. This is a pretty much a technical requirement.

      There are also inconsistencies to be addressed. E.g. calls to beginIgnoringInteractionEvents and endIgnoringInteractionEvents are not actually balanced in all code paths. Likely because the code is so unreadable.

      Story point estimate: 8

            EttorePasquini Ettore Pasquini
            KyleSakai Kyle Sakai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: