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
FUIDynamicAuthenticationDelegateinstance to verify information user entered.Declaration
Swift
@MainActor public weak var delegate: FUIDynamicAuthenticationDelegate? -
Illustration message. The application has the capability to configure the
FUIIllustratedMessageby specifying thetitle,body, anddetailImageView. These attributes are used to display the branding image, title, and description of the application respectively. When utilizing theillustratedMessagefeature and settingshowsIllustratedMessagetotrue, theheadlineLabelanddetailLabelwill 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
showsIllustratedMessageis set totrue, theillustratedMessagewill be shown, and theheadlineLabelanddetailLabelwill be hidden. Conversely, whenshowsIllustratedMessageis set tofalse, theheadlineLabelanddetailLabelwill be displayed, and theillustratedMessagewill be hidden.The default setting for
showsIllustratedMessageisfalse.Declaration
Swift
@MainActor public var showsIllustratedMessage: Bool { get set } -
Creates a
FUIDynamicAuthenticationScreenobject from storyboard.Declaration
Swift
@MainActor public class func createInstanceFromStoryboard() -> (navigationController: UINavigationController, dynamicAuthenticationScreen: FUIDynamicAuthenticationScreen)Return Value
A tuple of
UINavigationControllerandFUIDynamicAuthenticationScreenobjects. -
Undocumented
Declaration
Swift
@MainActor public func scrollViewDidScroll(_ scrollView: UIScrollView)