Skip to content

Commit 4a05ded

Browse files
authored
Merge pull request #82 from ycai2/feature/more-granular-android-status-checks
feature: add more fingerprint status checking methods
2 parents f38d50e + 0266dbb commit 4a05ded

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ As noted by by [@Palisand](https://github.com/Palisand) in [this issue](https://
118118

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

121+
`isHardwareDetected()`: resolves to a boolean that indicates the detection of fingerprint hardware
122+
123+
`hasEnrolledFingerprints()`: resolves to a boolean that indicates the enrollment status of fingerprints on the device
124+
125+
`isSensorAvailable`: resolves to a boolean that indicates the overall availability of fingerprint sensor (a combination of the previous two methods)
126+
121127
`setItem(key, value, options)`: You can insert data into shared preferences & keychain using this promise method.
122128

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

android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ private boolean hasSetupFingerprint() {
8787
}
8888
}
8989

90+
@ReactMethod
91+
public void isHardwareDetected(final Promise pm) {
92+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
93+
pm.resolve(mFingerprintManager.isHardwareDetected());
94+
} else {
95+
pm.resolve(false);
96+
}
97+
}
98+
99+
@ReactMethod
100+
public void hasEnrolledFingerprints(final Promise pm) {
101+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
102+
pm.resolve(mFingerprintManager.hasEnrolledFingerprints());
103+
} else {
104+
pm.resolve(false);
105+
}
106+
}
107+
90108
@ReactMethod
91109
public void isSensorAvailable(final Promise promise) {
92110
promise.resolve(hasSetupFingerprint());

0 commit comments

Comments
 (0)