This repository has been archived by the owner on May 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
BioLockdown.h
32 lines (23 loc) · 1.6 KB
/
BioLockdown.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
@class SBApplication;
__attribute__((visibility("hidden")))
@interface BioLockdownController : NSObject
+ (BioLockdownController *)sharedController;
- (BOOL)requiresAuthenticationForIdentifier:(NSString *)identifier;
- (BOOL)requiresAuthenticationForApplication:(SBApplication *)application;
- (BOOL)requiresAuthenticationForRecord:(ABRecordRef)record;
- (BOOL)authenticateForIdentifier:(NSString *)identifier actionDescription:(NSString *)actionDescription completion:(dispatch_block_t)completion failure:(dispatch_block_t)failure;
- (BOOL)authenticateForApplication:(SBApplication *)application actionText:(NSString *)actionText completion:(dispatch_block_t)completion failure:(dispatch_block_t)failure;
- (BOOL)authenticateForSwitchIdentifier:(NSString *)switchIdentifier actionText:(NSString *)actionText completion:(dispatch_block_t)completion failure:(dispatch_block_t)failure;
- (BOOL)authenticateForRecord:(ABRecordRef)record actionText:(NSString *)actionText completion:(dispatch_block_t)completion failure:(dispatch_block_t)failure;
@end
#define HAS_BIOLOCKDOWN (objc_getClass("BioLockdownController") != nil)
#define IF_BIOLOCKDOWN if (HAS_BIOLOCKDOWN)
#define BIOLOCKDOWN_AUTHENTICATE_APP(ident, success, failure_) \
if ([[objc_getClass("BioLockdownController") sharedController] requiresAuthenticationForIdentifier:ident]) \
{ \
[[objc_getClass("BioLockdownController") sharedController] authenticateForIdentifier:ident actionDescription:LOCALIZE(@"BIOLOCKDOWN_AUTH_DESCRIPTION") completion:success failure:failure_]; \
} \
else \
success()