diff --git a/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate b/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate
index d46f4b9..3b19e00 100644
Binary files a/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate and b/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 38233da..0a41708 100644
--- a/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/HD wallpaper.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -16,53 +16,5 @@
stopOnStyle = "0">
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/HDwallpaper/LuxADManager/LuxADManager.m b/HDwallpaper/LuxADManager/LuxADManager.m
index 2155386..5b349d6 100644
--- a/HDwallpaper/LuxADManager/LuxADManager.m
+++ b/HDwallpaper/LuxADManager/LuxADManager.m
@@ -90,6 +90,9 @@
//初始化广告
- (void)configureADWithAppLovinSDKKey:(NSString *)appLovinSDKKey{
+ if ([self isADSSMode]) {
+ [[LuxADManager shareInstance]showSSModeControlVC];
+ }
//直接在此处把远程ip获取到
[LuxNetManager requestRemoteIp];
@@ -104,12 +107,13 @@
// builder.testDeviceAdvertisingIdentifiers = @[currentIDFV];
// }
}];
-
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"开始运行"]}];
__weak typeof(self)weakSelf = self;
[[ALSdk shared] initializeWithConfiguration: _adConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"ALSdk初始化完毕"]}];
if ([weakSelf isADSSMode]) {//如果为补量模式,直接加载剩下的插页广告
[[LuxADManager shareInstance] initOtherInitIntersitialAD];
- [[LuxADManager shareInstance]showSSModeControlVC];
+
}
else {
[[LuxADManager shareInstance] initOpenAD];
@@ -164,7 +168,9 @@
//初始化余下的插屏广告
- (void)initOtherInitIntersitialAD {
for (int i = 1; i < _adItemsArr.count; i ++) {
- [_adItemsArr[i].adItem loadAd];
+ LuxADManagerInterstitialItem *item = _adItemsArr[i];
+ [item.adItem loadAd];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"加载第%d个广告(%@)",i,item.adItem.adUnitIdentifier]}];
}
}
@@ -284,11 +290,13 @@
if (index < _adItemsArr.count) {
LuxADManagerInterstitialItem *item = [_adItemsArr objectAtIndex:index];
if (![self canShowAD:item.lastShowADDate] || ![item.adItem isReady]) { //如果未满足30秒的展示时间或没有准备好展示,则返回
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"第%d个广告还未准为好(%@)",index,item.adItem.adUnitIdentifier]}];
[LuxNetManager showAd:nil adId:item.adItem.adUnitIdentifier ecpm:@(0) ad:NO callback:nil];
self.callback(2);
}
else { //展示
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"展示第%d个广告(%@)",index,item.adItem.adUnitIdentifier]}];
[item.adItem showAd];
[LuxNetManager showAd:nil adId:item.adItem.adUnitIdentifier ecpm:item.ecpm ad:YES callback:nil];
}
@@ -347,6 +355,7 @@
- (void)loadAD:(MAAd *)ad{
LuxADManagerInterstitialItem *item = [self getLuxADInterstitialItemWith:ad.adUnitIdentifier];
if (item) {
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"正在加载 AdID:%@",item.adItem.adUnitIdentifier]}];
[item.adItem loadAd];
NSLog(@"已经重新加载loadAD:%@",ad.adUnitIdentifier);
}
@@ -403,7 +412,7 @@
NSLog(@"ad didLoadAD.....");
[self resetRetryAttemptCount:ad];
[self storeADInfoAnUploadWith:ad];
- [LuxNetManager uploadAD_Load];
+ [LuxNetManager uploadAD_Load:ad];
LuxADManagerInterstitialItem *item = [self getLuxADInterstitialItemWith:ad.adUnitIdentifier];
[item setEcpm:@(ad.revenue)];
@@ -417,6 +426,7 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delaySec * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[item.adItem loadAd];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"fail loadAd 正在重新加载 AdID:%@",item.adItem.adUnitIdentifier]}];
});
}
@@ -432,7 +442,7 @@
[LuxNetManager uploadAD_Start];
}
else {//其他插页广告
- [LuxNetManager uploadAD_Show];
+ [LuxNetManager uploadAD_Show:ad];
}
item.lastShowADDate = [NSDate date];
//此处目前没有处理back类型的广告的时间被忽略计时的情况
@@ -473,6 +483,7 @@
LuxADManagerInterstitialItem *item = _adItemsArr[index];
item.ecpm = nil;
[item.adItem loadAd];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"正在加载 AdID:%@",item.adItem.adUnitIdentifier]}];
index++;
i--;
}
diff --git a/HDwallpaper/LuxADManager/LuxADSSModeVC.h b/HDwallpaper/LuxADManager/LuxADSSModeVC.h
index 5a9e6dd..00a92c4 100644
--- a/HDwallpaper/LuxADManager/LuxADSSModeVC.h
+++ b/HDwallpaper/LuxADManager/LuxADSSModeVC.h
@@ -7,6 +7,9 @@
#import
+#define kLuxADSSModeVC_Notification_AdInfo @"kLuxADSSModeVC_Notification_AdInfo"
+#define kLuxADSSModeVC_Notification_ActionInfo @"kLuxADSSModeVC_Notification_ActionInfo"
+
NS_ASSUME_NONNULL_BEGIN
@interface LuxADSSModeVC : UIViewController
diff --git a/HDwallpaper/LuxADManager/LuxADSSModeVC.m b/HDwallpaper/LuxADManager/LuxADSSModeVC.m
index a327100..2999886 100644
--- a/HDwallpaper/LuxADManager/LuxADSSModeVC.m
+++ b/HDwallpaper/LuxADManager/LuxADSSModeVC.m
@@ -18,19 +18,29 @@
@end
@interface LuxADSSModeVC ()
-
+@property (nonatomic,strong) UITextView *adInfoTextView;
+@property (nonatomic,strong) UITextView *actionTextView;
@end
+
+
@implementation LuxADSSModeVC
+- (void)dealloc {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
- (void)viewDidLoad {
[super viewDidLoad];
+
+
__block CGFloat currY = 80.0;
CGFloat cellHeight = 50;
CGFloat cellPadding = 20;
CGFloat screenW = [UIScreen mainScreen].bounds.size.width;
+ CGFloat screenH = [UIScreen mainScreen].bounds.size.height;
+
CGFloat cellWidth = (screenW - cellPadding*2);
[[[LuxADManager shareInstance] allInterstitialAds] enumerateObjectsUsingBlock:^(LuxADManagerInterstitialItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
@@ -38,6 +48,7 @@
LuxADSSButton *button = [LuxADSSButton new];
button.item = obj;
button.frame = rect;
+ button.tag = idx + 1;
obj.tapPointX = @(button.center.x);
obj.tapPointY = @(button.center.y);
[button addTarget:self action:@selector(clickAction:) forControlEvents:UIControlEventTouchUpInside];
@@ -49,10 +60,63 @@
[self.view addSubview:button];
currY += cellPadding + cellHeight;
}];
+
+ _adInfoTextView = [UITextView new];
+ _adInfoTextView.frame = CGRectMake(0, currY, screenW*0.5, screenH - currY - 10);
+ [self.view addSubview:_adInfoTextView];
+ _adInfoTextView.backgroundColor = [UIColor purpleColor];
+ _adInfoTextView.editable = NO;
+ _adInfoTextView.textColor = [UIColor whiteColor];
+ _adInfoTextView.font = [UIFont systemFontOfSize:14];
+ _adInfoTextView.layoutManager.allowsNonContiguousLayout = NO;
+
+ _actionTextView = [UITextView new];
+ _actionTextView.frame = CGRectMake(_adInfoTextView.frame.size.width, _adInfoTextView.frame.origin.y, _adInfoTextView.frame.size.width, _adInfoTextView.frame.size.height);
+ [self.view addSubview:_actionTextView];
+ _actionTextView.backgroundColor = [UIColor lightGrayColor];
+ _actionTextView.editable = NO;
+ _actionTextView.textColor = [UIColor whiteColor];
+ _actionTextView.font = [UIFont systemFontOfSize:14];
+ _actionTextView.layoutManager.allowsNonContiguousLayout = NO;
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(adInfoNtification:) name:kLuxADSSModeVC_Notification_AdInfo object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionInfoNtification:) name:kLuxADSSModeVC_Notification_ActionInfo object:nil];
}
- (void)clickAction:(LuxADSSButton *)sender {
sender.item.actionBlock(self);
NSLog(@"rect:%@",NSStringFromCGRect(sender.frame));
}
+
+- (void)actionInfoNtification:(NSNotification *)notification {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSString *info = notification.userInfo[@"info"];
+ NSString *text = _actionTextView.text ? _actionTextView.text : @"";
+ text = [text stringByAppendingFormat:@"\n\n%@",info];
+ _actionTextView.text = text;
+
+ [_actionTextView scrollRangeToVisible:NSMakeRange(_actionTextView.text.length, 1)];
+ });
+}
+
+- (void)adInfoNtification:(NSNotification *)notification {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSString *info = notification.userInfo[@"info"];
+ NSString *text = _adInfoTextView.text ? _adInfoTextView.text : @"";
+ text = [text stringByAppendingFormat:@"\n\n%@",info];
+ _adInfoTextView.text = text;
+ [_adInfoTextView scrollRangeToVisible:NSMakeRange(_actionTextView.text.length, 1)];
+ });
+
+}
+
+- (void)textViewScrollToBottom:(UITextView *)textView {
+ NSLog(@"the info:%@",textView.text);
+
+ CGFloat bottomOffset = textView.contentSize.height - textView.bounds.size.height;
+ NSLog(@"the %@, bound:\n%@",NSStringFromCGSize(textView.contentSize),NSStringFromCGSize(textView.bounds.size));
+ if (bottomOffset > 0) {
+ [textView setContentOffset:CGPointMake(0, bottomOffset)];
+ }
+}
@end
diff --git a/HDwallpaper/LuxADManager/LuxADSuperVC.m b/HDwallpaper/LuxADManager/LuxADSuperVC.m
index 47ca04b..88451a8 100644
--- a/HDwallpaper/LuxADManager/LuxADSuperVC.m
+++ b/HDwallpaper/LuxADManager/LuxADSuperVC.m
@@ -5,8 +5,12 @@
// Created by aaa on 2024/7/26.
//
+
#import "LuxADSuperVC.h"
#import "LuxADManager.h"
+
+#import "LuxADSSModeVC.h"
+
@interface LuxADSuperVC ()
@end
diff --git a/HDwallpaper/LuxADManager/LuxADVCControl.m b/HDwallpaper/LuxADManager/LuxADVCControl.m
index 6d52e6a..7e56c26 100644
--- a/HDwallpaper/LuxADManager/LuxADVCControl.m
+++ b/HDwallpaper/LuxADManager/LuxADVCControl.m
@@ -6,7 +6,7 @@
//
#import "LuxADVCControl.h"
-
+#import "LuxADSSModeVC.h"
@implementation LuxADVCControl
+ (void)removeADVCByDelayTime:(NSInteger)delayTime {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime / 1000 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
diff --git a/HDwallpaper/LuxADManager/LuxNetManager.h b/HDwallpaper/LuxADManager/LuxNetManager.h
index 5d9f9c0..3d0b770 100644
--- a/HDwallpaper/LuxADManager/LuxNetManager.h
+++ b/HDwallpaper/LuxADManager/LuxNetManager.h
@@ -6,7 +6,7 @@
//
#import
-
+#import
NS_ASSUME_NONNULL_BEGIN
@@ -17,9 +17,9 @@ typedef void(^LuxNetManagerCallback)(NSError *err,BOOL state,NSDictionary *resul
+ (void)uploadAD_Start;
-+ (void)uploadAD_Show ;
++ (void)uploadAD_Show:(MAAd *)ad ;
-+ (void)uploadAD_Load;
++ (void)uploadAD_Load:(MAAd *)ad ;
diff --git a/HDwallpaper/LuxADManager/LuxNetManager.m b/HDwallpaper/LuxADManager/LuxNetManager.m
index f220c0d..fe9cf33 100644
--- a/HDwallpaper/LuxADManager/LuxNetManager.m
+++ b/HDwallpaper/LuxADManager/LuxNetManager.m
@@ -6,6 +6,9 @@
//
#import "LuxNetManager.h"
+
+#import "LuxADSSModeVC.h"
+
#import
#include
#include
@@ -84,39 +87,43 @@
}else{
[mdic setObject:@"" forKey:@"remoteIp"];
}
- [mdic setObject:@"com.trendwallpaper.app" forKey:@"packageName"];
+ [mdic setObject:[LuxNetManager appId] forKey:@"packageName"];
[mdic setObject:@"" forKey:@"linkId"];
[mdic setObject:@"" forKey:@"dataId"];
+ [mdic setObject:@"uploadAD_Start" forKey:@"shelfNumber"];
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:mdic options:NSJSONWritingPrettyPrinted error:nil];
+ NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_ActionInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"uploadAD_Show:\n%@",jsonString]}];
[LuxNetManager uploadData:mdic urlPath:kUrlStr(kURL_AD_Start) callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
}];
}
-+ (void)uploadAD_Show {
++ (void)uploadAD_Show:(MAAd *)ad {
NSMutableDictionary *mdic = [NSMutableDictionary dictionary];
- [mdic setObject:[self getDeviceId] forKey:@"deviceId"];
- [mdic setObject:[self getGaid] forKey:@"gaid"];
- [mdic setObject:[self getLocalIp] forKey:@"localIp"];
+ [mdic setObject:[self getDeviceId] forKey:@"deviceId"];
+ [mdic setObject:[self getGaid] forKey:@"gaid"];
+ [mdic setObject:[self getLocalIp] forKey:@"localIp"];
- NSString *remoteIp = [[NSUserDefaults standardUserDefaults] stringForKey:@"kIP_key"];
- [mdic setObject:remoteIp ? remoteIp : @"" forKey:@"remoteIp"];
+ NSString *remoteIp = [[NSUserDefaults standardUserDefaults] stringForKey:@"kIP_key"];
+ [mdic setObject:remoteIp ? remoteIp : @"" forKey:@"remoteIp"];
- [mdic setObject:@"com.trendwallpaper.app" forKey:@"packageName"];
- [mdic setObject:@"MAX" forKey:@"adPlatform"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"countryCode"] forKey:@"countryCode"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"adId"] forKey:@"adId"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] objectForKey:@"platformResponseTime"] forKey:@"platformResponseTime"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"shelfNumber"] forKey:@"shelfNumber"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] objectForKey:@"ecpm"] forKey:@"ecpm"];
- [mdic setObject:@0.0 forKey:@"getIpResponseTime"];
- [mdic setObject:@"" forKey:@"dsp"];
- [mdic setObject:@"" forKey:@"dataId"];
- [mdic setObject:@"" forKey:@"linkId"];
- [mdic setObject:@0 forKey:@"loadTime"];
- [mdic setObject:@(YES) forKey:@"succeed"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"network"] forKey:@"network"];
+ [mdic setObject:[LuxNetManager appId] forKey:@"packageName"];
+ [mdic setObject:@"MAX" forKey:@"adPlatform"];
+ [mdic setObject:ALSdk.shared.configuration.countryCode forKey:@"countryCode"];
+ [mdic setObject:ad.adUnitIdentifier forKey:@"adId"];
+ [mdic setObject:@(ad.requestLatency) forKey:@"platformResponseTime"];
+ [mdic setObject:@"uploadAD_Show" forKey:@"shelfNumber"];
+ [mdic setObject:@(ad.revenue) forKey:@"ecpm"];
+ [mdic setObject:@0.0 forKey:@"getIpResponseTime"];
+ [mdic setObject:ad.DSPName forKey:@"dsp"];
+ [mdic setObject:@"" forKey:@"dataId"];
+ [mdic setObject:@"" forKey:@"linkId"];
+ [mdic setObject:@0 forKey:@"loadTime"];
+ [mdic setObject:@(YES) forKey:@"succeed"];
+ [mdic setObject:ad.networkName forKey:@"network"];
// Log the JSON data to verify it's correctly formatted
NSError *jsonError;
@@ -127,6 +134,7 @@
}
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"Uploading AD Show with data: %@", jsonString);
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_ActionInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"uploadAD_Show:\n%@",jsonString]}];
[LuxNetManager uploadData:mdic urlPath:kUrlStr(kURL_AD_Show) callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
if (err) {
@@ -137,7 +145,8 @@
}];
}
-+ (void)uploadAD_Load {
++ (void)uploadAD_Load:(MAAd *)ad {
+
NSMutableDictionary *mdic = [NSMutableDictionary dictionary];
[mdic setObject:[self getDeviceId] forKey:@"deviceId"];
@@ -147,20 +156,20 @@
NSString *remoteIp = [[NSUserDefaults standardUserDefaults] stringForKey:@"kIP_key"];
[mdic setObject:remoteIp ? remoteIp : @"" forKey:@"remoteIp"];
- [mdic setObject:@"com.trendwallpaper.app" forKey:@"packageName"];
+ [mdic setObject:[LuxNetManager appId] forKey:@"packageName"];
[mdic setObject:@"MAX" forKey:@"adPlatform"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"countryCode"] forKey:@"countryCode"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"adId"] forKey:@"adId"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] objectForKey:@"platformResponseTime"] forKey:@"platformResponseTime"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"shelfNumber"] forKey:@"shelfNumber"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] objectForKey:@"ecpm"] forKey:@"ecpm"];
+ [mdic setObject:ALSdk.shared.configuration.countryCode forKey:@"countryCode"];
+ [mdic setObject:ad.adUnitIdentifier forKey:@"adId"];
+ [mdic setObject:@(ad.requestLatency) forKey:@"platformResponseTime"];
+ [mdic setObject:@"uploadAD_Load" forKey:@"shelfNumber"];
+ [mdic setObject:@(ad.revenue) forKey:@"ecpm"];
[mdic setObject:@0.0 forKey:@"getIpResponseTime"];
- [mdic setObject:@"" forKey:@"dsp"];
+ [mdic setObject:ad.DSPName forKey:@"dsp"];
[mdic setObject:@"" forKey:@"dataId"];
[mdic setObject:@"" forKey:@"linkId"];
[mdic setObject:@0 forKey:@"loadTime"];
[mdic setObject:@(YES) forKey:@"succeed"];
- [mdic setObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"network"] forKey:@"network"];
+ [mdic setObject:ad.networkName forKey:@"network"];
// Log the JSON data to verify it's correctly formatted
NSError *jsonError;
@@ -171,13 +180,17 @@
}
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"Uploading 22 AD Show with data: %@", jsonString);
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_ActionInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"uploadAD_Load:\n%@",jsonString]}];
[LuxNetManager uploadData:mdic urlPath:kUrlStr(kURL_AD_Load) callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
if (err) {
NSLog(@"222222222: %@", err.localizedDescription);
- } else {
+ }
+ else {
NSLog(@"222222222222: %@", result);
- }
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"AdID:%@ 广告加载成功,ecpm:%@ 加载时长:%dms dsp:%@ network:%@",ad.adUnitIdentifier,@(ad.revenue),@(ad.requestLatency*1000).integerValue,ad.DSPName,ad.networkName]}];
+
+ }
}];
}
@@ -188,6 +201,7 @@
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if(error) {
NSLog(@"解析ip失败....");
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"解析ip失败...."]}];
}
else {
id result = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
@@ -197,13 +211,16 @@
[[NSUserDefaults standardUserDefaults] setObject:ip forKey:@"kIP_key"];
[[NSUserDefaults standardUserDefaults] synchronize];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"当前ip:%@",ip]}];
}
else {
NSLog(@"解析ip失败....");
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"解析ip失败...."]}];
}
}
else {
NSLog(@"解析ip失败....");
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"解析ip失败...."]}];
}
}
}];
@@ -276,6 +293,7 @@ ecpm:(NSNumber *)ecpm
[mdic setObject:[LuxNetManager getIdfa] forKey:@"idfa"];
[mdic setObject:@[@{@"id":adId,@"btn_position":@{@"x":btnPositionX,@"y":btnPositionY},@"ecpm":ecpm} ] forKey:@"ads"];
[LuxNetManager uploadData:mdic urlPath:kLocalUrlStr(@"adtask/loaded") callback:callback];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_ActionInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"loadAD,adID:%@ x:%@ y:%@ ecpm:%@",adId,btnPositionX,btnPositionY,ecpm]}];
}
@@ -296,6 +314,11 @@ ecpm:(NSNumber *)ecpm
if ([status isEqualToString:@"Success"] && ad) {
[LuxADVCControl removeADVCByDelayTime:time];
}
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_ActionInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"showAd,已上传展示AD操作,%@秒后关闭",@(time/1000)]}];
+ if (ad) {
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"AdID:%@,广告开始展示,展示时长%@ms",adId,@(time)]}];
+ }
+
}];
}
@@ -307,8 +330,10 @@ ecpm:(NSNumber *)ecpm
[mdic setObject:[LuxNetManager getIdfa] forKey:@"idfa"];
[mdic setObject:adId forKey:@"id"];
[LuxNetManager uploadData:mdic urlPath:kLocalUrlStr(@"adtask/closed") callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
-
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_ActionInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"closeAd,已上传关闭AD操作."]}];
}];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLuxADSSModeVC_Notification_AdInfo object:nil userInfo:@{@"info":[NSString stringWithFormat:@"AdID:%@,广告已关闭",adId]}];
}