Skip to content

Commit

Permalink
Moving around the directory
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrrouse committed Jun 6, 2017
1 parent 6d73503 commit 061986d
Show file tree
Hide file tree
Showing 126 changed files with 508 additions and 261 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
# react-native-touch-sensor
# react-native-touch-sensor

Bridging for accesing the Touch Sensor on both iOS and Android using TouchID and Android Fingerprint

# Installation

`npm install -s react-native-touch-sensor`
`react-native link react-native-touch-sensor`

# Android Setup

Be sure to add the Fingerprint permission to your `AndroidManaifest.xml` file
`<uses-permission android:name="android.permission.USE_FINGERPRINT" />`

# Example
```
import React, { Component } from 'react'
import { View, Text, Button } from 'react-native'
import Touch from 'react-native-touch-sensor'
export default class TouchExample extends Component {
_isSupported() {
Touch.isSupported()
.then( () => alert('Android fingerprint supported'))
.catch( (error) => alert(`unsupported: ${error}`))
}
_authenticatePressed() {
Touch.authenticate("To test out the app")
.then( () => alert('authenticated') )
.catch( (error) => alert(`Failed: ${error}`) )
}
render() {
return (
<View>
<Text>Check to see if all conditions are met to use Fingerprint</Text>
<Button
title="IsSupported()"
onPress={() => this._isSupported()}
/>
<Text>Begins Authentication process</Text>
<Button
title="Authenticate()"
onPress={() => this._authenticatePressed()}
/>
</View>
);
}
}
```

# Reference:
TouchID: https://github.com/naoufal/react-native-touch-id
AndroidFingerprint: https://github.com/googlesamples/android-FingerprintDialog
https://github.com/jariz/react-native-fingerprint-android
https://material.io/guidelines/patterns/fingerprint.html#fingerprint-enrollment

File renamed without changes.
22 changes: 22 additions & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions android/.idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions android/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions android/.idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
103 changes: 103 additions & 0 deletions example/TouchExample/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
View,
Text,
Button
} from 'react-native';

import Touch from 'react-native-touch-sensor'

export default class TouchExample extends Component {


_isSupported() {
Touch.isSupported()
.then( () => alert('Android fingerprint supported'))
.catch( (error) => alert(`unsupported: ${error}`))
}
_hasPermission() {
Touch.hasPermissions()
.then( () => alert('Permissions accepted'))
.catch( (error) => alert(`unsupported: ${error}`))
}

_hardwareSupported() {
Touch.hardwareSupported()
.then( () => alert('Hardware supports it'))
.catch( (error) => alert(`unsupported: ${error}`))
}

_hasFingerprints() {
Touch.hasFingerprints()
.then( () => alert('User Has fingerprints'))
.catch( (error) => alert(`no fingerprints: ${error}`))
}

_authenticatePressed() {
Touch.authenticate("To test out the app")
.then( () => alert('authenticated') )
.catch( (error) => alert(`Failed: ${error}`) )
}


render() {
return (
<View style={styles.container}>
<Text>Check to see if all conditions are met to use Fingerprint</Text>
<Button
title="IsSupported()"
onPress={() => this._isSupported()}
/>
<Text>Check to see if the user has enabled system permissions</Text>
<Button
title="HasPermissions()"
onPress={() => this._hasPermission()}
/>
<Text>Checks The hardware support</Text>
<Button
title="HardwareSupported()"
onPress={() => this._hardwareSupported()}
/>
<Text>Checks if the user has fingerprints on their device</Text>
<Button
title="HasFingerprints()"
onPress={() => this._hasFingerprints()}
/>
<Text>Begins Authentication process</Text>
<Button
title="Authenticate()"
onPress={() => this._authenticatePressed()}
/>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

AppRegistry.registerComponent('TouchExample', () => TouchExample);
69 changes: 69 additions & 0 deletions example/TouchExample/index.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
View,
Text,
Button
} from 'react-native';

import Touch from 'react-native-touch-sensor'

export default class TouchExample extends Component {

_supportedPressed() {
Touch.isSupported()
.then( () => alert('supported'))
.catch( (error) => alert(`unsupported: ${error}`))
}

_authenticatePressed() {
Touch.authenticate("To test out the app")
.then( () => alert('authenticated') )
.catch( (error) => alert(`Failed: ${error}`) )
}


render() {
return (
<View style={styles.container}>
<Button
title="IsSupported()"
onPress={() => this._supportedPressed()}
/>
<Text> space </Text>
<Button
title="Authenticate()"
onPress={() => this._authenticatePressed()}
/>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

AppRegistry.registerComponent('TouchExample', () => TouchExample);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Loading

0 comments on commit 061986d

Please sign in to comment.