forked from khanhduytran0/FrontBoardAppLauncher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppDelegate.m
75 lines (59 loc) · 3.09 KB
/
AppDelegate.m
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
#import "AppDelegate.h"
#import "ViewController.h"
@interface UIRootSceneWindow : UIWindow
@end
@implementation UIRootSceneWindow(hook)
- (void)layoutSubviews {
[super layoutSubviews];
self.layer.backgroundColor = UIColor.clearColor.CGColor;
}
- (CGFloat)windowLevel {
return 10000;
}
@end
@implementation AppDelegate
- (instancetype)init {
self = [super init];
FBSMutableSceneDefinition *definition = [FBSMutableSceneDefinition definition];
definition.identity = [FBSSceneIdentity identityForIdentifier:NSBundle.mainBundle.bundleIdentifier];
definition.clientIdentity = [FBSSceneClientIdentity localIdentity];
definition.specification = [UIApplicationSceneSpecification specification];
FBSMutableSceneParameters *parameters = [FBSMutableSceneParameters parametersForSpecification:definition.specification];
UIMutableApplicationSceneSettings *settings = [UIMutableApplicationSceneSettings new];
settings.displayConfiguration = UIScreen.mainScreen.displayConfiguration;
settings.frame = [UIScreen.mainScreen _referenceBounds];
settings.level = 1;
settings.foreground = YES;
settings.interfaceOrientation = UIInterfaceOrientationPortrait;
settings.deviceOrientationEventsEnabled = YES;
[settings.ignoreOcclusionReasons addObject:@"SystemApp"];
parameters.settings = settings;
UIMutableApplicationSceneClientSettings *clientSettings = [UIMutableApplicationSceneClientSettings new];
clientSettings.interfaceOrientation = UIInterfaceOrientationPortrait;
clientSettings.statusBarStyle = 0;
parameters.clientSettings = clientSettings;
FBScene *scene = [[FBSceneManager sharedInstance] createSceneWithDefinition:definition initialParameters:parameters];
self.binder = [[UIRootWindowScenePresentationBinder alloc] initWithPriority:0 displayConfiguration:settings.displayConfiguration];
[self.binder addScene:scene];
return self;
}
#pragma mark - UISceneSession lifecycle
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
}
- (void)applicationWillResignActive:(UIApplication *)application {
}
@end