调整结构
This commit is contained in:
parent
6652a6d330
commit
70fddc00c7
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
#import "AppDelegate.h"
|
||||
#import "AppDelegate+LuxAppDelegate.h"
|
||||
#import "LuxADConfigure.h"
|
||||
//#import "AWM_NetManager.h"
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
#warning 调用以下2行配置
|
||||
[self checkATT];
|
||||
[self configureADByFirebase];
|
||||
[[LuxADConfigure shareInstance] checkATT];
|
||||
[[LuxADConfigure shareInstance] configureADByFirebaseWith:self.window];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -5,16 +5,20 @@
|
||||
// Created by aaa on 2024/7/30.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import "LuxADManager.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AppDelegate (LuxAppDelegate)
|
||||
@interface LuxADConfigure:NSObject
|
||||
|
||||
+ (instancetype)shareInstance;
|
||||
|
||||
|
||||
//检查idfa的att弹框
|
||||
- (void)checkATT;
|
||||
|
||||
#pragma mark -------配置firebase
|
||||
- (void)configureADByFirebase;
|
||||
- (void)configureADByFirebaseWith:(UIWindow *)window;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -5,7 +5,7 @@
|
||||
// Created by aaa on 2024/7/30.
|
||||
//
|
||||
|
||||
#import "AppDelegate+LuxAppDelegate.h"
|
||||
#import "LuxADConfigure.h"
|
||||
#import <objc/runtime.h>
|
||||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||||
#import <AdSupport/ASIdentifierManager.h>
|
||||
@ -24,24 +24,23 @@
|
||||
#import "AWM_SearchViewController.h"
|
||||
#import "AWM_wallpaperViewController.h"
|
||||
|
||||
@interface AppDelegate()
|
||||
@interface LuxADConfigure()
|
||||
@property (nonatomic,strong) NSTimer *attTimer;
|
||||
|
||||
@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)
|
||||
|
||||
|
||||
- (NSString *)attTimer {
|
||||
return objc_getAssociatedObject(self, @selector(attTimer));
|
||||
+ (instancetype)shareInstance {
|
||||
static LuxADConfigure *instance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [LuxADConfigure new];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (void)setAttTimer:(NSString *)attTimer {
|
||||
objc_setAssociatedObject(self, @selector(attTimer), attTimer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
|
||||
//检查idfa的att弹框
|
||||
- (void)checkATT{
|
||||
if (@available(iOS 14.0,*)) {
|
||||
@ -81,12 +80,13 @@
|
||||
|
||||
#pragma mark -------配置firebase
|
||||
#warning 记得将目录下的GoogleService-Info.plist文件替换为当前app的firebase配置
|
||||
- (void)configureADByFirebase {
|
||||
- (void)configureADByFirebaseWith:(UIWindow *)window {
|
||||
[FIRApp configure];
|
||||
if ([[LuxADManager shareInstance] isADSSMode] ) {
|
||||
[self configureAD];
|
||||
[self configureADWith:window];
|
||||
}
|
||||
else {//读取firebase数据
|
||||
__weak typeof(self)weakSelf = self;
|
||||
FIRRemoteConfig *rc = [FIRRemoteConfig remoteConfig];
|
||||
FIRRemoteConfigSettings *rcs = [FIRRemoteConfigSettings new];
|
||||
rcs.minimumFetchInterval = 0;
|
||||
@ -99,15 +99,15 @@
|
||||
BOOL isadopen = [value[@"isadopen"] boolValue];
|
||||
NSString *version = value[@"version"];
|
||||
if (!isadopen || ( version && [version isEqualToString:localVer])) {//不展示ad
|
||||
[self configureRootVC];
|
||||
[weakSelf configureRootVCWith:window];
|
||||
}
|
||||
else {
|
||||
[self configureAD];
|
||||
[weakSelf configureADWith:window];
|
||||
}
|
||||
}
|
||||
else {
|
||||
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
|
||||
#warning 请把以下的id与key替换为对应项目的max 账户信息; 同时,请将每个actionBlock中的代码改为点击每个广告需要跳转的页面
|
||||
- (void)configureAD {
|
||||
- (void)configureADWith:(UIWindow *)window {
|
||||
[[LuxADManager shareInstance] addADWithInterstitialId:@"748bee67bbad21b9" actionBlock:^(UIViewController * _Nonnull vc) {
|
||||
|
||||
}];//第一个一定为开屏插页
|
||||
@ -143,16 +143,18 @@
|
||||
}];
|
||||
|
||||
[[LuxADManager shareInstance] configureADWithAppLovinSDKKey:@"EG89nBMcGXrN1_U_svJiPhCMTsVu7TEkWvOGtVJUbh4x1Ds9cKJy8pzKr6LXKL7zQXbN3PLy4Q6MRl3oT3lgbX"];
|
||||
|
||||
__weak typeof(self)weakSelf = self;
|
||||
[[LuxADManager shareInstance] showFirstOpenAD:^(NSInteger actionType) {
|
||||
[self configureRootVC];
|
||||
} window:self.window bgImgName:@"ssa" bgColor:nil];
|
||||
[weakSelf configureRootVCWith:window];
|
||||
} window:window bgImgName:@"ssa" bgColor:nil];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -------这个地方配置A面正常的VC
|
||||
- (void)configureRootVC {
|
||||
- (void)configureRootVCWith:(UIWindow *)window {
|
||||
NSString *tab1 = KLS(@"tab1", @"A friendly greeting");
|
||||
NSString *tab2 = KLS(@"tab2", @"A friendly greeting");
|
||||
NSString *tab3 = KLS(@"tab3", @"A friendly greeting");
|
||||
@ -177,15 +179,15 @@
|
||||
UINavigationController *wpMyNV = [[UINavigationController alloc] initWithRootViewController:wpMy];
|
||||
|
||||
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];
|
||||
UITabBarAppearance *skappearance = [[UITabBarAppearance alloc] init];
|
||||
skappearance.backgroundColor = WP_COLOR_WITH_HEX(0x6B77F2);
|
||||
skappearance.backgroundColor = ZH_COLOR_WITH_HEX(0x6B77F2);
|
||||
tb.tabBar.standardAppearance = skappearance;
|
||||
|
||||
tb.viewControllers = @[wpHomeNV,wpHotNV,wpEditNV,wpMyNV];
|
||||
tb.selectedIndex = 0;
|
||||
self.window.rootViewController = tb;
|
||||
[self.window makeKeyAndVisible];
|
||||
window.rootViewController = tb;
|
||||
[window makeKeyAndVisible];
|
||||
}
|
||||
@end
|
||||
@ -27,7 +27,7 @@
|
||||
0004D88B2C355DF100B3E467 /* AWM_UserPravcyVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0004D88A2C355DF100B3E467 /* AWM_UserPravcyVC.m */; };
|
||||
0004D8932C363D5200B3E467 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8922C363D5200B3E467 /* Localizable.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 */; };
|
||||
00C5EEC72C52404B000553BF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 00C5EEC62C52404B000553BF /* GoogleService-Info.plist */; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
002C2B972C5882E100A01117 /* AppDelegate+LuxAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+LuxAppDelegate.h"; sourceTree = "<group>"; };
|
||||
002C2B982C5882E100A01117 /* AppDelegate+LuxAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+LuxAppDelegate.m"; sourceTree = "<group>"; };
|
||||
002C2B972C5882E100A01117 /* LuxADConfigure.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuxADConfigure.h; 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>"; };
|
||||
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>"; };
|
||||
@ -210,8 +210,8 @@
|
||||
00C5EED22C537155000553BF /* LuxADSuperVC.m */,
|
||||
00C5EED42C537DD7000553BF /* LuxADSSModeVC.h */,
|
||||
00C5EED52C537DD7000553BF /* LuxADSSModeVC.m */,
|
||||
002C2B972C5882E100A01117 /* AppDelegate+LuxAppDelegate.h */,
|
||||
002C2B982C5882E100A01117 /* AppDelegate+LuxAppDelegate.m */,
|
||||
002C2B972C5882E100A01117 /* LuxADConfigure.h */,
|
||||
002C2B982C5882E100A01117 /* LuxADConfigure.m */,
|
||||
);
|
||||
path = LuxADManager;
|
||||
sourceTree = "<group>";
|
||||
@ -447,7 +447,7 @@
|
||||
files = (
|
||||
057AF7AE2BF1F13400078C98 /* AWM_OnePageViewController.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 */,
|
||||
057AF7B12BF1F13A00078C98 /* AWM_HotViewController.m in Sources */,
|
||||
75CC6FA02C464ABF0013FB06 /* CircularProgressView.m in Sources */,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user