Hibit_iOS/HiBit/Basics/AppDelegate+Extesion.m

31 lines
1.1 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.rootViewController = notFirstStart ? [HBTabBarController new] : [HBFirstStartController rootController];
[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 rootController];
}
@end