Other Classes

The following classes are available globally.

  • Class that provides localized Usage Data Collection UsageUserConsentStep, Opt-in, and Opt-out alerts.

    Manages the Usage User Consent Handling. The version for each user consent form will be stored in the credentialStore of the OnboardingContext which is used to decide if a newer version of the form should be presented in the next run. If a new version for the form is present, the form will be displayed in the next run to request user confirmation.

    Usage

    Simplest model - default single page form.
    let usageUserConsentStep = UsageUserConsentStep()
    Creates a localized title and body that will collect user preference for usage data collection.
    
    Customization model - allow customized single page form.
    let title = "Custom UsageUserConsent Title"
    let body = "Custom UsageUserConsent Body"
    let usageUserConsentStep = UsageUserConsentStep(title: title, body: body)
    
    Customization model with additional page - allow customized multi page form.
    var spDpPage = UserConsentPageContent()
    spDpPage.title = "Data Privacy Details"
    spDpPage.body = "Your customized data privacy text"
    var spSecPage = UserConsentPageContent()
    spSecPage.title = "Security Details"
    spSecPage.body = "Your customized security text"
    let usageUserConsentStep = UsageUserConsentStep(title: title, body: body, additionalUserPageContent: [spDpPage, spSecPage])
    
    User selection will be enacted, and will be published in context.
    Response can be accessed as follows in AppDelegate onboarded delegate method using default key:
    if let consent = onboardingContext.info[.usageUserConsentResponseInfoKey] {
    or an alternate key if it was set on the step as:
    onboardingContext.info[yourUsageStep.usageConsentResponseInfoKey]
    
    Class also contains both localized and custom opt-in and opt-out alerts that may be used to prompt user as needed.
    
    Default opt-in default model called from your app:
    UsageUserConsentStep.UsageUserConsentOptIn(viewController: self) { response in
                                              if response {
                                                  Usage.shared.consentForUser(userUUID, given: response)
                                              }
                                          }
    Customized opt-in model called from your app:
    UsageUserConsentStep.UsageUserConsentOptIn(viewController: self, title: "Custom Opt-in Title", message: "Custom Opt-in Message")
    ...
    
    Default opt-out default model called from your app:
    UsageUserConsentStep.UsageUserConsentOptOut(viewController: self) { response in
                                              if response {
                                                  Usage.shared.consentForUser(userUUID, given: !response)
                                              }
                                          }
    Customized opt-out model called from your app:
    UsageUserConsentStep.UsageUserConsentOptOut(viewController: self, title: "Custom Opt-out Title", message: "Custom Opt-out Message")
    ...
    
    See more

    Declaration

    Swift

    open class UsageUserConsentStep : OnboardingStep, FUIUserConsentViewControllerDelegate