Skip to content

Commit 46cf6c2

Browse files
authored
Merge pull request #26 from mlabrum/feature/support-0.40
Feature/support 0.40
2 parents 024ad4c + 6e39c1b commit 46cf6c2

21 files changed

Lines changed: 4798 additions & 843 deletions

File tree

README.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# React Native Touch ID
22

3+
[![react-native version](https://img.shields.io/badge/react--native-0.40-blue.svg?style=flat-square)](http://facebook.github.io/react-native/releases/0.40)
34
[![npm version](https://img.shields.io/npm/v/react-native-touch-id.svg?style=flat-square)](https://www.npmjs.com/package/react-native-touch-id)
45
[![npm downloads](https://img.shields.io/npm/dm/react-native-touch-id.svg?style=flat-square)](https://www.npmjs.com/package/react-native-touch-id)
56
[![Code Climate](https://img.shields.io/codeclimate/github/naoufal/react-native-touch-id.svg?style=flat-square)](https://codeclimate.com/github/naoufal/react-native-touch-id)
@@ -22,6 +23,9 @@ React Native Touch ID is a [React Native](http://facebook.github.io/react-native
2223
npm i --save react-native-touch-id
2324
```
2425

26+
## Support
27+
Due to the rapid changes being made in the React Native ecosystem, we are not officially going to support this module on anything but the latest version of React Native. The current supported version is indicated on the React Native badge at the top of this README. If it's out of date, we encourage you to submit a pull request!
28+
2529
## Usage
2630
### Linking the Library
2731
In order to use Touch ID, you must first link the library to your project. There's excellent documentation on how to do this in the [React Native Docs](http://facebook.github.io/react-native/docs/linking-libraries-ios.html#content).
@@ -75,31 +79,6 @@ var YourComponent = React.createClass({
7579
});
7680
```
7781

78-
## Fallback
79-
When Touch ID isn't available on a device, you should fallback to using something like [Passcode Auth](https://github.com/naoufal/react-native-passcode-auth) to authenticate users.
80-
81-
```js
82-
import TouchID from 'react-native-touch-id';
83-
import PasscodeAuth from 'react-native-passcode-auth';
84-
const reason = 'to demo this react-native component';
85-
86-
TouchID.authenticate(reason)
87-
.then(success => {
88-
// Success code
89-
})
90-
.catch(fallbackAuth);
91-
92-
function fallbackAuth(reason) {
93-
return PasscodeAuth.authenticate(reason)
94-
.then(success => {
95-
// Success code
96-
})
97-
.catch(error => {
98-
// Failure code
99-
});
100-
}
101-
```
102-
10382
## Methods
10483
### authenticate(reason)
10584
Attempts to authenticate with Touch ID.

TouchID.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#import "RCTBridgeModule.h"
1+
#import <React/RCTBridgeModule.h>
22

33
@interface TouchID : NSObject <RCTBridgeModule>
44

5-
@end
5+
@end

TouchID.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import "TouchID.h"
2-
#import "RCTUtils.h"
2+
#import <React/RCTUtils.h>
33
#import <LocalAuthentication/LocalAuthentication.h>
44

55
@implementation TouchID

examples/TouchIDExample/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["react-native"]
3+
}
Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
[ignore]
2-
3-
# We fork some components by platform.
2+
; We fork some components by platform
43
.*/*[.]android.js
54

6-
# Ignore templates with `@flow` in header
7-
.*/local-cli/generator.*
8-
9-
# Ignore malformed json
10-
.*/node_modules/y18n/test/.*\.json
11-
12-
# Ignore the website subdir
13-
<PROJECT_ROOT>/website/.*
14-
15-
# Ignore BUCK generated dirs
5+
; Ignore "BUCK" generated dirs
166
<PROJECT_ROOT>/\.buckd/
177

18-
# Ignore unexpected extra @providesModule
19-
.*/node_modules/commoner/test/source/widget/share.js
8+
; Ignore unexpected extra "@providesModule"
9+
.*/node_modules/.*/node_modules/fbjs/.*
2010

21-
# Ignore duplicate module providers
22-
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
11+
; Ignore duplicate module providers
12+
; For RN Apps installed via npm, "Libraries" folder is inside
13+
; "node_modules/react-native" but in the source repo it is in the root
2314
.*/Libraries/react-native/React.js
2415
.*/Libraries/react-native/ReactNative.js
25-
.*/node_modules/jest-runtime/build/__tests__/.*
2616

2717
[include]
2818

@@ -34,25 +24,21 @@ flow/
3424
[options]
3525
module.system=haste
3626

37-
esproposal.class_static_fields=enable
38-
esproposal.class_instance_fields=enable
39-
4027
experimental.strict_type_args=true
4128

4229
munge_underscores=true
4330

44-
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
4531
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
4632

4733
suppress_type=$FlowIssue
4834
suppress_type=$FlowFixMe
4935
suppress_type=$FixMe
5036

51-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
52-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
37+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
38+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
5339
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
5440

5541
unsafe.enable_getters_and_setters=true
5642

5743
[version]
58-
^0.32.0
44+
^0.36.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

examples/TouchIDExample/.gitignore

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ DerivedData
2222
*.xcuserstate
2323
project.xcworkspace
2424

25-
# Android/IJ
25+
# Android/IntelliJ
2626
#
27-
*.iml
27+
build/
2828
.idea
2929
.gradle
3030
local.properties
31+
*.iml
3132

3233
# node.js
3334
#
@@ -38,4 +39,15 @@ npm-debug.log
3839
buck-out/
3940
\.buckd/
4041
android/app/libs
41-
android/keystores/debug.keystore
42+
*.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
50+
51+
fastlane/report.xml
52+
fastlane/Preview.html
53+
fastlane/screenshots

examples/TouchIDExample/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ dependencies {
134134
// Run this once to be able to run the application with BUCK
135135
// puts all compile dependencies into folder libs for BUCK to use
136136
task copyDownloadableDepsToLibs(type: Copy) {
137-
from configurations.compile
138-
into 'libs'
137+
from configurations.compile
138+
into 'libs'
139139
}

examples/TouchIDExample/android/app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.touchidexample">
2+
package="com.touchidexample"
3+
android:versionCode="1"
4+
android:versionName="1.0">
35

46
<uses-permission android:name="android.permission.INTERNET" />
7+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
8+
9+
<uses-sdk
10+
android:minSdkVersion="16"
11+
android:targetSdkVersion="22" />
512

613
<application
14+
android:name=".MainApplication"
715
android:allowBackup="true"
816
android:label="@string/app_name"
917
android:icon="@mipmap/ic_launcher"

examples/TouchIDExample/android/app/src/main/java/com/touchidexample/MainApplication.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.facebook.react.ReactNativeHost;
99
import com.facebook.react.ReactPackage;
1010
import com.facebook.react.shell.MainReactPackage;
11+
import com.facebook.soloader.SoLoader;
1112

1213
import java.util.Arrays;
1314
import java.util.List;
@@ -30,6 +31,12 @@ protected List<ReactPackage> getPackages() {
3031

3132
@Override
3233
public ReactNativeHost getReactNativeHost() {
33-
return mReactNativeHost;
34+
return mReactNativeHost;
35+
}
36+
37+
@Override
38+
public void onCreate() {
39+
super.onCreate();
40+
SoLoader.init(this, /* native exopackage */ false);
3441
}
3542
}

0 commit comments

Comments
 (0)