调整结构

This commit is contained in:
bluesea 2024-07-30 14:52:20 +08:00
parent 6652a6d330
commit 70fddc00c7
5 changed files with 43 additions and 37 deletions

View File

@ -1,7 +1,7 @@
// //
// AppDelegate.m // AppDelegate.m
#import "AppDelegate.h" #import "AppDelegate.h"
#import "AppDelegate+LuxAppDelegate.h" #import "LuxADConfigure.h"
//#import "AWM_NetManager.h" //#import "AWM_NetManager.h"
@ -33,8 +33,8 @@
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
#warning 2 #warning 2
[self checkATT]; [[LuxADConfigure shareInstance] checkATT];
[self configureADByFirebase]; [[LuxADConfigure shareInstance] configureADByFirebaseWith:self.window];
return YES; return YES;
} }

View File

@ -5,16 +5,20 @@
// Created by aaa on 2024/7/30. // Created by aaa on 2024/7/30.
// //
#import "AppDelegate.h"
#import "LuxADManager.h" #import "LuxADManager.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface AppDelegate (LuxAppDelegate) @interface LuxADConfigure:NSObject
+ (instancetype)shareInstance;
//检查idfa的att弹框 //检查idfa的att弹框
- (void)checkATT; - (void)checkATT;
#pragma mark -------配置firebase #pragma mark -------配置firebase
- (void)configureADByFirebase; - (void)configureADByFirebaseWith:(UIWindow *)window;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -5,7 +5,7 @@
// Created by aaa on 2024/7/30. // Created by aaa on 2024/7/30.
// //
#import "AppDelegate+LuxAppDelegate.h" #import "LuxADConfigure.h"
#import <objc/runtime.h> #import <objc/runtime.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h> #import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/ASIdentifierManager.h> #import <AdSupport/ASIdentifierManager.h>
@ -24,24 +24,23 @@
#import "AWM_SearchViewController.h" #import "AWM_SearchViewController.h"
#import "AWM_wallpaperViewController.h" #import "AWM_wallpaperViewController.h"
@interface AppDelegate() @interface LuxADConfigure()
@property (nonatomic,strong) NSTimer *attTimer; @property (nonatomic,strong) NSTimer *attTimer;
@end @end
#define ZH_COLOR_WITH_HEX(HEX) [UIColor colorWithRed:((HEX >> 16) & 0xFF) / 255.0f green:((HEX >> 8) & 0xFF) / 255.0f blue:((HEX) & 0xFF) / 255.0f alpha:1.0f]
@implementation LuxADConfigure
@implementation AppDelegate (LuxAppDelegate) + (instancetype)shareInstance {
static LuxADConfigure *instance = nil;
static dispatch_once_t onceToken;
- (NSString *)attTimer { dispatch_once(&onceToken, ^{
return objc_getAssociatedObject(self, @selector(attTimer)); instance = [LuxADConfigure new];
});
return instance;
} }
- (void)setAttTimer:(NSString *)attTimer {
objc_setAssociatedObject(self, @selector(attTimer), attTimer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
//idfaatt //idfaatt
- (void)checkATT{ - (void)checkATT{
if (@available(iOS 14.0,*)) { if (@available(iOS 14.0,*)) {
@ -81,12 +80,13 @@
#pragma mark -------firebase #pragma mark -------firebase
#warning GoogleService-Info.plistappfirebase #warning GoogleService-Info.plistappfirebase
- (void)configureADByFirebase { - (void)configureADByFirebaseWith:(UIWindow *)window {
[FIRApp configure]; [FIRApp configure];
if ([[LuxADManager shareInstance] isADSSMode] ) { if ([[LuxADManager shareInstance] isADSSMode] ) {
[self configureAD]; [self configureADWith:window];
} }
else {//firebase else {//firebase
__weak typeof(self)weakSelf = self;
FIRRemoteConfig *rc = [FIRRemoteConfig remoteConfig]; FIRRemoteConfig *rc = [FIRRemoteConfig remoteConfig];
FIRRemoteConfigSettings *rcs = [FIRRemoteConfigSettings new]; FIRRemoteConfigSettings *rcs = [FIRRemoteConfigSettings new];
rcs.minimumFetchInterval = 0; rcs.minimumFetchInterval = 0;
@ -99,15 +99,15 @@
BOOL isadopen = [value[@"isadopen"] boolValue]; BOOL isadopen = [value[@"isadopen"] boolValue];
NSString *version = value[@"version"]; NSString *version = value[@"version"];
if (!isadopen || ( version && [version isEqualToString:localVer])) {//ad if (!isadopen || ( version && [version isEqualToString:localVer])) {//ad
[self configureRootVC]; [weakSelf configureRootVCWith:window];
} }
else { else {
[self configureAD]; [weakSelf configureADWith:window];
} }
} }
else { else {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self configureADByFirebase]; [weakSelf configureADByFirebaseWith:window];
}); });
} }
}); });
@ -119,7 +119,7 @@
#pragma mark -----AD #pragma mark -----AD
#warning idkeymax ; ,actionBlock广 #warning idkeymax ; ,actionBlock广
- (void)configureAD { - (void)configureADWith:(UIWindow *)window {
[[LuxADManager shareInstance] addADWithInterstitialId:@"748bee67bbad21b9" actionBlock:^(UIViewController * _Nonnull vc) { [[LuxADManager shareInstance] addADWithInterstitialId:@"748bee67bbad21b9" actionBlock:^(UIViewController * _Nonnull vc) {
}];// }];//
@ -143,16 +143,18 @@
}]; }];
[[LuxADManager shareInstance] configureADWithAppLovinSDKKey:@"EG89nBMcGXrN1_U_svJiPhCMTsVu7TEkWvOGtVJUbh4x1Ds9cKJy8pzKr6LXKL7zQXbN3PLy4Q6MRl3oT3lgbX"]; [[LuxADManager shareInstance] configureADWithAppLovinSDKKey:@"EG89nBMcGXrN1_U_svJiPhCMTsVu7TEkWvOGtVJUbh4x1Ds9cKJy8pzKr6LXKL7zQXbN3PLy4Q6MRl3oT3lgbX"];
__weak typeof(self)weakSelf = self;
[[LuxADManager shareInstance] showFirstOpenAD:^(NSInteger actionType) { [[LuxADManager shareInstance] showFirstOpenAD:^(NSInteger actionType) {
[self configureRootVC]; [weakSelf configureRootVCWith:window];
} window:self.window bgImgName:@"ssa" bgColor:nil]; } window:window bgImgName:@"ssa" bgColor:nil];
} }
#pragma mark -------AVC #pragma mark -------AVC
- (void)configureRootVC { - (void)configureRootVCWith:(UIWindow *)window {
NSString *tab1 = KLS(@"tab1", @"A friendly greeting"); NSString *tab1 = KLS(@"tab1", @"A friendly greeting");
NSString *tab2 = KLS(@"tab2", @"A friendly greeting"); NSString *tab2 = KLS(@"tab2", @"A friendly greeting");
NSString *tab3 = KLS(@"tab3", @"A friendly greeting"); NSString *tab3 = KLS(@"tab3", @"A friendly greeting");
@ -177,15 +179,15 @@
UINavigationController *wpMyNV = [[UINavigationController alloc] initWithRootViewController:wpMy]; UINavigationController *wpMyNV = [[UINavigationController alloc] initWithRootViewController:wpMy];
UITabBarController *tb = [[UITabBarController alloc] init]; UITabBarController *tb = [[UITabBarController alloc] init];
tb.tabBar.backgroundColor = WP_COLOR_WITH_HEX(0xFFFFFF); tb.tabBar.backgroundColor = ZH_COLOR_WITH_HEX(0xFFFFFF);
tb.tabBar.tintColor = [UIColor orangeColor]; tb.tabBar.tintColor = [UIColor orangeColor];
UITabBarAppearance *skappearance = [[UITabBarAppearance alloc] init]; UITabBarAppearance *skappearance = [[UITabBarAppearance alloc] init];
skappearance.backgroundColor = WP_COLOR_WITH_HEX(0x6B77F2); skappearance.backgroundColor = ZH_COLOR_WITH_HEX(0x6B77F2);
tb.tabBar.standardAppearance = skappearance; tb.tabBar.standardAppearance = skappearance;
tb.viewControllers = @[wpHomeNV,wpHotNV,wpEditNV,wpMyNV]; tb.viewControllers = @[wpHomeNV,wpHotNV,wpEditNV,wpMyNV];
tb.selectedIndex = 0; tb.selectedIndex = 0;
self.window.rootViewController = tb; window.rootViewController = tb;
[self.window makeKeyAndVisible]; [window makeKeyAndVisible];
} }
@end @end

View File

@ -27,7 +27,7 @@
0004D88B2C355DF100B3E467 /* AWM_UserPravcyVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0004D88A2C355DF100B3E467 /* AWM_UserPravcyVC.m */; }; 0004D88B2C355DF100B3E467 /* AWM_UserPravcyVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0004D88A2C355DF100B3E467 /* AWM_UserPravcyVC.m */; };
0004D8932C363D5200B3E467 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8922C363D5200B3E467 /* Localizable.strings */; }; 0004D8932C363D5200B3E467 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8922C363D5200B3E467 /* Localizable.strings */; };
0004D8972C363D5800B3E467 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8962C363D5800B3E467 /* InfoPlist.strings */; }; 0004D8972C363D5800B3E467 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8962C363D5800B3E467 /* InfoPlist.strings */; };
002C2B992C5882E100A01117 /* AppDelegate+LuxAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 002C2B982C5882E100A01117 /* AppDelegate+LuxAppDelegate.m */; }; 002C2B992C5882E100A01117 /* LuxADConfigure.m in Sources */ = {isa = PBXBuildFile; fileRef = 002C2B982C5882E100A01117 /* LuxADConfigure.m */; };
00A555422C53B09F0055F452 /* LuxADVCControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A555412C53B09F0055F452 /* LuxADVCControl.m */; }; 00A555422C53B09F0055F452 /* LuxADVCControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A555412C53B09F0055F452 /* LuxADVCControl.m */; };
00C5EEC72C52404B000553BF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 00C5EEC62C52404B000553BF /* GoogleService-Info.plist */; }; 00C5EEC72C52404B000553BF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 00C5EEC62C52404B000553BF /* GoogleService-Info.plist */; };
00C5EECD2C527F71000553BF /* LuxADManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 00C5EECC2C527F71000553BF /* LuxADManager.m */; }; 00C5EECD2C527F71000553BF /* LuxADManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 00C5EECC2C527F71000553BF /* LuxADManager.m */; };
@ -91,8 +91,8 @@
0004D8912C363D5200B3E467 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; }; 0004D8912C363D5200B3E467 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
0004D8952C363D5800B3E467 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 0004D8952C363D5800B3E467 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
00218D932C4F807A00966466 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; }; 00218D932C4F807A00966466 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
002C2B972C5882E100A01117 /* AppDelegate+LuxAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+LuxAppDelegate.h"; sourceTree = "<group>"; }; 002C2B972C5882E100A01117 /* LuxADConfigure.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuxADConfigure.h; sourceTree = "<group>"; };
002C2B982C5882E100A01117 /* AppDelegate+LuxAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+LuxAppDelegate.m"; sourceTree = "<group>"; }; 002C2B982C5882E100A01117 /* LuxADConfigure.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuxADConfigure.m; sourceTree = "<group>"; };
00A555402C53B09F0055F452 /* LuxADVCControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuxADVCControl.h; sourceTree = "<group>"; }; 00A555402C53B09F0055F452 /* LuxADVCControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuxADVCControl.h; sourceTree = "<group>"; };
00A555412C53B09F0055F452 /* LuxADVCControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuxADVCControl.m; sourceTree = "<group>"; }; 00A555412C53B09F0055F452 /* LuxADVCControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuxADVCControl.m; sourceTree = "<group>"; };
00C5EEC62C52404B000553BF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; }; 00C5EEC62C52404B000553BF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
@ -210,8 +210,8 @@
00C5EED22C537155000553BF /* LuxADSuperVC.m */, 00C5EED22C537155000553BF /* LuxADSuperVC.m */,
00C5EED42C537DD7000553BF /* LuxADSSModeVC.h */, 00C5EED42C537DD7000553BF /* LuxADSSModeVC.h */,
00C5EED52C537DD7000553BF /* LuxADSSModeVC.m */, 00C5EED52C537DD7000553BF /* LuxADSSModeVC.m */,
002C2B972C5882E100A01117 /* AppDelegate+LuxAppDelegate.h */, 002C2B972C5882E100A01117 /* LuxADConfigure.h */,
002C2B982C5882E100A01117 /* AppDelegate+LuxAppDelegate.m */, 002C2B982C5882E100A01117 /* LuxADConfigure.m */,
); );
path = LuxADManager; path = LuxADManager;
sourceTree = "<group>"; sourceTree = "<group>";
@ -447,7 +447,7 @@
files = ( files = (
057AF7AE2BF1F13400078C98 /* AWM_OnePageViewController.m in Sources */, 057AF7AE2BF1F13400078C98 /* AWM_OnePageViewController.m in Sources */,
057AF7B72BF1F14900078C98 /* AWM_ForMyViewController.m in Sources */, 057AF7B72BF1F14900078C98 /* AWM_ForMyViewController.m in Sources */,
002C2B992C5882E100A01117 /* AppDelegate+LuxAppDelegate.m in Sources */, 002C2B992C5882E100A01117 /* LuxADConfigure.m in Sources */,
057AF7BA2BF1F73700078C98 /* AWM_SearchViewController.m in Sources */, 057AF7BA2BF1F73700078C98 /* AWM_SearchViewController.m in Sources */,
057AF7B12BF1F13A00078C98 /* AWM_HotViewController.m in Sources */, 057AF7B12BF1F13A00078C98 /* AWM_HotViewController.m in Sources */,
75CC6FA02C464ABF0013FB06 /* CircularProgressView.m in Sources */, 75CC6FA02C464ABF0013FB06 /* CircularProgressView.m in Sources */,