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 19
/
Copy pathAsphaleia2.h
43 lines (35 loc) · 1.64 KB
/
Asphaleia2.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
33
34
35
36
37
38
39
40
41
42
43
#import <UIKit/UIKit.h>
// https://gist.github.com/evilGoldfish/49753c4aa247b727453e
typedef NS_ENUM(NSInteger, ASAuthenticationAlertType) {
ASAuthenticationAlertAppArranging,
ASAuthenticationAlertSwitcher,
ASAuthenticationAlertSpotlight,
ASAuthenticationAlertPowerDown,
ASAuthenticationAlertControlCentre,
ASAuthenticationAlertControlPanel,
ASAuthenticationAlertPhotos,
ASAuthenticationAlertSettingsPanel,
ASAuthenticationAlertFlipswitch
};
typedef void (^ASCommonAuthenticationHandler) (BOOL wasCancelled);
@interface ASCommon : NSObject <UIAlertViewDelegate> {
ASCommonAuthenticationHandler authHandler;
}
+(instancetype)sharedInstance;
-(UIAlertView *)currentAuthAlert;
-(BOOL)authenticateAppWithDisplayIdentifier:(NSString *)appIdentifier customMessage:(NSString *)customMessage dismissedHandler:(ASCommonAuthenticationHandler)handler;
-(BOOL)authenticateFunction:(ASAuthenticationAlertType)alertType dismissedHandler:(ASCommonAuthenticationHandler)handler;
@end
#define LOAD_ASPHALEIA if ([NSFileManager.defaultManager fileExistsAtPath:@"/usr/lib/libasphaleiaui.dylib"]) dlopen("/usr/lib/libasphaleiaui.dylib", RTLD_LAZY);
#define HAS_ASPHALEIA2 (objc_getClass("ASCommon") != nil)
#define IF_ASPHALEIA2 if (HAS_ASPHALEIA2)
#define ASPHALEIA2_AUTHENTICATE_APP(ident, success, failure_) \
BOOL isAppProtected = [[objc_getClass("ASCommon") sharedInstance] authenticateAppWithDisplayIdentifier:ident customMessage:nil dismissedHandler:^(BOOL wasCancelled) { \
if (!wasCancelled) \
success(); \
else \
failure_(); \
}]; \
if (!isAppProtected) { \
success(); \
}