Giter VIP home page Giter VIP logo

didomi-react-native's Introduction

Didomi React Native

Didomi is a leading Consent Management Platform that allows companies to collect, store, and leverage user consent under GDPR, CCPA, and other data privacy regulations. This plugin enables React Native developers to get in compliance and optimize their consent rate and monetization on native mobile apps.

This repository contains the source code and a sample app for the Didomi React Native plugin. This plugin enables React Native developers to easily use Didomi's Consent Management Platform on Android and iOS apps.

Installation

Install using yarn add @didomi/react-native Or npm i @didomi/react-native

Then install required pods for iOS with cd ios && pod install

As Didomi requires Swift runtime for iOS, you may need to add an empty Swift file (to create a briding header) into Xcode project.

Usage

import { Didomi, DidomiEventType } from '@didomi/react-native';
import { useEffect } from 'react';

// ...
function App() {
  useEffect(() => {
    // Initialize and setup UI
    // The initialize function need to be called only once and as early as possible to give time for the SDK initialization
    Didomi.initialize('YOUR_API_KEY', undefined, undefined, undefined, false, undefined, 'YOUR_NOTICE_ID');

    // The setupUI displays the popup and is only available once the SDK sent the onReady events
    Didomi.setupUI();
  }, [])
  return (
    <SafeAreaView style={{ flex: 1 }}>
      // ...
    </SafeAreaView>
  );
}

//...

// Retrieve data
const purposes = await Didomi.getEnabledPurposes();
const status = await Didomi.getUserStatusForVendor('vendorId');

//...

// Register an event listener
Didomi.addEventListener(DidomiEventType.SHOW_NOTICE, () => {
  console.log('Show notice');
});

//...

For a complete overview of available methods and events, have a look at the online documentation.

Configuration with local file

In case you need to use a local configuration. The didomi_config.json must be added to native iOS and Android projects.

On iOS, drag and drop the file to Xcode files.

On Android, copy it to the src/main/assets folder.

Documentation

For complete instructions on installing and using the plugin, please read our documentation:

Developer guide

API reference

Example applications

Sources contain 2 applications: /testApp (an app designed mostly for UI testing ) and /sampleApp (more human friendly app).

They can be run with:

# testApp or sampleApp
cd testApp
cd ios && pod install
yarn ios
# or yarn android

Suggesting improvements

To file bugs, make feature requests, or to suggest other improvements, please use Github's issue tracker.

License

Modified BSD License (BSD-3)

didomi-react-native's People

Contributors

fowlinglight avatar yetelday avatar pmerlet-at-didomi avatar nicolas-chaix-didomi avatar felipe-saez avatar aagsby avatar zippy1978 avatar dardinier 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.