Skip to content

Commit

Permalink
watchOS: Fixed watchOS & App Extensions builds after changes introduc…
Browse files Browse the repository at this point in the history
…ed in #125
  • Loading branch information
hvge committed Jul 4, 2018
1 parent af9dd5d commit 97f9bd7
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions proj-xcode/Classes/keychain/PA2Keychain.m
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ - (NSDictionary*) allItemsWithPrompt:(NSString*)prompt withStatus: (OSStatus *)s

#pragma mark - Biometry support

#if !defined(PA2_EXTENSION_SDK)
//
// IOS
//

/**
Private helper function to convert LABiometryType enum into our PA2BiometricAuthenticationType
*/
Expand All @@ -283,14 +288,13 @@ static PA2BiometricAuthenticationType _LABiometryTypeToPAType(LABiometryType bt)
}

/**
A private function returns full information about biometric support on the system. The method internally
Private function returns full information about biometric support on the system. The method internally
uses `LAContext.canEvaluatePolicy()`.
*/
static PA2BiometricAuthenticationInfo _getBiometryInfo()
{
PA2BiometricAuthenticationInfo info = { PA2BiometricAuthenticationStatus_NotSupported, PA2BiometricAuthenticationType_None };
#if !defined(PA2_EXTENSION_SDK)
// Check is available only for regular iOS applications
// PowerAuth SDK requires features added in iOS9, so we don't support biometry on iOS8.
if (@available(iOS 9, *)) {
LAContext * context = [[LAContext alloc] init];
NSError * error = nil;
Expand Down Expand Up @@ -341,10 +345,30 @@ static PA2BiometricAuthenticationInfo _getBiometryInfo()
}
}
}
#endif // !defined(PA2_EXTENSION_SDK)
return info;
}

#else // !defined(PA2_EXTENSION_SDK)
//
// watchOS + IOS App Extensions
//

/**
Returns information about biometric support on the system. This is a special implementation
returning information that biometry is not supported on watchOS & IOS App Extension.
*/
static PA2BiometricAuthenticationInfo _getBiometryInfo()
{
PA2BiometricAuthenticationInfo info = { PA2BiometricAuthenticationStatus_NotSupported, PA2BiometricAuthenticationType_None };
return info;
}

#endif // !defined(PA2_EXTENSION_SDK)

//
// High level biometry interfaces
//

+ (BOOL) canUseBiometricAuthentication
{
// The behavior of this property is that it returns YES, only if biometry policy can be evaluated.
Expand Down

0 comments on commit 97f9bd7

Please sign in to comment.