Commit 382cd487 authored by Kacyn Fujii's avatar Kacyn Fujii

change method name and update readme

parent ffd4e0b5
...@@ -198,4 +198,6 @@ console.log("App Instance ID", DeviceInfo.getInstanceID()); // ANDROID ONLY - se ...@@ -198,4 +198,6 @@ console.log("App Instance ID", DeviceInfo.getInstanceID()); // ANDROID ONLY - se
console.log("App is running in emulator", DeviceInfo.isEmulator()); // if app is running in emulator return true console.log("App is running in emulator", DeviceInfo.isEmulator()); // if app is running in emulator return true
console.log("App is running on a tablet", DeviceInfo.isTablet()); // if app is running on a tablet return true console.log("App is running on a tablet", DeviceInfo.isTablet()); // if app is running on a tablet return true
console.log("PIN or fingerprint configured on device", DeviceInfo.isPinOrFingerprintSet()); // if PIN or fingerprint is configured
``` ```
...@@ -163,7 +163,7 @@ RCT_EXPORT_MODULE() ...@@ -163,7 +163,7 @@ RCT_EXPORT_MODULE()
return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad; return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
} }
- (bool) isSecurityEnabled - (bool) isPinOrFingerprintSet
{ {
LAContext *context = [[LAContext alloc] init]; LAContext *context = [[LAContext alloc] init];
return ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]); return ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]);
...@@ -193,7 +193,7 @@ RCT_EXPORT_MODULE() ...@@ -193,7 +193,7 @@ RCT_EXPORT_MODULE()
@"timezone": self.timezone, @"timezone": self.timezone,
@"isEmulator": @(self.isEmulator), @"isEmulator": @(self.isEmulator),
@"isTablet": @(self.isTablet), @"isTablet": @(self.isTablet),
@"isSecurityEnabled": @(self.isSecurityEnabled), @"isPinOrFingerprintSet": @(self.isPinOrFingerprintSet),
}; };
} }
......
...@@ -71,7 +71,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -71,7 +71,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
return layout == Configuration.SCREENLAYOUT_SIZE_LARGE || layout == Configuration.SCREENLAYOUT_SIZE_XLARGE; return layout == Configuration.SCREENLAYOUT_SIZE_LARGE || layout == Configuration.SCREENLAYOUT_SIZE_XLARGE;
} }
private Boolean isSecurityEnabled() { private Boolean isPinOrFingerprintSet() {
KeyguardManager keyguardManager = (KeyguardManager) this.reactContext.getSystemService(Context.KEYGUARD_SERVICE); //api 16+ KeyguardManager keyguardManager = (KeyguardManager) this.reactContext.getSystemService(Context.KEYGUARD_SERVICE); //api 16+
return keyguardManager.isKeyguardSecure(); return keyguardManager.isKeyguardSecure();
} }
...@@ -120,7 +120,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -120,7 +120,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants.put("timezone", TimeZone.getDefault().getID()); constants.put("timezone", TimeZone.getDefault().getID());
constants.put("isEmulator", this.isEmulator()); constants.put("isEmulator", this.isEmulator());
constants.put("isTablet", this.isTablet()); constants.put("isTablet", this.isTablet());
constants.put("isSecurityEnabled", this.isSecurityEnabled()); constants.put("isPinOrFingerprintSet", this.isPinOrFingerprintSet());
return constants; return constants;
} }
} }
...@@ -62,7 +62,7 @@ module.exports = { ...@@ -62,7 +62,7 @@ module.exports = {
isTablet: function() { isTablet: function() {
return RNDeviceInfo.isTablet; return RNDeviceInfo.isTablet;
}, },
isSecurityEnabled: function () { isPinOrFingerprintSet: function () {
return RNDeviceInfo.isSecurityEnabled; return RNDeviceInfo.isPinOrFingerprintSet;
}, },
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment