Code Monkey home page Code Monkey logo

smart-gdpr-cmp-ios's Introduction

SmartCMP for iOS

WORK IN PROGRESS: DO NOT USE IN PRODUCTION!

  • APIs not final
  • Configuration object not final
  • UI not final
  • Vendor list model parsing may be too strict
  • Some public APIs are missing in ObjC headers
  • Localization is not implemented, this version leaves this whole topic to the publisher

OPEN FOR COMMENT - create a Github issue if you want to participate

Introduction

SmartCMP is a framework allowing you to retrieve and store the user's consent for data usage in your iOS apps.

Retrieving user consent will be mandatory in EU starting May 25th due to the General Data Protection Regulation (GDPR).

Consent tool on iOS

Usage

Installation

Drag the SmartCMP.xcodeproj to your project and add the SmartCMP.framework target to the Embedded Binaries section of your project General properties.

Integration

You must setup the CMP before using it. Start by creating a configuration object that will define how the first screen of the consent tool will look like:

let config = CMPConsentToolConfiguration(logo: UIImage(named: "logo")!,
                                       homeScreenText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                                       homeScreenManageConsentButtonTitle: "MANAGE MY CHOICES",
                                       homeScreenCloseButtonTitle: "GOT IT, THANKS!",
                                       consentManagementScreenTitle: "Privacy preferences",
                                       consentManagementCancelButtonTitle: "Cancel",
                                       consentManagementSaveButtonTitle: "Save",
                                       consentManagementScreenVendorsSectionHeaderText: "Vendors",
                                       consentManagementScreenPurposeSectionHeaderText: "Purpose",
                                       consentManagementVendorsControllerAccessText: "Customize authorized vendors",
                                       consentManagementActivatedText: "yes",
                                       consentManagementDeactivatedText: "no",
                                       consentManagementPurposeDetailAllowText: "Allowed",
                                       consentManagementVendorDetailViewPolicyText: "View privacy policy",
                                       consentManagementVendorDetailPurposesText: "Required purposes",
                                       consentManagementVendorDetailFeaturesText: "Features")

Call the configure() method on CMPConsentManager.shared to start the CMP.

CMPConsentManager.shared.configure(language: CMPLanguage(string: "en")!, consentToolConfiguration: self.generateConsentToolConfiguration())

When the CMP is started, it will automatically fetch the most recent vendors list (vendors.json) and prompt the user for consent if necessary, saving the resulting consent string in iOS NSUserDefaults (according to the IAB specifications).

You might want to control when the user will be prompted for consent for better user experience. In this case, define a delegate for CMPConsentManager.shared:

CMPConsentManager.shared.delegate = self

When retrieval of the user consent is required, the consentManagerRequestsToShowConsentTool method will be called on the delegate and it will be the app's responsability to display the consent tool UI when appropriate.

func consentManagerRequestsToShowConsentTool(_ consentManager: CMPConsentManager) {
  // It is necessary to update the user consent using the consent tool.
}

Showing the consent tool is done using the method showConsentTool. Note that this method can be used not only when it has been requested by the consent manager, but also anytime you want to provide a way for the user to change its consent options.

CMPConsentManager.shared.showConsentTool(fromController: self)

License

This software is distributed under the Creative Commons Legal Code, Attribution 3.0 Unported license.

Check the LICENSE file for more details.

smart-gdpr-cmp-ios's People

Contributors

lgironditmetaz avatar gomezo76 avatar thomasgeley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.