| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // SceneDelegateBase.m
- //
- #import "SceneDelegateBase.h"
- #import "AppDelegateBase.h"
- @implementation SceneDelegateBase
- - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
- // 系统会自动从 Main.storyboard 创建 window 和 rootViewController
- // 这里不需要手动创建
-
- // 如果需要手动创建 window(不使用 storyboard):
- // UIWindowScene *windowScene = (UIWindowScene *)scene;
- // self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
- // [self.window makeKeyAndVisible];
- }
- - (void)sceneDidDisconnect:(UIScene *)scene {
- // 场景断开连接时调用
- }
- - (void)sceneDidBecomeActive:(UIScene *)scene {
- // 场景变为活跃状态时调用
- AppDelegateBase *appDelegate = (AppDelegateBase *)[UIApplication sharedApplication].delegate;
- if(appDelegate.download_task != nil) {
- [appDelegate download_offline:true checkdiskspace:false];
- }
-
- appDelegate.forgroundDate = [NSDate date];
-
- #ifdef SCANNER_ORDER
- [RAUploadManager configureUploadManager:^(RAUPloadManagerConfigure *configure) {
- configure.autoRemoveFinish = YES;
- }];
-
- if (!RASingleton.sharedInstance.uploadManager) {
- RASingleton.sharedInstance.uploadManager = [RAUploadManager sharedManager];
- }
- #endif
- }
- - (void)sceneWillResignActive:(UIScene *)scene {
- // 场景即将变为非活跃状态时调用
- }
- - (void)sceneWillEnterForeground:(UIScene *)scene {
- // 场景即将进入前台时调用
- }
- - (void)sceneDidEnterBackground:(UIScene *)scene {
- // 场景进入后台时调用
- AppDelegateBase *appDelegate = (AppDelegateBase *)[UIApplication sharedApplication].delegate;
- [appDelegate download_offline:false checkdiskspace:false];
-
- #if defined(GOOGLE_ANALYTICS)
- NSTimeInterval timing = [[NSDate date] timeIntervalSinceDate:appDelegate.forgroundDate];
- appDelegate.forgroundDate = nil;
- [GoogleAnalyst trackTimingWithCategory:@"foreground" interval:timing name:@"user used time" label:nil];
- #endif
- }
- @end
|