The HaapiUIViewController protocol

When navigating through the authentication flow, a user is presented with various screens (UIs) in which he may be required to provide some kind of input or interact with in order to move forward. The HaapiUIViewController protocol is the functional API signature for UIViewControllers that are displayed by the HaapiIdsvrUIKit framework. It provides the functionality signature when overriding the provided implementations for each of the authentication flow steps.

The following bundled UIViewControllers implement HaapiUIViewController protocol to represent the different types of Haapi Representations. These are open classes, meaning they can be further extended for functionality and/or UI customization.

Implementing HaapiUIViewController is mandatory when providing custom UI implementation and using the provided extensibility options via the ViewControllerResolver functionality. The ViewControllerFactoryRegistry contract requires that the provided UIViewController implements HaapiUIViewController for a given UIModel.

Functions to control the HAAPI flow

It is possible to intercept the HAAPI flow when using any specialized UIViewControllers. The following functions can help to control the HAAPI flow.

Function Description
preFollow Before HaapiFlowViewControllerDelegate.follow is invoked, this function is invoked and gives the possibility to introspect the LinkItemModel. To prevent following the link, the closure has to be invoked with false.
preSelect Before HaapiFlowViewControllerDelegate.select is invoked, this function is invoked and gives the possibility to introspect the SelectorItemModel. To prevent selecting the item, the closure has to be invoked with false.
preSubmit Before HaapiFlowViewControllerDelegate.submit is invoked, this function is invoked and gives the possibility to introspect the InteractionActionModel and parameters. To prevent the submission, the closure has to be invoked with false.

The HaapiUIViewController protocol also defines additional methods to handle interaction responses and content updating which need to be implemented to suit the individual customer use cases when opting to provide completely custom UIViewControllers without extending any of the framework bundled implementations. The BaseViewController provides an implementation for the most common functionality like displaying and hiding the loading indicator while the UI is loading, handling and displaying links and messages and some other needed functionality as mentioned below.

Function Description
stopLoading Stops a loading process. Should be responsible for stopping and hiding any loading animations that may be running in the UI.
hasLoading Returns a Bool indicating if the view controller has a loading element.
handleProblemModel Returns a Bool indicating if the UIProblem is handled by the UIViewController or not.
handleInfoMessageModels Handles an array of InfoMessageModel and displays them on the user facing UI.
handleLinkItemModels Handles an array of LinkItemModel and displays them on the user facing UI.
handleFormModel Returns a Bool indicating if the FormModel is handled or not by the currently loaded UIViewController.