VisionWallPaperOffline-8-19/HDwallpaper/AppDelegate.m
2024-07-26 21:05:13 +08:00

240 lines
10 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppDelegate.m
#import "AppDelegate.h"
#import "AWM_OnePageViewController.h"
#import "AWM_HotViewController.h"
#import "AWM_ditViewController.h"
#import "AWM_ForMyViewController.h"
#import "AWM_SearchViewController.h"
#import "AWM_wallpaperViewController.h"
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/ASIdentifierManager.h>
//#import "AWM_NetManager.h"
#import <Firebase/Firebase.h>
#import <FirebaseCore/FirebaseCore.h>
#import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
#import "LuxADManager.h"
@interface AppDelegate ()
@property (nonatomic,strong) NSTimer *attTimer;
@end
@implementation AppDelegate
//检查idfa的att弹框
- (void)checkATT{
NSInteger patently_6 = 4;
NSInteger cowardly_0 = [[NSUserDefaults standardUserDefaults] integerForKey:@"delight_j"];
cowardly_0 *= patently_6;
[[NSUserDefaults standardUserDefaults] setInteger:cowardly_0 forKey:@"delight_j"];
if (@available(iOS 14.0,*)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// 获取到权限后依然使用老方法获取idfa
if(status == ATTrackingManagerAuthorizationStatusNotDetermined) {
if(self.attTimer == nil) {
self.attTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(checkATT) userInfo:nil repeats:YES];
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
if (status != ATTrackingManagerAuthorizationStatusNotDetermined) {
NSLog(@"用户已做出选择");
[self invalidATTTimer];
}
else {
NSLog(@"用户未做出选择,可能是弹框未弹出...");
}
}];
}
}
else{
[self invalidATTTimer];
}
}];
}
}
-(void)invalidATTTimer{
NSInteger aqueduct_d = 2;
NSInteger shopworn_4 = [[NSUserDefaults standardUserDefaults] integerForKey:@"arbiter_Q"];
shopworn_4 *= aqueduct_d;
[[NSUserDefaults standardUserDefaults] setInteger:shopworn_4 forKey:@"arbiter_Q"];
if( _attTimer ){
[_attTimer invalidate];
}
_attTimer = nil;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSDateFormatter *unfasten_4 = [NSDateFormatter new];
[unfasten_4 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *noble_W = [unfasten_4 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:noble_W forKey:@"shack_k"];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
UIViewController *vc = [UIViewController new];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
[FIRApp configure];
[self checkATT];
NSLog(@">>>>>>>>>HDWall.......");
[self configureADByFirebase];
return YES;
}
- (void)configureADByFirebase {
if ([[LuxADManager shareInstance] isADSSMode] ) {
[self configureAD];
}
else {//读取firebase数据
FIRRemoteConfig *rc = [FIRRemoteConfig remoteConfig];
FIRRemoteConfigSettings *rcs = [FIRRemoteConfigSettings new];
rcs.minimumFetchInterval = 0;
rc.configSettings = rcs;
[rc fetchAndActivateWithCompletionHandler:^(FIRRemoteConfigFetchAndActivateStatus status, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (status == FIRRemoteConfigFetchAndActivateStatusSuccessFetchedFromRemote) {
NSString *localVer = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"];
NSDictionary *value = [[rc configValueForKey:@"isopen"] JSONValue];
BOOL isadopen = [value[@"isadopen"] boolValue];
NSString *version = value[@"version"];
if (!isadopen || ( version && [version isEqualToString:localVer])) {//不展示ad
[self configureRootVC];
}
else {
[self configureAD];
}
}
else {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self configureADByFirebase];
});
}
});
}];
}
}
- (void)configureAD {
[[LuxADManager shareInstance] addADWithInterstitialId:@"748bee67bbad21b9" actionBlock:^(UIViewController * _Nonnull vc) {
}];//第一个一定为开屏插页
[[LuxADManager shareInstance] addADWithInterstitialId:@"e5837c56c18ee712" actionBlock:^(UIViewController * _Nonnull vc) {
AWM_ditViewController *subvc = [AWM_ditViewController new];
subvc.adIndex = 1;
[vc.navigationController pushViewController:subvc animated:NO];
}];
[[LuxADManager shareInstance] addADWithInterstitialId:@"edf0554479388c05" actionBlock:^(UIViewController * _Nonnull vc) {
AWM_SearchViewController *subvc = [AWM_SearchViewController new];
subvc.adIndex = 2;
[vc.navigationController pushViewController:subvc animated:NO];
}];
[[LuxADManager shareInstance] addADWithInterstitialId:@"5a3cff8307e36497" actionBlock:^(UIViewController * _Nonnull vc) {
AWM_wallpaperViewController *subvc = [AWM_wallpaperViewController new];
subvc.adIndex = 3;
[vc.navigationController pushViewController:subvc animated:NO];
}];
[[LuxADManager shareInstance] configureADWithAppLovinSDKKey:@"EG89nBMcGXrN1_U_svJiPhCMTsVu7TEkWvOGtVJUbh4x1Ds9cKJy8pzKr6LXKL7zQXbN3PLy4Q6MRl3oT3lgbX"];
[[LuxADManager shareInstance] showFirstOpenAD:^(NSInteger actionType) {
[self configureRootVC];
} window:self.window bgImgName:@"ssa" bgColor:nil];
}
- (void)configureRootVC {
NSInteger alkali_F = 1;
NSInteger transmit_M = [[NSUserDefaults standardUserDefaults] integerForKey:@"acquit_8"];
transmit_M *= alkali_F;
[[NSUserDefaults standardUserDefaults] setInteger:transmit_M forKey:@"acquit_8"];
NSString *tab1 = KLS(@"tab1", @"A friendly greeting");
NSString *tab2 = KLS(@"tab2", @"A friendly greeting");
NSString *tab3 = KLS(@"tab3", @"A friendly greeting");
NSString *tab4 = KLS(@"tab4", @"A friendly greeting");
NSString *tab11 = KLS(@"tab11", @"A friendly greeting");
NSString *tab22 = KLS(@"tab22", @"A friendly greeting");
NSString *tab33 = KLS(@"tab33", @"A friendly greeting");
NSString *tab44 = KLS(@"tab44", @"A friendly greeting");
AWM_OnePageViewController *wpHome = [[AWM_OnePageViewController alloc] init];
wpHome.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[[UIImage imageNamed:tab1] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:tab11] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *wpHomeNV = [[UINavigationController alloc] initWithRootViewController:wpHome];
AWM_HotViewController *wpHot = [[AWM_HotViewController alloc] init];
wpHot.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[[UIImage imageNamed:tab2] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:tab22] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *wpHotNV = [[UINavigationController alloc] initWithRootViewController:wpHot];
AWM_ditViewController *wpEdit = [[AWM_ditViewController alloc] init];
wpEdit.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[[UIImage imageNamed:tab3] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:tab33] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *wpEditNV = [[UINavigationController alloc] initWithRootViewController:wpEdit];
AWM_ForMyViewController *wpMy = [[AWM_ForMyViewController alloc] init];
wpMy.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[[UIImage imageNamed:tab4] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:tab44] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
UINavigationController *wpMyNV = [[UINavigationController alloc] initWithRootViewController:wpMy];
UITabBarController *tb = [[UITabBarController alloc] init];
tb.tabBar.backgroundColor = WP_COLOR_WITH_HEX(0xFFFFFF);
tb.tabBar.tintColor = [UIColor orangeColor];
UITabBarAppearance *skappearance = [[UITabBarAppearance alloc] init];
skappearance.backgroundColor = WP_COLOR_WITH_HEX(0x6B77F2);
tb.tabBar.standardAppearance = skappearance;
tb.viewControllers = @[wpHomeNV,wpHotNV,wpEditNV,wpMyNV];
tb.selectedIndex = 0;
self.window.rootViewController = tb;
[self.window makeKeyAndVisible];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSDateFormatter *milkman_k = [NSDateFormatter new];
[milkman_k setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *innuendo_6 = [milkman_k stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:innuendo_6 forKey:@"moderation_T"];
[[LuxADManager shareInstance] showOpenAD];
}
- (NSMutableArray *)saveImages{
NSDateFormatter *judicial_1 = [NSDateFormatter new];
[judicial_1 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *cavalier_7 = [judicial_1 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:cavalier_7 forKey:@"occur_1"];
if (!_saveImages) {
_saveImages = [[NSMutableArray alloc] init];
}
return _saveImages;
}
@end