Skip to content

Commit 28fa85c

Browse files
authored
Merge pull request #142 from acerbetti/master
Fix compilation error for TvOS and MacOS
2 parents 808e81f + d7f0530 commit 28fa85c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ios/RNSensitiveInfo/RNSensitiveInfo.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
#import "React/RCTConvert.h"
66
#import "React/RCTBridge.h"
77
#import "React/RCTUtils.h"
8+
9+
#if !TARGET_OS_TV
810
#import <LocalAuthentication/LocalAuthentication.h>
11+
#endif
912

1013
@implementation RNSensitiveInfo
1114

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

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

266270
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL]) {
267-
if (@available(iOS 11, *)) {
271+
if (@available(iOS 11, macOS 10.13.2, *)) {
268272
if (context.biometryType == LABiometryTypeFaceID) {
269273
return resolve(@"Face ID");
270274
}
@@ -273,5 +277,8 @@ - (NSString *)messageForError:(NSError *)error
273277
} else {
274278
resolve(@(NO));
275279
}
280+
#else
281+
resolve(@(NO));
282+
#endif
276283
}
277284
@end

0 commit comments

Comments
 (0)