Configure the Privacy Module
Add the Workspace ONE UEM privacy page to your application to display information about types of data collected and to get user opt-in to collect usage analytics. This module is independent of the Workspace ONE SDK and does not require SDK integration.
To use the privacy page, you need to import the module, create a privacy module configuration object, and then configure the two UIs.
Note: The privacy module does not collect
data. It displays information about what data your app collects and prompts the user
to consent to the collection of usage analytics. It is the on and off button but it
is not the collector.
Procedure
-
Import the Workspace ONE
SDK privacy module into your project. The module is a
standard iOS framework.
- Open your app in Xcode.
- Go to the General configuration page.
- Add the Workspace ONE SDK privacy module framework target to the Embedded Binaries section by clicking the Add icon.
- Select the Workspace ONE SDK privacy module framework from the list of binaries.
-
Create a default privacy module configuration object. Use the example code
block as a foundation for your privacy module configuration object. You can
customize all the text in the module.
let config = AWPrivacyConfig() //Set to true if a back/exit button is needed on the privacy view when getting user acceptance. //By default this is false as it is not required for most apps. //The delegate userDidDeclinePrivacyTerms will be invoked on the exit button action config.allowExit = false //Pass in the Privacy webclip url for applicable apps. config.mdmDataURL = URL(string:"https://www.vmware.com") //If analytics is allowed by admin. Either the new flag or values that the apps currently depend config.allowFeatureAnalytics = true //Customers privacy policy from the console config.customerPrivacyPolicyLink = "https://www.customer.com/global/privacy-policy" //Add the path to data sharing config.appPrivacySettingPath = "View Policies->Data Sharing." // Data collection. // The module provides a list of defaults that can be used optionally. var defaultDataCollected = AWPrivacyConfig.defaultDataCollectionSummary //If the apps dont need any additional summary, pass the above. If not, add as required. //AWPrivacyContent offers some predefined image types that the apps can use. If not available, pass in your own let notificationDataCollected = AWPrivacyContent(title: "Notification Information", summary: "Email subject and sender.", imageType: .notifications) defaultDataCollected.append(notificationDataCollected) config.appDataCollectionSummary = defaultDataCollected // OS Permission as applicable to the app. // The module has some predefined images builtin that can be used by the apps. // The module also allow apps to use custom images config.appPermissionSummary = [ AWPrivacyContent(title: "Contacts", summary: LoremIpsum, imageType: .contacts), AWPrivacyContent(title: "Calendar", summary: LoremIpsum, imageType: .calendar), AWPrivacyContent(title: "Photos", summary: LoremIpsum, imageType: .photos), AWPrivacyContent(title: "Camera", summary: LoremIpsum, imageType: .camera), AWPrivacyContent(title: "Location services", summary: LoremIpsum, imageType: .locationServices), AWPrivacyContent(title: "Notifications", summary: LoremIpsum, imageType: .notifications), AWPrivacyContent(title: "FaceID/TouchID", summary: LoremIpsum, imageType: .faceId), ] ///Optionally configure the static text ///Localized Header title text that will be displayed in the user privacy consent screen. config.privacyTermsHeaderTitle = "Sample Privacy Header title" ///Localized string for the header body that will be displayed in the user privacy consent screen. config.privacyTermsHeaderBody = LoremIpsum ///Localized title that will displayed along with app data collection summary section config.appDataCollectionTitle = "Sample App Data collection title" ///Localized title that will displayed along with app permissions summary section config.appPermissionsTitle = "Sample app permissions title" ///Localized Header title text that will be displayed in the data sharing consent screen. config.dataSharingHeaderTitle = "Sample app data sharing header title" ///Localized string for the header body that will be displayed in the data sharing consent screen. config.dataSharingHeaderBody = LoremIpsum
-
Use
the preview controller in the privacy module to view the terms, app permissions,
and data collection summary of your app.
The preview controller does not include an option to get user consent. By default, the preview policies controller is not embedded in a navigation controller. If you want the preview policies controller in a navigation controller, explicitly indicate this location when requesting the previewPoliciesViewController.
let privacyController = AWPrivacyController(withConfig: defaultPrivacyConfig, delegate: self) let navigationController = privacyController.makePreviewPoliciesViewController(true)
let defaultPrivacyConfig = AWPrivacyConfig() //update this to the required configuration. let privacyController = AWPrivacyController(withConfig: defaultPrivacyConfig, delegate: self) let viewController = privacyController.makePreviewPoliciesViewController() navigationController?.pushViewController(viewController, animated: true)
-
Display
the UI to prompt for user consent to collect usage analytics.
-
Set the privacy module to check if it needs to display the privacy view
to the user.
AWPrivacyController.needsUserConsent(forConfig: defaultPrivacyConfig)
The sample code passes the current configuration of the application. The privacy module returnsYes
for several reasons.- The app is new.
- The app configuration changed from the config that was available at the time of user acceptence.
-
If the app needs to get user consent, ask the privacy module to create
a view controller to present to the user.
Reasons to get user consent again include changes to parameters in the configuration passed in AWPrivacyConfig.
- customerPrivacyPolicyLink
- mdmDataURL
- appPermissionsSummary
- appDataCollectionSummary
let privacyController = AWPrivacyController(withConfig: defaultPrivacyConfig, delegate: self) let navigationController = privacyController.makeUserConsentViewController()
The sample code creates the privacy controller with the config. It requests the privacy controller to create the user consent view controller. By default, the view controller is embedded in a navigation controller. -
If you do not want the view controller in the navigation controller,
explicitly indicate this when requesting the
userConsentViewController.
let privacyController = AWPrivacyController(withConfig: defaultPrivacyConfig, delegate: self) let viewController = privacyController.makeUserConsentViewController(false)
let defaultPrivacyConfig = AWPrivacyConfig() //update this to the required configuration. /** Check if privacy view is needed to be displayed. Pass the current app config */ if (AWPrivacyController.needsUserConsent(forConfig: defaultPrivacyConfig)) { let privacyController = AWPrivacyController(withConfig: defaultPrivacyConfig, delegate: self) let nav = privacyController.makeUserConsentViewController() present(nav, animated: true, completion: nil) } else { // No need to present the Privacy view to get user consent }
If the configuration requires user opt-in for analytics, the privacy module invokes the AWPrivacyControllerDelegate callback. The callback has the user opt-in status. If the configuration allows the user to exit the consent screen, the module invokes the delegate callback to indicate the user has canceled the terms. -
Set the privacy module to check if it needs to display the privacy view
to the user.