npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-sensitive-info-refis360movil

v5.1.1

Published

react-native-sensitive-info manages all data stored in Android Shared Preferences and iOS Keychain. You can set, get and delete keys/values using simple methods.

Downloads

77

Readme

React Native Sensitive Info

npm version License: MIT Open Source Love

react-native-sensitive-info is the next generation of react-native-get-shared-prefs.

Introduction

react-native-sensitive-info manages all data stored in Android Shared Preferences and iOS Keychain. You can set and get all key/value using simple methods.

| RN SensitiveInfo Version | Description | |--------------------------|----------------------------------| | 4.0+ | Compatible with RN 0.40+ | | <= 3.0.2 | Compatible with RN 0.40 or below |

Install

Install react-native-sensitive-info using:

npm i -S react-native-sensitive-info or yarn add react-native-sensitive-info

Linking project

Automatically

react-native link react-native-sensitive-info

Manually

iOS

In XCode, in the project navigator:

  • Right click Libraries
  • Add Files to [your project's name]
  • Go to node_modules/react-native-sensitive-info
  • Add the .xcodeproj file

In XCode, in the project navigator, select your project.

  • Add the libRNSensitiveInfo.a from the RNSensitiveInfo project to your project's Build Phases ➜ Link Binary With Libraries
  • Click .xcodeproj file you added before in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic').
  • Look for Header Search Paths and make sure it contains both $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React - mark both as recursive. (Should be OK by default.)

Run your project (Cmd+R)

Android

Go to settings.gradle inside your android project folder and paste this lines there:

include ':react-native-sensitive-info'

project(':react-native-sensitive-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sensitive-info/android')

and paste it into build.gradle:

compile project(':react-native-sensitive-info')

In your MainApplication.java add:

import br.com.classapp.RNSensitiveInfo.RNSensitiveInfoPackage; //<- You must import this

protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNSensitiveInfoPackage(), // <- Add this line
    );
}

Sync gradle and go :)

Methods

We unified our library's methods to bring more efficiency and simplify the usability for other developers. We hope that you enjoy it. :)

setItem(key, value, options): You can insert data into shared preferences & keychain using this promise method.

getItem(key, options): This promise will get value from given key.

deleteItem(key, options): It will delete value from given key

getAllItems(options): Will retrieve all keys and values from Shared Preferences & Keychain

"Options" is a new parameter (optional) that you can pass to our methods. But what does it do? Now, you can select which keychain's service (iOS) and shared preferences's name (android) you can use. To do so:

SInfo.setItem('key1', 'value1', {
sharedPreferencesName: 'mySharedPrefs',
keychainService: 'myKeychain'});

But if you prefer to not use it, our default sharedPreferencesName is: shared_preferences and keychainService is: app. For that, use:

SInfo.setItem('key1', 'value1', {});

If you used Android's getDefaultSharedPreferences in your project the shared preference's name that you are looking for is: com.mypackage.MyApp_preferences. In other hands if you used iOS's Keychain the default service is: app which is our default too.

How to use?

Here is a simple example:

import SInfo from 'react-native-sensitive-info';

SInfo.setItem('key1', 'value1', {
sharedPreferencesName: 'mySharedPrefs',
keychainService: 'myKeychain'
}).then((value) =>
        console.log(value) //value 1
);

SInfo.setItem('key2', 'value2', {});

SInfo.getItem('key1', {
sharedPreferencesName: 'mySharedPrefs',
keychainService: 'myKeychain'}).then(value => {
    console.log(value) //value1
});

SInfo.getItem('key2',{}).then(value => {
    console.log(value) //value2
});

SInfo.getAllItems({
sharedPreferencesName: 'mySharedPrefs',
keychainService: 'myKeychain'}).then(values => {
    console.log(values) //value1, value2
});

Contributing

Pull requests are always welcome :)