Hibit_iOS/HiBit/Basics/AppDelegate+Extesion.m
2024-06-07 17:54:29 +08:00

32 lines
1.2 KiB
Objective-C

//
// AppDelegate+Extesion.m
// HiBit
//
// Created by HI_LOSER on 2024/6/7.
//
#import "AppDelegate+Extesion.h"
#import "HBTabBarController.h"
#import "HBFirstStartController.h"
@implementation AppDelegate (Extesion)
- (void)loadWindow {
[HBNetWorkingUtility commom_deviceRegisterWithComplateBlock:nil];
BOOL notFirstStart = [NSUserDefaults boolForKey:HBNotFirstStartKey];
self.window = [[UIWindow alloc]initWithFrame:UIScreen.bounds];
self.window.backgroundColor = UIColor.redColor;
self.window.rootViewController = notFirstStart ? [HBTabBarController new] : [HBFirstStartController navigationController];
[self.window makeKeyAndVisible];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadRootController) name:HBMultiLanguageChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadRootController) name:HBFirstStartNotification object:nil];
}
- (void)reloadRootController {
BOOL notFirstStart = [NSUserDefaults boolForKey:HBNotFirstStartKey];
self.window.rootViewController = notFirstStart ? [HBTabBarController new] : [HBFirstStartController navigationController];
}
@end