Skip to content

Commit d7f0530

Browse files
authored
Support for Touch ID for MacOS
1 parent d358742 commit d7f0530

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ios/RNSensitiveInfo/RNSensitiveInfo.m

Lines changed: 7 additions & 4 deletions
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,13 +264,11 @@ - (NSString *)messageForError:(NSError *)error
261264

262265
RCT_EXPORT_METHOD(isSensorAvailable:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
263266
{
264-
#if TARGET_OS_TV || TARGET_OS_MAC
265-
resolve(@(NO));
266-
#else
267+
#if !TARGET_OS_TV
267268
LAContext *context = [[LAContext alloc] init];
268269

269270
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL]) {
270-
if (@available(iOS 11, *)) {
271+
if (@available(iOS 11, macOS 10.13.2, *)) {
271272
if (context.biometryType == LABiometryTypeFaceID) {
272273
return resolve(@"Face ID");
273274
}
@@ -276,6 +277,8 @@ - (NSString *)messageForError:(NSError *)error
276277
} else {
277278
resolve(@(NO));
278279
}
280+
#else
281+
resolve(@(NO));
279282
#endif
280283
}
281284
@end

0 commit comments

Comments
 (0)