Skip to content

Commit

Permalink
Merge pull request #142 from acerbetti/master
Browse files Browse the repository at this point in the history
Fix compilation error for TvOS and MacOS
  • Loading branch information
mCodex authored Mar 12, 2019
2 parents 808e81f + d7f0530 commit 28fa85c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ios/RNSensitiveInfo/RNSensitiveInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
#import "React/RCTConvert.h"
#import "React/RCTBridge.h"
#import "React/RCTUtils.h"

#if !TARGET_OS_TV
#import <LocalAuthentication/LocalAuthentication.h>
#endif

@implementation RNSensitiveInfo

Expand Down Expand Up @@ -261,10 +264,11 @@ - (NSString *)messageForError:(NSError *)error

RCT_EXPORT_METHOD(isSensorAvailable:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{
#if !TARGET_OS_TV
LAContext *context = [[LAContext alloc] init];

if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL]) {
if (@available(iOS 11, *)) {
if (@available(iOS 11, macOS 10.13.2, *)) {
if (context.biometryType == LABiometryTypeFaceID) {
return resolve(@"Face ID");
}
Expand All @@ -273,5 +277,8 @@ - (NSString *)messageForError:(NSError *)error
} else {
resolve(@(NO));
}
#else
resolve(@(NO));
#endif
}
@end

0 comments on commit 28fa85c

Please sign in to comment.