Skip to content

Commit e665c71

Browse files
authored
Merge pull request #56 from WeslleyNasRocha/master
Add support for device locked
2 parents 57d92e7 + 294e261 commit e665c71

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ componentWillUnmount() {
311311
| FingerprintScannerNotEnrolled | Authentication could not start because Fingerprint Scanner has no enrolled fingers |
312312
| FingerprintScannerUnknownError | Could not authenticate for an unknown reason |
313313
| FingerprintScannerNotSupported | Device does not support Fingerprint Scanner |
314+
| DeviceLocked | Authentication was not successful, the device currently in a lockout of 30 seconds |
314315

315316
## License
316317

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ repositories {
3131

3232
dependencies {
3333
compile 'com.facebook.react:react-native:+'
34-
compile 'com.wei.android.lib:fingerprintidentify:1.1.4'
34+
compile 'com.wei.android.lib:fingerprintidentify:1.2.1'
3535
}

android/src/main/java/com/hieuvp/fingerprint/ReactNativeFingerprintScannerModule.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,20 @@ public void onNotMatch(int availableTimes) {
9191
}
9292

9393
@Override
94-
public void onFailed() {
95-
promise.reject("AuthenticationFailed", "AuthenticationFailed");
94+
public void onFailed(boolean isDeviceLocked) {
95+
if(isDeviceLocked){
96+
promise.reject("AuthenticationFailed", "DeviceLocked");
97+
} else {
98+
promise.reject("AuthenticationFailed", "AuthenticationFailed");
99+
}
96100
ReactNativeFingerprintScannerModule.this.release();
97101
}
102+
103+
@Override
104+
public void onStartFailedByDeviceLocked() {
105+
// the first start failed because the device was locked temporarily
106+
promise.reject("AuthenticationFailed", "DeviceLocked");
107+
}
98108
});
99109
}
100110

src/createError.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const ERRORS = {
99
FingerprintScannerNotEnrolled: 'Authentication could not start because Fingerprint Scanner has no enrolled fingers.',
1010
FingerprintScannerUnknownError: 'Could not authenticate for an unknown reason.',
1111
FingerprintScannerNotSupported: 'Device does not support Fingerprint Scanner.',
12+
DeviceLocked: 'Authentication was not successful, the device currently in a lockout of 30 seconds'
1213
};
1314

1415
class FingerprintScannerError extends Error {

0 commit comments

Comments
 (0)