FUIDynamicAuthenticationScreen

@MainActor
open class FUIDynamicAuthenticationScreen : FUIWelcomeController, FUISolidNavigationBarProtocol, UIScrollViewDelegate
extension FUIDynamicAuthenticationScreen: UITextFieldDelegate

The FUIDynamicAuthenticationScreen is an UIViewController to display the screen to prompt user to enter information needed for authentication.

It has a message label and a number of the input fields for user to enter information needed. The input fields are configured using the informationFields property.

There is a ‘Cancel’ button on the navigation bar for user to cancel the authentication process. There is also a ‘Done’ button on the navigation bar for user to submit the information. The Done button is disabled until all the input fields are not empty.

Developer should implement FUIDynamicAuthenticationDelegate and set it to the delegate property to handle user responses.


var dynamicAuthenticationScreen: FUIDynamicAuthenticationScreen?
var completionBlock: ((_ errorMessage: String?) -> Void)?

func presentDynamicAuthenticationScreen() {
    let controllers = FUIDynamicAuthenticationScreen.createInstanceFromStoryboard()
    let dynamicAuthController = controllers.dynamicAuthenticationScreen

    dynamicAuthController.informationFields = [
        FUIAuthenticationInformationField(placeholder: "username", isSecureText: false, informationString: "Admin"),
        FUIAuthenticationInformationField(placeholder: "password", isSecureText: true, informationString: nil),
        FUIAuthenticationInformationField(placeholder: "url", isSecureText: false, informationString: nil),
        FUIAuthenticationInformationField(placeholder: "test field", isSecureText: false, informationString: nil)
    ]
    dynamicAuthController.delegate = self

    self.navigationController?.present(controllers.navigationController, animated: true, completion: nil)
}

func verify(_ controller: FUIDynamicAuthenticationScreen, informationStrings: [String], completion: @escaping ((_ errorMessage: String?) -> Void)) {
    dynamicAuthenticationScreen = controller
    completionBlock = completion

    // Send information to server for verification here

    // Simulate callback from verification process
    DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
        self.verificationDone()
    }
}

func verificationDone() {
    completionBlock?(verificationErrorMessage)
    if verificationErrorMessage == nil {
        dynamicAuthenticationScreen?.dismiss(animated: true, completion: nil)
    }
}

func didCancel(_ controller: FUIBasicAuthenticationScreen) {
   print("User Cancelled Basic Authentication")
   controller.dismiss(animated: true, completion: nil)
}

Theming

fdlFUIDynamicAuthenticationScreen_detailLabel {
   font-color: @primary1;
}

fdlFUIDynamicAuthenticationScreen_cancelButton {
   background-tint-color: @tintColorDark;
}

fdlFUIDynamicAuthenticationScreen_doneButton {
   background-tint-color: @tintColorDark;
}

fdlFUIDynamicAuthenticationScreen_messageBannerTitleLabel {
   font-color: @primary7;
}

fdlFUIDynamicAuthenticationScreen_messageBannerDividerTop {
   background-color: @line;
}

fdlFUIDynamicAuthenticationScreen_errorMessageBannerTitleLabel {
   font-color: @negative;
}

fdlFUIDynamicAuthenticationScreen_errorMessageBannerDividerTop {
   background-color: @negative;
}

fdlFUIDynamicAuthenticationScreen_navigationBar {
   background-color: clear;
   background-tint-color: @tintColor;
   bar-style: default;
}

Attention

The delegate object with type FUIDynamicAuthenticationDelegate is declared as a weak reference. On deallocation it will be automatically set to nil. To keep it alive as expected, developer should retain the delegate object during its whole execution scope.

  • The detail message label to display the message of this screen. The default text of this label is “Please provide the information below to start the activation process.” from the localized strings files.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak public private(set) var detailLabel: UILabel! { get }
  • Developer should provide this property for configuring the input fields.

    Declaration

    Swift

    @MainActor
    public var informationFields: [FUIAuthenticationInformationField]?
  • The message displayed on the banner when verifying the message. The default text of this label is “Verifying Information…” from the localized strings files.

    Declaration

    Swift

    @MainActor
    public var verifyingMessage: String?
  • The FUIDynamicAuthenticationDelegate instance to verify information user entered.

    Declaration

    Swift

    @MainActor
    public weak var delegate: FUIDynamicAuthenticationDelegate?
  • Illustration message. The application has the capability to configure the FUIIllustratedMessage by specifying the title, body, and detailImageView. These attributes are used to display the branding image, title, and description of the application respectively. When utilizing the illustratedMessage feature and setting showsIllustratedMessage to true, the headlineLabel and detailLabel will automatically be hidden.

    Declaration

    Swift

    @MainActor
    public private(set) lazy var illustratedMessage: FUIIllustratedMessage { get set }
  • A boolean flag, showsIllustratedMessage, determines whether the illustration message is displayed.

    When showsIllustratedMessage is set to true, the illustratedMessage will be shown, and the headlineLabel and detailLabel will be hidden. Conversely, when showsIllustratedMessage is set to false, the headlineLabel and detailLabel will be displayed, and the illustratedMessage will be hidden.

    The default setting for showsIllustratedMessage is false.

    Declaration

    Swift

    @MainActor
    public var showsIllustratedMessage: Bool { get set }
  • Creates a FUIDynamicAuthenticationScreen object from storyboard.

    Declaration

    Swift

    @MainActor
    public class func createInstanceFromStoryboard() -> (navigationController: UINavigationController, dynamicAuthenticationScreen: FUIDynamicAuthenticationScreen)

    Return Value

    A tuple of UINavigationController and FUIDynamicAuthenticationScreen objects.

  • Undocumented

    Declaration

    Swift

    @MainActor
    public func scrollViewDidScroll(_ scrollView: UIScrollView)