EULAStep
open class EULAStep : OnboardingStep, FUIEULADelegate
Manages the End User License Agreement (EULA) handling.
The EULA version will be stored in the credentialStore
of the OnboardingContext
which is used to decide if a new EULA screen should be presented on the next run.
If the user has not confirmed EULA, or a new EULA content is present, a screen will be displayed to request user confirmation.
Usage
let title = "SAP - EULA"
let text = """
This is a legally binding agreement (Agreement) between Company and SAP SE which provides the terms of your use of the SAP mobile application (Software). By clicking "Accept" or by installing and/or using the Software, you on behalf of the Company are agreeing to all of the terms and conditions stated in this Agreement. If you do not agree to these terms, do not click "Agree", and do not use the Software. You represent and warrant that you have the authority to bind the Company to the terms of this Agreement.
"""
let attributes = [NSAttributedStringKey.font: UIFont(name: "Georgia", size: 17.0)!]
let content = NSAttributedString(string: content, attributes: attributes)
let eulaContent = EULAContent(title: title, content: content, version: "1.0")
let eulaStep = EULAStep(eulaContent: eulaContent)
-
Use this handler to customize the EULA screen before presentation.
Declaration
Swift
public var customizationHandler: (FUIEULAViewController) -> Void
-
The current EULA is stored under this key if the user accepts is. It is used in the restore flow to decide if a new EULA should be presented.
Declaration
Swift
public var eulaVersionStoreKey: String
-
Instantiates the EULAStep. Use this step to show the user the EULA, which can be accepted or rejected. If the provided EULA version has already been accepted then this step does nothing.
Declaration
Swift
public init(eulaContent: EULAContent)
Parameters
eulaContent
The EULA content to be presented.
-
Instantiates the EULAStep. Use this step to show the user the EULA, which can be accepted or rejected. Use this initialization method if you want to provide the EULA content dynamically through the OnboardingContext.
Declaration
Swift
public init(eulaContentInfoKey: OnboardingInfoKey = .eulaContentInfoKey)
Parameters
eulaContentInfoKey
the info key containing the EULA content in the OnboardingContext.
-
Onboard function for EULA handling. If the user accepts the EULA, the version of the EULA will be persisted under the
eulaVersionStoreKey
key. This is used in the restore flow to decide if the content of the EULA has changed or not.Declaration
Swift
open func onboard(eulaContent: EULAContent, presentationDelegate: FlowPresentationDelegate, credentialStore: CodableStoring, completionHandler: @escaping (Error?) -> Void)
Parameters
eulaContent
the EULA content to be presented.
presentationDelegate
the presentation delegate which is used to put up the EULA screen.
credentialStore
the credential store which contains the current EULA content.
completionHandler
call this completion handler with
nil
if the user accepted the EULA, provide an error otherwise. -
Restore function for EULA handling. Reads the
eulaVersionStoreKey
value from the store, and if it differs from the current version then presents the EULA screen for confirmation.Declaration
Swift
open func restore(eulaContent: EULAContent, presentationDelegate: FlowPresentationDelegate, credentialStore: CodableStoring, completionHandler: @escaping (Error?) -> Void)
Parameters
eulaContent
the EULA content to be presented.
presentationDelegate
the presentation delegate which is used to put up the EULA screen.
credentialStore
the credential store which contains the current EULA content.
completionHandler
call this completion handler with
nil
if the user accepted the EULA, provide an error otherwise. -
Reset function for EULA handling. Clears the
eulaVersionStoreKey
value from the store.Declaration
Swift
open func reset(credentialStore: CodableStoring, completionHandler: @escaping () -> Void)
Parameters
credentialStore
the credential store which contains the current EULA content.
completionHandler
the completion handler that gets called at the end of the process.
-
Onboard function for EULA handling. If the user accepts the EULA, the version of the EULA will be persisted under the
eulaVersionStoreKey
key. This is used in the restore flow to decide if the content of the EULA has changed or not.Declaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
called when the process finished. Error filled on failure.
-
Restore function for EULA handling. Reads the
eulaVersionStoreKey
value from the store, and if it differs from the current version then presents the EULA screen for confirmation.Declaration
Swift
open func restore(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
called when the process finished. Error filled on failure.
-
resetPasscode function for EULA handling.
Declaration
Swift
open func resetPasscode(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
called when the process finished. Step OnboardingResult filled.
-
Reset function for EULA handling. Clears the
eulaVersionStoreKey
value from the store.Declaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)
Parameters
context
completionHandler
called when the process finished. Error filled on failure.
-
Gets called when the user taps the accept button.
Declaration
Swift
open func eulaAccepted(on viewController: FUIEULAViewController)
-
Gets called when the user taps the reject button.
Declaration
Swift
open func eulaRejected(on viewController: FUIEULAViewController)
-
Gets called when the user taps the cancel button.
Declaration
Swift
open func eulaCancelled(on viewController: FUIEULAViewController)