JLChen
2021-05-18 a869383e163a18cdedcf587383c1eca043129754
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
//  Copyright © 2019 dahua. All rights reserved.
//
 
#import "AppDelegate.h"
#import "LCAccountJointViewController.h"
#import "LCLivePreviewViewController.h"
#import "LCDeviceListViewController.h"
#import "LCToolKit.h"
#import "LCUIKit.h"
#import <LCBaseModule/LCPermissionHelper.h>
#import <LCBaseModule/LCLogManager.h>
#import <LCBaseModule/DHModule.h>
#import <LCAddDeviceModule/LCAddDeviceModule-Swift.h>
 
@interface AppDelegate ()
 
@property (strong, nonatomic) LCPermissionHelper *helper;
 
@end
 
@implementation AppDelegate
 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
 
    NSString *addDeviceModule = NSStringFromClass([LCAddDeviceModule class]);
    //【*】加载模块,如果外部代码没有引用,则无法加载
    [DHModule loadModuleByNameArray:@[addDeviceModule]];
 
    [[DHUserManager shareInstance] getUserConfigFile];
    
    [LCLogManager shareInstance].maxLogSize = 10;
    [LCLogManager shareInstance].isCycle = YES;
    [[LCLogManager shareInstance] startFileLog];
    
    self.window = [[UIWindow alloc] initWithFrame:SCREEN_BOUNDS];
    [self.window makeKeyAndVisible];
 
    LCAccountJointViewController *vc = [LCAccountJointViewController new];
    LCBasicNavigationController *navi = [[LCBasicNavigationController alloc] initWithRootViewController:vc];
    self.window.rootViewController = navi;
    
    [LCNetTool lc_ObserveNetStatus:^(LCNetStatus status) {
        
    }];
    
    //权限申请
    self.helper = [LCPermissionHelper new];
    
    [LCPermissionHelper requestAlbumPermission:^(BOOL granted) {
    }];
    
    [LCPermissionHelper requestAudioPermission:^(BOOL granted) {
    }];
    
    [LCPermissionHelper requestCameraPermission:^(BOOL granted) {
    }];
    
    [self.helper requestAlwaysLocationPermissions:YES completion:^(BOOL granted) {
    }];
    
    [[DHNetWorkHelper sharedInstance] checkNetwork]; //检测网络,接口已修改为异步,不影响程序启动流程
    
    if ([self isCanExplorerForCydiaUrlScheme]) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [LCProgressHUD showMsg:@"您的手机已越狱,继续运行有风险".lc_T];
        });
    }
    
    return YES;
}
 
#pragma mark - Check Jailbreak
- (BOOL)isCanExplorerForCydiaUrlScheme {
    NSURL *url = [NSURL URLWithString:@"cydia://"];
    if ([[UIApplication sharedApplication] canOpenURL:url]) {
        NSLog(@"🍎🍎🍎 %@:: The device is jail broken!", NSStringFromClass([self class]));
        return YES;
    }
    
    return NO;
}
 
@end