PROTOCOL

HaapiUIViewController

public protocol HaapiUIViewController where Self: UIViewController

The methods that an UIViewController adopts to manage UIModels and haapi flow related to the UI. This interface is required to be implemented by UIViewControllers that are used to present user interfaces during the authentication flow.

Use the methods of this protocol to manage the following features:

Properties

haapiFlowViewControllerDelegate

var haapiFlowViewControllerDelegate: HaapiFlowViewControllerDelegate?

The delegate responsible to intermediate interactions from the UIViewController instance to the parent HaapiFlowViewController.

uiStylableThemeDelegate

var uiStylableThemeDelegate: UIStylableThemeDelegate?

The delegate responsible for returning theme defined values

Methods

stopLoading()

func stopLoading()

Stops a loading process.

hasLoading()

func hasLoading() -> Bool

Returns a Bool indicating if the view controller has a loading element.

handleProblemModel(_:)

func handleProblemModel(_ problemModel: ProblemModel) -> Bool

Returns a Bool indicating if the UIProblem is handled or not.

Parameters

Name Description
problemModel An UIProblem that is mapped on a ProblemRepresentation.

handleInfoMessageModels(_:)

func handleInfoMessageModels(_ infoMessageModels: [InfoMessageModel])

Handles an array of InfoMessageModel.

Parameters

Name Description
infoMessageModels An array of InfoMessageModel.

handleLinkItemModels(_:)

func handleLinkItemModels(_ linkItemModels: [LinkItemModel])

Handles an array of LinkItemModel.

Parameters

Name Description
linkItemModels An array of LinkItemModel.

handleFormModel(_:)

func handleFormModel(_ formModel: FormModel) -> Bool

Returns a Bool indicating if the FormModel is handled or not.

Parameters

Name Description
formModel A FormModel.

preSubmit(interactionActionModel:parameters:closure:)

func preSubmit(interactionActionModel: InteractionActionModel,
               parameters: [String: Any],
               closure: @escaping (Bool, [String: Any]) -> Void)

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.

Parameters

Name Description
interactionActionModel The interaction action model to be submitted.
parameters Parameters to be sent with the form action model.
closure A closure of Bool and [String: Any]. If it is set to true, then the submission continues. Otherwise, no submission are made.

preSelect(selectorItemModel:closure:)

func preSelect(selectorItemModel: SelectorItemInteractionActionModel, closure: @escaping (Bool) -> Void)

Before HaapiFlowViewControllerDelegate.select is invoked, this function is invoked and gives the possibility to introspect the selectorItemModel. To prevent selecting the selectorItemModel, the closure has to be invoked with false.

Parameters

Name Description
selectorItemModel The selector item model that contains the action to trigger.
closure A closure of Bool. If it set to true, the selector item model is being selected. Otherwise, no selector item models are selected.

preFollow(linkItemModel:closure:)

func preFollow(linkItemModel: LinkItemModel, closure: @escaping (Bool) -> Void)

Before HaapiFlowViewControllerDelegate.follow is invoked, this function is invoked and gives the possibility to introspect the link. To prevent following the link, the closure has to be invoked with false.

Parameters

Name Description
linkItemModel The link item model to be followed.
closure A closure of Bool. If it is set to true, the link is being followed. Otherwise, no links are being followed.