You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.9 KiB
144 lines
3.9 KiB
// |
|
// AppDelegate.m |
|
// TFReader |
|
// |
|
// Created by 谢腾飞 on 2020/11/24. |
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved. |
|
// |
|
|
|
#import "AppDelegate.h" |
|
#import "AppDelegate+TFCheckSetting.h" |
|
#import "AppDelegate+TFShortcutTouch.h" |
|
#import "AppDelegate+TFEvaluation.h" |
|
#import "AppDelegate+TFAppSign.h" |
|
#import "AppDelegate+TFAdvertising.h" |
|
#import "AppDelegate+TFStartTimes.h" |
|
#import "AppDelegate+TFPopup.h" |
|
#import "AppDelegate+TFDeviceID.h" |
|
#import "AppDelegate+TFMobService.h" |
|
#if TF_Enable_Ai |
|
#import "AppDelegate+TFAISpeech.h" |
|
#endif |
|
|
|
#import "CYLTabBarController.h" |
|
#import "TFIAPManager.h" |
|
#import "TFBookMarkModel.h" |
|
#import "TFReadRecordManager.h" |
|
#import "TFAgreementAlertView.h" |
|
|
|
@interface AppDelegate () |
|
@property (nonatomic ,copy) NSString *enterBackgroundTime; // 进入后台时间戳 |
|
|
|
@end |
|
|
|
@implementation AppDelegate |
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
|
{ |
|
[TFViewHelper setStateBarLightStyle]; |
|
|
|
if (!TFSystemInfoManager.isAgree) { |
|
TFAgreementAlertView *alert = [[TFAgreementAlertView alloc] initInController]; |
|
alert.confirmButtonClickBlock = ^{ |
|
[self firstApplication:application didFinishLaunchingWithOptions:launchOptions]; |
|
}; |
|
[alert showAlertView]; |
|
} else { |
|
[self firstApplication:application didFinishLaunchingWithOptions:launchOptions]; |
|
} |
|
|
|
// 注册设备信息 |
|
[self initDeviceInfo]; |
|
// 检查系统设置 |
|
[self initCheckSetting]; |
|
// MOB 推送 |
|
[self initMobShare]; |
|
// 3D Touch |
|
[self initShortcutTouch]; |
|
// 应用内好评 |
|
[self initAppStoreScore]; |
|
|
|
#if TF_Enable_Ai |
|
[self initAISpeech]; |
|
#endif |
|
|
|
#if TF_Super_Member_Mode || TF_Recharge_Mode |
|
// 启动IAP |
|
[[TFIAPManager sharedManager] startManager]; |
|
#endif |
|
// 签到 |
|
[self initUserSign]; |
|
|
|
return YES; |
|
} |
|
|
|
- (void)firstApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
|
{ |
|
self.tabBarControllerConfig = [[TFTabbarViewHelper alloc] init]; |
|
|
|
CYLTabBarController *tabBarController = self.tabBarControllerConfig.tabBarController; |
|
[self.window setRootViewController:tabBarController]; |
|
|
|
// 开启Mob推送 |
|
[self initMobPushWithApplication:application launchOptions:launchOptions]; |
|
|
|
// 开启广告 |
|
[self initADManager]; |
|
|
|
// 启动页 |
|
[self initLaunchADView]; |
|
[self initInsterestView]; |
|
[self updateInsterestData]; |
|
} |
|
|
|
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
|
{ |
|
[self initStartTimes]; |
|
|
|
return YES; |
|
} |
|
|
|
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options |
|
{ |
|
return YES; |
|
} |
|
|
|
- (void)applicationWillResignActive:(UIApplication *)application |
|
{ |
|
self.enterBackgroundTime = [TFUtilsHelper currentDateString]; |
|
} |
|
|
|
- (void)applicationDidEnterBackground:(UIApplication *)application {} |
|
|
|
- (void)applicationWillEnterForeground:(UIApplication *)application |
|
{ |
|
#if TF_Super_Member_Mode || TF_Recharge_Mode |
|
// 检查未完成的内购 |
|
[[TFIAPManager sharedManager] checkIAPFiles]; |
|
#endif |
|
} |
|
|
|
- (void)applicationDidBecomeActive:(UIApplication *)application |
|
{ |
|
application.applicationIconBadgeNumber = 0; |
|
|
|
NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:TF_START_PAGE]; |
|
|
|
StartPage *start_page = [StartPage modelWithJSON:data]; |
|
|
|
NSInteger enterInterval = [TFUtilsHelper getCurrentMinutesIntervalWithTimeStamp:self.enterBackgroundTime]; |
|
|
|
if (start_page.skip_type == 5 && enterInterval >= TF_Launch_Interval) { // 穿山甲开屏广告 |
|
[self initLaunchADView]; |
|
} |
|
} |
|
|
|
- (void)applicationWillTerminate:(UIApplication *)application |
|
{ |
|
/**结束IAP工具类*/ |
|
[[TFIAPManager sharedManager] stopManager]; |
|
|
|
[application endReceivingRemoteControlEvents]; |
|
} |
|
|
|
@end
|
|
|