添加ad完毕
This commit is contained in:
parent
39699cc3e8
commit
08042bf8b5
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
#import "AWM_AllWallpaperViewController.h"
|
||||
#import "AWM_DetailViewController.h"
|
||||
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
#import "LuxADManager.h"
|
||||
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
|
||||
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
|
||||
#define WP_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]
|
||||
@ -25,7 +25,11 @@ regulation_2 *= aspect_C;
|
||||
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
// }];
|
||||
|
||||
[[LuxADManager shareInstance] showADByRandomModeWithCallback:^(NSInteger actionType) {
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
// [self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#import "AWM_DetailViewController.h"
|
||||
#import "AppDelegate.h"
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
#import "LuxADManager.h"
|
||||
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
|
||||
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
|
||||
#define WP_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]
|
||||
@ -25,7 +25,10 @@ NSString *oriental_9 = [analytical_6 stringFromDate:[NSDate date]];
|
||||
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
// }];
|
||||
[[LuxADManager shareInstance] showADByRandomModeWithCallback:^(NSInteger actionType) {
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
// [self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
// WPSearchViewController.m
|
||||
|
||||
#import "AWM_SearchViewController.h"
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
//#import "AWM_WallPapaerADManager.h"
|
||||
//#import "AWM_WallPapaerADManager.h"
|
||||
#import "LuxADManager.h"
|
||||
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
|
||||
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
|
||||
#define WP_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]
|
||||
@ -22,7 +23,11 @@ NSString *fulfillment_N = [publication_H stringFromDate:[NSDate date]];
|
||||
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
// }];
|
||||
|
||||
[[LuxADManager shareInstance] showADByRandomModeWithCallback:^(NSInteger actionType) {
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
|
||||
@ -114,7 +119,10 @@ staircase_K *= construct_1;
|
||||
|
||||
|
||||
[textField resignFirstResponder];
|
||||
[[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Search:^(NSInteger actionType) {
|
||||
// [[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Search:^(NSInteger actionType) {
|
||||
//
|
||||
// }];
|
||||
[[LuxADManager shareInstance] showADByRandomModeWithCallback:^(NSInteger actionType) {
|
||||
|
||||
}];
|
||||
return YES;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#import "AWM_ditViewController.h"
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
#import "LuxADManager.h"
|
||||
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
|
||||
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
|
||||
#define WP_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]
|
||||
@ -59,8 +60,12 @@ subject_8 *= homeostasis_2;
|
||||
|
||||
if (self.isShow) {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
|
||||
[[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Save:^(NSInteger actionType) {
|
||||
//
|
||||
// [[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Save:^(NSInteger actionType) {
|
||||
//
|
||||
// }];
|
||||
//
|
||||
[[LuxADManager shareInstance] showADByRandomModeWithCallback:^(NSInteger actionType) {
|
||||
UIImageWriteToSavedPhotosAlbum(weakSelf.showImage.image, weakSelf, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
|
||||
NSString *greeting = KLS(@"addpic", @"A friendly greeting");
|
||||
[weakSelf.addImage setImage:[UIImage imageNamed:greeting] forState:UIControlStateNormal];
|
||||
@ -68,7 +73,6 @@ subject_8 *= homeostasis_2;
|
||||
weakSelf.isShow = NO;
|
||||
}];
|
||||
|
||||
|
||||
}else{
|
||||
UIImagePickerController *imgPicker = [[UIImagePickerController alloc]init];
|
||||
imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
#import "AWM_wallpaperViewController.h"
|
||||
#import "AWM_DetailViewController.h"
|
||||
#import "AppDelegate.h"
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
//#import "AWM_WallPapaerADManager.h"
|
||||
#import "LuxADManager.h"
|
||||
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
|
||||
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
|
||||
#define WP_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]
|
||||
@ -27,7 +28,11 @@ NSString *hemophilia_i = [savant_9 stringFromDate:[NSDate date]];
|
||||
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [[AWM_WallPapaerADManager shareInstance] showIntersitialAD_Back:^(NSInteger actionType) {
|
||||
// [weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
// }];
|
||||
|
||||
[[LuxADManager shareInstance] showADByRandomModeWithCallback:^(NSInteger actionType) {
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#import "AWM_ditViewController.h"
|
||||
#import "AWM_ForMyViewController.h"
|
||||
|
||||
#import "AWM_WallPapaerADManager.h"
|
||||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||||
#import <AdSupport/ASIdentifierManager.h>
|
||||
#import "AWM_NetManager.h"
|
||||
|
||||
@ -14,14 +14,23 @@ typedef void(^LuxADManagerCallback)(NSInteger actionType);//actionType,1表示
|
||||
typedef void (^LuxADManagerActionBlock)(UIViewController *vc);//用于补量模式的跳转vc 的action
|
||||
|
||||
#pragma mark ------LuxADManagerItem
|
||||
|
||||
@protocol LuxADManagerInterstitialItemDelegate <NSObject>
|
||||
|
||||
- (void)needLoadADWithNum:(NSInteger)num;
|
||||
|
||||
@end
|
||||
@interface LuxADManagerInterstitialItem : NSObject
|
||||
@property (nonatomic,strong) MAInterstitialAd *adItem;
|
||||
@property (nonatomic) NSInteger retryAttemptCount;
|
||||
@property (nonatomic,strong) NSDate *lastShowADDate;//ad间隔时长
|
||||
@property (nonatomic,strong) NSString *adId;
|
||||
|
||||
@property (nonatomic,weak) id<LuxADManagerInterstitialItemDelegate> delegate;
|
||||
@property (nonatomic,weak) LuxADManagerActionBlock actionBlock;//在补量模式下,跳转至目的页面
|
||||
|
||||
@property (nonatomic,strong) NSNumber *ecpm;//记录第一次load成功之后的ecpm的值
|
||||
@property (nonatomic) NSNumber *tapPointX;
|
||||
@property (nonatomic) NSNumber *tapPointY;
|
||||
+ (LuxADManagerInterstitialItem *)initWithAdId:(NSString *)adId adDelegate:(id<MAAdDelegate>)adDelegate actionBlock:(LuxADManagerActionBlock)actionBlock;
|
||||
@end
|
||||
|
||||
|
||||
@ -32,12 +32,32 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setEcpm:(NSNumber *)ecpm {
|
||||
if (_ecpm == nil) {
|
||||
_ecpm = ecpm;
|
||||
__weak typeof(self)weakSelf = self;
|
||||
NSString *currentIDFV = UIDevice.currentDevice.identifierForVendor.UUIDString;
|
||||
[LuxNetManager loads:currentIDFV adId:self.adItem.adUnitIdentifier btnPositionX:self.tapPointX btnPositionY:self.tapPointY ecpm:ecpm callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
if (state) {
|
||||
NSString *status = result[@"status"];
|
||||
NSInteger needload = [result[@"needload"] integerValue];
|
||||
if ([status isEqualToString:@"Success"] && needload > 0) {
|
||||
if (weakSelf && weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(needLoadADWithNum:)]) {
|
||||
[weakSelf.delegate needLoadADWithNum:needload];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark ------LuxADManager
|
||||
@interface LuxADManager ()<MAAdDelegate>
|
||||
@interface LuxADManager ()<MAAdDelegate,LuxADManagerInterstitialItemDelegate>
|
||||
|
||||
@property (nonatomic,strong) ALSdkInitializationConfiguration *adConfig;
|
||||
@property (nonatomic,strong) NSMutableArray <LuxADManagerInterstitialItem *>*adItemsArr;
|
||||
@ -99,6 +119,25 @@
|
||||
}];
|
||||
|
||||
[LuxNetManager uploadAD_Start];
|
||||
[self configureSecureClick];
|
||||
}
|
||||
|
||||
- (void)configureSecureClick {
|
||||
UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(secureClickAction:)];
|
||||
tgr.numberOfTapsRequired = 6;
|
||||
UIView *tapView = [[UIView alloc] init];
|
||||
tapView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 40);
|
||||
tapView.backgroundColor = [UIColor redColor];
|
||||
|
||||
[[UIApplication sharedApplication].keyWindow addSubview:tapView];
|
||||
|
||||
}
|
||||
|
||||
//秘密点击响应事件处理,连续点击6次,触发B面
|
||||
- (void)secureClickAction:(UITapGestureRecognizer *)ges {
|
||||
NSLog(@"secureClickAction.......");
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"kLuxSSFaceKey"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
//顶层window显示SS模式下的控制 VC
|
||||
@ -112,6 +151,7 @@
|
||||
//通过指定的ids数组初始化所有ad
|
||||
- (void)addADWithInterstitialId:(NSString*)adId actionBlock:(LuxADManagerActionBlock)block{
|
||||
LuxADManagerInterstitialItem *item = [LuxADManagerInterstitialItem initWithAdId:adId adDelegate:self actionBlock:block];
|
||||
item.delegate = self;
|
||||
[_adItemsArr addObject:item];
|
||||
}
|
||||
|
||||
@ -143,7 +183,6 @@
|
||||
//用于在启动app时,即第一次在appDidFinishLanuch调用开屏广告
|
||||
- (void)showFirstOpenAD:(LuxADManagerCallback)callback window:(UIWindow *)window bgImgName:(NSString *)bgImgName bgColor:(UIColor *)bgColor{
|
||||
if ([self isADSSMode]) {//补量模式,直接返回,不加载开屏
|
||||
callback(1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -248,10 +287,13 @@
|
||||
if (index < _adItemsArr.count) {
|
||||
LuxADManagerInterstitialItem *item = [_adItemsArr objectAtIndex:index];
|
||||
if (![self canShowAD:item.lastShowADDate] || ![item.adItem isReady]) { //如果未满足30秒的展示时间或没有准备好展示,则返回
|
||||
[LuxNetManager showAd:nil adId:item.adItem.adUnitIdentifier ecpm:@(0) ad:NO callback:nil];
|
||||
self.callback(1);
|
||||
|
||||
}
|
||||
else { //展示
|
||||
[item.adItem showAd];
|
||||
[LuxNetManager showAd:nil adId:item.adItem.adUnitIdentifier ecpm:item.ecpm ad:YES callback:nil];
|
||||
}
|
||||
|
||||
}
|
||||
@ -350,7 +392,8 @@
|
||||
|
||||
//判断当前是否为广告不量模式
|
||||
- (BOOL)isADSSMode{
|
||||
return NO;
|
||||
return YES;
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:@"kLuxSSFaceKey"];
|
||||
}
|
||||
|
||||
|
||||
@ -361,6 +404,9 @@
|
||||
[self resetRetryAttemptCount:ad];
|
||||
[self storeADInfoAnUploadWith:ad];
|
||||
[LuxNetManager uploadAD_Load];
|
||||
|
||||
LuxADManagerInterstitialItem *item = [self getLuxADInterstitialItemWith:ad.adUnitIdentifier];
|
||||
[item setEcpm:@(ad.revenue)];
|
||||
}
|
||||
|
||||
- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error {
|
||||
@ -408,12 +454,29 @@
|
||||
if (![self isADSSMode]) {//补量模式时,隐藏ad之后,不再主动loadAD,等通知是否隐藏
|
||||
[self loadAD:ad];
|
||||
}
|
||||
else {
|
||||
[LuxNetManager closeAd:nil adId:ad.adUnitIdentifier callback:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error{
|
||||
NSLog(@"展示广告失败....");
|
||||
[self loadAD:ad];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark ---- LuxADManagerInterstitialItemDelegate
|
||||
- (void)needLoadADWithNum:(NSInteger)num {
|
||||
NSInteger i = num;
|
||||
NSInteger index = 1;
|
||||
while (i && index < _adItemsArr.count) {
|
||||
LuxADManagerInterstitialItem *item = _adItemsArr[index];
|
||||
item.ecpm = nil;
|
||||
[item.adItem loadAd];
|
||||
index++;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
LuxADSSButton *button = [LuxADSSButton new];
|
||||
button.item = obj;
|
||||
button.frame = rect;
|
||||
obj.tapPointX = @(button.center.x);
|
||||
obj.tapPointY = @(button.center.y);
|
||||
[button addTarget:self action:@selector(clickAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[button setTitle:[NSString stringWithFormat:@"ID: %@",obj.adItem.adUnitIdentifier] forState:UIControlStateNormal];
|
||||
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
|
||||
16
HDwallpaper/LuxADManager/LuxADVCControl.h
Normal file
16
HDwallpaper/LuxADManager/LuxADVCControl.h
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// LuxADVCControl.h
|
||||
// TallPaper
|
||||
//
|
||||
// Created by aaa on 2024/7/26.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface LuxADVCControl : NSObject
|
||||
+ (void)removeADVCByDelayTime:(NSInteger)delayTime;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
31
HDwallpaper/LuxADManager/LuxADVCControl.m
Normal file
31
HDwallpaper/LuxADManager/LuxADVCControl.m
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// LuxADVCControl.m
|
||||
// TallPaper
|
||||
//
|
||||
// Created by aaa on 2024/7/26.
|
||||
//
|
||||
|
||||
#import "LuxADVCControl.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(), ^{
|
||||
[LuxADVCControl closeADWindow];
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)closeADWindow {
|
||||
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
|
||||
[keyWindow.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
UIViewController *vc = obj.subviews.firstObject.nextResponder;
|
||||
if ([vc isKindOfClass:[NSClassFromString(@"ALAppLovinVideoViewController") class]]) {
|
||||
[vc performSelector:@selector(handleCloseButton) withObject:nil];
|
||||
}
|
||||
else if ([vc isKindOfClass:[NSClassFromString(@"ALVASTVideoViewController") class]]) {
|
||||
[vc performSelector:@selector(dismiss) withObject:nil];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@ -20,5 +20,27 @@ typedef void(^LuxNetManagerCallback)(NSError *err,BOOL state,NSDictionary *resul
|
||||
+ (void)uploadAD_Show ;
|
||||
|
||||
+ (void)uploadAD_Load;
|
||||
|
||||
|
||||
|
||||
//b面交互
|
||||
+ (void)loads:(NSString *)idfa
|
||||
adId:(NSString *)adId
|
||||
btnPositionX:(NSNumber *)btnPositionX
|
||||
btnPositionY:(NSNumber *)btnPositionY
|
||||
ecpm:(NSNumber *)ecpm
|
||||
callback:(LuxNetManagerCallback)callback;
|
||||
|
||||
|
||||
+ (void)showAd:(NSString *)idfa
|
||||
adId:(NSString *)adId
|
||||
ecpm:(NSNumber *)ecpm
|
||||
ad:(BOOL)ad
|
||||
callback:(LuxNetManagerCallback)callback;
|
||||
|
||||
|
||||
+ (void)closeAd:(NSString *)idfa
|
||||
adId:(NSString *)adId
|
||||
callback:(LuxNetManagerCallback)callback;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -22,16 +22,18 @@
|
||||
#define kURL_AD_Load @"/top_selection/save_ad_load_log"
|
||||
#define kURL_AD_Show @"/top_selection/save_ad_show_log"
|
||||
|
||||
|
||||
|
||||
//local url
|
||||
#define kLocalBaseUrl @"http://127.0.0.1:6000/"
|
||||
#define kLocalUrlStr(_path) [kLocalBaseUrl stringByAppendingPathComponent:_path]
|
||||
|
||||
#import "LuxADVCControl.h"
|
||||
|
||||
@implementation LuxNetManager
|
||||
|
||||
+ (void)uploadData:(NSMutableDictionary *)mdic urlPath:(NSString *)urlPath callback:(LuxNetManagerCallback)callback {
|
||||
NSURL *url = [NSURL URLWithString:kUrlStr(urlPath)];
|
||||
if (!url) {
|
||||
NSLog(@"Invalid URL: %@", kUrlStr(urlPath));
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlPath]];
|
||||
request.HTTPMethod = @"POST";
|
||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||
NSError *jsonError;
|
||||
@ -46,14 +48,14 @@
|
||||
|
||||
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error) {
|
||||
callback(error, NO, nil);
|
||||
NSLog(@"Network error: %@", error.localizedDescription);
|
||||
} else {
|
||||
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
|
||||
NSLog(@"HTTP Status Code: %ld", (long)httpResponse.statusCode);
|
||||
if (data) {
|
||||
NSError *jsonParseError;
|
||||
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&jsonParseError];
|
||||
if (jsonParseError) {
|
||||
callback(jsonParseError, NO, nil);
|
||||
NSLog(@"Error parsing response JSON: %@", jsonParseError.localizedDescription);
|
||||
} else {
|
||||
NSLog(@"Server response: %@", result);
|
||||
@ -62,6 +64,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
callback(nil, NO, nil);
|
||||
NSLog(@"No data received");
|
||||
}
|
||||
}
|
||||
@ -84,7 +87,7 @@
|
||||
[mdic setObject:@"" forKey:@"linkId"];
|
||||
[mdic setObject:@"" forKey:@"dataId"];
|
||||
|
||||
[LuxNetManager uploadData:mdic urlPath:kURL_AD_Start callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
[LuxNetManager uploadData:mdic urlPath:kUrlStr(kURL_AD_Start) callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
|
||||
}];
|
||||
}
|
||||
@ -124,7 +127,7 @@
|
||||
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
NSLog(@"Uploading AD Show with data: %@", jsonString);
|
||||
|
||||
[LuxNetManager uploadData:mdic urlPath:kURL_AD_Show callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
[LuxNetManager uploadData:mdic urlPath:kUrlStr(kURL_AD_Show) callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
if (err) {
|
||||
NSLog(@"Error uploading AD Show: %@", err.localizedDescription);
|
||||
} else {
|
||||
@ -168,7 +171,7 @@
|
||||
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
NSLog(@"Uploading 22 AD Show with data: %@", jsonString);
|
||||
|
||||
[LuxNetManager uploadData:mdic urlPath:kURL_AD_Load callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
[LuxNetManager uploadData:mdic urlPath:kUrlStr(kURL_AD_Load) callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
if (err) {
|
||||
NSLog(@"222222222: %@", err.localizedDescription);
|
||||
} else {
|
||||
@ -260,4 +263,65 @@ NSString *apple_5 = [rebuke_5 stringFromDate:[NSDate date]];
|
||||
|
||||
|
||||
|
||||
+ (void)loads:(NSString *)idfa
|
||||
adId:(NSString *)adId
|
||||
btnPositionX:(NSNumber *)btnPositionX
|
||||
btnPositionY:(NSNumber *)btnPositionY
|
||||
ecpm:(NSNumber *)ecpm
|
||||
callback:(LuxNetManagerCallback)callback {
|
||||
|
||||
NSMutableDictionary *mdic = [NSMutableDictionary new];
|
||||
[mdic setObject:[LuxNetManager appId] forKey:@"appid" ];
|
||||
[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];
|
||||
}
|
||||
|
||||
|
||||
+ (void)showAd:(NSString *)idfa
|
||||
adId:(NSString *)adId
|
||||
ecpm:(NSNumber *)ecpm
|
||||
ad:(BOOL)ad
|
||||
callback:(LuxNetManagerCallback)callback {
|
||||
NSMutableDictionary *mdic = [NSMutableDictionary new];
|
||||
[mdic setObject:[LuxNetManager appId] forKey:@"appid" ];
|
||||
[mdic setObject:[LuxNetManager getIdfa] forKey:@"idfa"];
|
||||
[mdic setObject:ecpm forKey:@"ecpm"];
|
||||
[mdic setObject:@(ad) forKey:@"ad"];
|
||||
[mdic setObject:adId forKey:@"id"];
|
||||
[LuxNetManager uploadData:mdic urlPath:kLocalUrlStr(@"adtask/show") callback:^(NSError * _Nonnull err, BOOL state, NSDictionary * _Nonnull result) {
|
||||
NSString *status = result[@"status"];
|
||||
NSInteger time = [result[@"close"] integerValue];
|
||||
if ([status isEqualToString:@"Success"]) {
|
||||
[LuxADVCControl removeADVCByDelayTime:time];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)closeAd:(NSString *)idfa
|
||||
adId:(NSString *)adId
|
||||
callback:(LuxNetManagerCallback)callback {
|
||||
NSMutableDictionary *mdic = [NSMutableDictionary new];
|
||||
[mdic setObject:[LuxNetManager appId] forKey:@"appid" ];
|
||||
[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) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
+ (NSString *)appId {
|
||||
return [NSBundle mainBundle].bundleIdentifier;
|
||||
}
|
||||
|
||||
+ (NSString *)getIdfa {
|
||||
if ([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
|
||||
NSString *idfa = [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString];
|
||||
return idfa;
|
||||
} else {
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -79,6 +79,7 @@ NSString *paleolithic_o = [shopping_k stringFromDate:[NSDate date]];
|
||||
}
|
||||
|
||||
+ (instancetype)shareInstance {
|
||||
return nil;
|
||||
static AWM_WallPapaerADManager * instance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
0004D8932C363D5200B3E467 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8922C363D5200B3E467 /* Localizable.strings */; };
|
||||
0004D8972C363D5800B3E467 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0004D8962C363D5800B3E467 /* InfoPlist.strings */; };
|
||||
0004D89C2C36443C00B3E467 /* AWM_NetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0004D89B2C36443C00B3E467 /* AWM_NetManager.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 */; };
|
||||
00C5EED02C5355BE000553BF /* LuxNetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 00C5EECF2C5355BE000553BF /* LuxNetManager.m */; };
|
||||
@ -95,6 +96,8 @@
|
||||
0004D89A2C36443C00B3E467 /* AWM_NetManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AWM_NetManager.h; sourceTree = "<group>"; };
|
||||
0004D89B2C36443C00B3E467 /* AWM_NetManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AWM_NetManager.m; sourceTree = "<group>"; };
|
||||
00218D932C4F807A00966466 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; 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>"; };
|
||||
00C5EECB2C527F71000553BF /* LuxADManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuxADManager.h; sourceTree = "<group>"; };
|
||||
00C5EECC2C527F71000553BF /* LuxADManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuxADManager.m; sourceTree = "<group>"; };
|
||||
@ -207,6 +210,8 @@
|
||||
00C5EECC2C527F71000553BF /* LuxADManager.m */,
|
||||
00C5EECE2C5355BE000553BF /* LuxNetManager.h */,
|
||||
00C5EECF2C5355BE000553BF /* LuxNetManager.m */,
|
||||
00A555402C53B09F0055F452 /* LuxADVCControl.h */,
|
||||
00A555412C53B09F0055F452 /* LuxADVCControl.m */,
|
||||
00C5EED12C537155000553BF /* LuxADSuperVC.h */,
|
||||
00C5EED22C537155000553BF /* LuxADSuperVC.m */,
|
||||
00C5EED42C537DD7000553BF /* LuxADSSModeVC.h */,
|
||||
@ -456,6 +461,7 @@
|
||||
057AF7952BF1E86F00078C98 /* AppDelegate.m in Sources */,
|
||||
0004D89C2C36443C00B3E467 /* AWM_NetManager.m in Sources */,
|
||||
057AF7C32BF20CF700078C98 /* AWM_DetailViewController.m in Sources */,
|
||||
00A555422C53B09F0055F452 /* LuxADVCControl.m in Sources */,
|
||||
00C5EECD2C527F71000553BF /* LuxADManager.m in Sources */,
|
||||
057AF7B42BF1F14300078C98 /* AWM_ditViewController.m in Sources */,
|
||||
0004D8852C3534AC00B3E467 /* AWM_WallPapaerADManager.m in Sources */,
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
selectedDebuggerIdentifier = ""
|
||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user