Commit ccf21104 authored by Mazy's avatar Mazy

optimize ad

parent f669091d
This diff is collapsed.
...@@ -248,6 +248,11 @@ NSDictionary* appLaunchOpts; ...@@ -248,6 +248,11 @@ NSDictionary* appLaunchOpts;
GYGiftAlertView * gift = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([GYGiftAlertView class]) owner:self options:nil].firstObject; GYGiftAlertView * gift = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([GYGiftAlertView class]) owner:self options:nil].firstObject;
gift.boxModel = boxModel; gift.boxModel = boxModel;
gift.frame = [[self ufw] appController].window.bounds; gift.frame = [[self ufw] appController].window.bounds;
for (UIView *subView in [[self ufw] appController].window.subviews) {
if (subView.tag == 1024) {
return;
}
}
[[[self ufw] appController].window addSubview:gift]; [[[self ufw] appController].window addSubview:gift];
[gift show:nil]; [gift show:nil];
}); });
...@@ -327,6 +332,7 @@ NSDictionary* appLaunchOpts; ...@@ -327,6 +332,7 @@ NSDictionary* appLaunchOpts;
// 获取首页信息 // 获取首页信息
- (void)ios_getHomeInfo { - (void)ios_getHomeInfo {
[self isNetworking];
[[CGNetworkTools shared] getWithAction: getHomeInfo parameters: @{} success:^(id _Nonnull response) { [[CGNetworkTools shared] getWithAction: getHomeInfo parameters: @{} success:^(id _Nonnull response) {
if ([[response objectForKey:@"status"] integerValue] == 200) { if ([[response objectForKey:@"status"] integerValue] == 200) {
NSData *data = [NSJSONSerialization dataWithJSONObject:[[response objectForKey:@"result"] objectForKey:@"data"] options:NSJSONWritingFragmentsAllowed error:nil]; NSData *data = [NSJSONSerialization dataWithJSONObject:[[response objectForKey:@"result"] objectForKey:@"data"] options:NSJSONWritingFragmentsAllowed error:nil];
...@@ -638,9 +644,9 @@ NSDictionary* appLaunchOpts; ...@@ -638,9 +644,9 @@ NSDictionary* appLaunchOpts;
if (rewardContentList == nil){ if (rewardContentList == nil){
return; return;
} }
if (rewardContentList.count <= 0) { // if (rewardContentList.count <= 0) {
return; // return;
} // }
CGFloat totalRewardNumF = [[rewardContentList.firstObject objectForKey:@"totalRewardNum"] floatValue]; CGFloat totalRewardNumF = [[rewardContentList.firstObject objectForKey:@"totalRewardNum"] floatValue];
NSString *totalRewardNumS = [NSString stringWithFormat:@"%.2f", totalRewardNumF / 100.0]; NSString *totalRewardNumS = [NSString stringWithFormat:@"%.2f", totalRewardNumF / 100.0];
...@@ -655,7 +661,7 @@ NSDictionary* appLaunchOpts; ...@@ -655,7 +661,7 @@ NSDictionary* appLaunchOpts;
}]; }];
} else { } else {
[MBProgressHUD showError:@"抱歉, 请重试"]; // [MBProgressHUD showError:@"抱歉, 请重试"];
} }
}]; }];
} }
...@@ -810,12 +816,14 @@ NSDictionary* appLaunchOpts; ...@@ -810,12 +816,14 @@ NSDictionary* appLaunchOpts;
} }
- (void)applicationWillResignActive:(UIApplication *)application { - (void)applicationWillResignActive:(UIApplication *)application {
[[[self ufw] appController] applicationWillResignActive: application]; } [[[self ufw] appController] applicationWillResignActive: application]; }
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
[[[self ufw] appController] applicationDidEnterBackground: application]; } [[[self ufw] appController] applicationDidEnterBackground: application]; }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
[[[self ufw] appController] applicationWillEnterForeground: application]; } [[[self ufw] appController] applicationWillEnterForeground: application]; }
- (void)applicationDidBecomeActive:(UIApplication *)application { - (void)applicationDidBecomeActive:(UIApplication *)application {
[[[self ufw] appController] applicationDidBecomeActive: application]; } [[[self ufw] appController] applicationDidBecomeActive: application]; }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {
[[[self ufw] appController] applicationWillTerminate: application]; } [[[self ufw] appController] applicationWillTerminate: application]; }
...@@ -878,6 +886,42 @@ NSDictionary* appLaunchOpts; ...@@ -878,6 +886,42 @@ NSDictionary* appLaunchOpts;
return nil; return nil;
} }
#pragma mark-监听网络
- (void)isNetworking
{
// 开启网络指示器
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusUnknown:
NSLog(@"未识别的网络");
break;
case AFNetworkReachabilityStatusNotReachable:
{
NSLog(@"无网络连接");
//跳转到“About”(关于本机)页面
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"无网络连接" message:@"请检查网络环境,并确认开启网络访问权限!" preferredStyle: UIAlertControllerStyleAlert];
UIAlertAction *setting = [UIAlertAction actionWithTitle:@"检查网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
}];
[alertVC addAction:setting];
[[[self ufw] appController].window.rootViewController presentViewController:alertVC animated:true completion:nil];
}
break;
case AFNetworkReachabilityStatusReachableViaWiFi:
NSLog(@"WIFI");
break;
case AFNetworkReachabilityStatusReachableViaWWAN:
NSLog(@"蜂窝移动");
break;
default:
break;
}
}];
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
}
@end @end
...@@ -48,6 +48,13 @@ ...@@ -48,6 +48,13 @@
</dict> </dict>
<key>NSUserTrackingUsageDescription</key> <key>NSUserTrackingUsageDescription</key>
<string>App需要打开您的广告追踪权限以追踪广告</string> <string>App需要打开您的广告追踪权限以追踪广告</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>58922NB4GD.skadnetwork</string>
</dict>
</array>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
...@@ -75,12 +82,5 @@ ...@@ -75,12 +82,5 @@
</array> </array>
<key>UIUserInterfaceStyle</key> <key>UIUserInterfaceStyle</key>
<string>Light</string> <string>Light</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>58922NB4GD.skadnetwork</string>
</dict>
</array>
</dict> </dict>
</plist> </plist>
...@@ -231,7 +231,7 @@ static IOSADManager * manager = nil; ...@@ -231,7 +231,7 @@ static IOSADManager * manager = nil;
self.haveLodeAD = YES; self.haveLodeAD = YES;
loadADModel.loadADType = AdType; loadADModel.loadADType = AdType;
if ([self.loadADDataArray count] > 10) { if ([self.loadADDataArray count] > 6) {
[self.loadADDataArray removeObject:self.loadADDataArray.firstObject]; [self.loadADDataArray removeObject:self.loadADDataArray.firstObject];
} }
if (AdType == ADType_Video) { if (AdType == ADType_Video) {
...@@ -244,7 +244,7 @@ static IOSADManager * manager = nil; ...@@ -244,7 +244,7 @@ static IOSADManager * manager = nil;
if ([loadADModel.adPlatform isEqualToString:@"chuanshanjia"]) { // 穿山甲 if ([loadADModel.adPlatform isEqualToString:@"chuanshanjia"]) { // 穿山甲
if ([self contentADDataWith:loadADModel]) { //有数据 if ([self contentADDataWith:loadADModel]) { //有数据
// 什么都不做或者 直接加载 // 什么都不做或者 直接加载
}else{ }else{
NSInteger time = 0.1; NSInteger time = 0.1;
if (self.csjAd == nil || self.loadADDataArray.count > 1) { if (self.csjAd == nil || self.loadADDataArray.count > 1) {
...@@ -252,24 +252,23 @@ static IOSADManager * manager = nil; ...@@ -252,24 +252,23 @@ static IOSADManager * manager = nil;
}else{ }else{
time = 5; time = 5;
} }
// 去加载
weakSelf.csjAd = nil;
AddCSJADManager * csjAd = [[AddCSJADManager alloc]init];
weakSelf.csjAd = csjAd;
[weakSelf.loadADDataArray addObject:csjAd];
csjAd.loadSuccessCallbackBlock = ^(GYAdsTrackModel * _Nonnull model, BOOL success) {
[weakSelf blockResultLoadWithData:model andSuccess:success];
};
csjAd.showSuccessCallbackBlock = ^(GYAdsTrackModel * _Nonnull model, BOOL success) {
[weakSelf blockResultShowWithData:model andSuccess:success];
};
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 去加载
weakSelf.csjAd = nil;
AddCSJADManager * csjAd = [[AddCSJADManager alloc]init];
weakSelf.csjAd = csjAd;
[weakSelf.loadADDataArray addObject:csjAd];
csjAd.loadSuccessCallbackBlock = ^(GYAdsTrackModel * _Nonnull model, BOOL success) {
[weakSelf blockResultLoadWithData:model andSuccess:success];
};
csjAd.showSuccessCallbackBlock = ^(GYAdsTrackModel * _Nonnull model, BOOL success) {
[weakSelf blockResultShowWithData:model andSuccess:success];
};
[csjAd loadAdWithData:loadADModel withADType:AdType];
}); });
[csjAd loadAdWithData:loadADModel withADType:AdType];
} }
}else if ([loadADModel.adPlatform isEqualToString:@"guangdiantong"]){ // 广点通 }else if ([loadADModel.adPlatform isEqualToString:@"guangdiantong"]){ // 广点通
if ([self contentADDataWith:loadADModel]) { //有数据 if ([self contentADDataWith:loadADModel]) { //有数据
...@@ -408,28 +407,46 @@ static IOSADManager * manager = nil; ...@@ -408,28 +407,46 @@ static IOSADManager * manager = nil;
if (self.advertisingSpace) { if (self.advertisingSpace) {
[[CGUserManager shared] addADLocCollection:self.advertisingSpace value:@"show_reward_video_ad" andADData:showData]; [[CGUserManager shared] addADLocCollection:self.advertisingSpace value:@"show_reward_video_ad" andADData:showData];
} }
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if ([showData.adPlatform isEqualToString:@"chuanshanjia"]) {
[weakSelf.csjAd showAdWithData:showData withADType:adType];
}else if ([showData.adPlatform isEqualToString:@"guangdiantong"]){
[weakSelf.gdtAd showAdWithData:showData withADType:adType];
}else if ([showData.adPlatform isEqualToString:@"sigmob"]){ if ([showData.adPlatform isEqualToString:@"chuanshanjia"]) {
[weakSelf.sigmobAd showAdWithData:showData withADType:adType]; [weakSelf.csjAd showAdWithData:showData withADType:adType];
}else if ([showData.adPlatform isEqualToString:@"guangdiantong"]){
[weakSelf.gdtAd showAdWithData:showData withADType:adType];
}else if ([showData.adPlatform isEqualToString:@"ruishi"]){ }else if ([showData.adPlatform isEqualToString:@"sigmob"]){
[weakSelf.ruishiAd showAdWithData:showData withADType:adType]; [weakSelf.sigmobAd showAdWithData:showData withADType:adType];
}
}); }else if ([showData.adPlatform isEqualToString:@"ruishi"]){
[weakSelf.ruishiAd showAdWithData:showData withADType:adType];
}
if (weakSelf.videoModels.count <= 1) { if ([showData.adPlatform isEqualToString:@"sigmob"]){
[weakSelf requestVideoAD]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
}else{ if (weakSelf.videoModels.count <= 1) {
[weakSelf requestVideoAD];
}else{
[weakSelf loadAdWithData:weakSelf.videoModels[1] withADType:ADType_Video];
}
});
[weakSelf loadAdWithData:weakSelf.videoModels[1] withADType:ADType_Video]; } else {
if (weakSelf.videoModels.count <= 1) {
[weakSelf requestVideoAD];
}else{
[weakSelf loadAdWithData:weakSelf.videoModels[1] withADType:ADType_Video];
}
} }
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// if (weakSelf.videoModels.count <= 1) {
// [weakSelf requestVideoAD];
// }else{
// [weakSelf loadAdWithData:weakSelf.videoModels[1] withADType:ADType_Video];
// }
// });
}else if (adType == ADType_BigImage){ //大图 }else if (adType == ADType_BigImage){ //大图
}else if (adType == ADType_OpenScreen){ //开屏 }else if (adType == ADType_OpenScreen){ //开屏
...@@ -655,13 +672,9 @@ static IOSADManager * manager = nil; ...@@ -655,13 +672,9 @@ static IOSADManager * manager = nil;
[weakSelf requestVideoAD]; [weakSelf requestVideoAD];
} }
} }
}else if(model.loadADType == ADType_OpenScreen){ }else if(model.loadADType == ADType_OpenScreen){
if(success){ if(success){
...@@ -707,8 +720,6 @@ static IOSADManager * manager = nil; ...@@ -707,8 +720,6 @@ static IOSADManager * manager = nil;
if(model.loadADType == ADType_Video){ if(model.loadADType == ADType_Video){
// [NSObject cancelPreviousPerformRequestsWithTarget:self]; // [NSObject cancelPreviousPerformRequestsWithTarget:self];
[weakSelf clearCache:model];
weakSelf.adShowBlock(success); weakSelf.adShowBlock(success);
...@@ -722,7 +733,8 @@ static IOSADManager * manager = nil; ...@@ -722,7 +733,8 @@ static IOSADManager * manager = nil;
} failure:^(NSError * _Nonnull error) { } failure:^(NSError * _Nonnull error) {
}]; }];
}else{ }else{
[MBProgressHUD showMessage:@"请重试"]; // [MBProgressHUD showMessage:@"请重试"];
self.showNow = YES;
[[CGUserManager shared] addLocCollection:@"reward_request" value:@"reward_display_failed"]; [[CGUserManager shared] addLocCollection:@"reward_request" value:@"reward_display_failed"];
if (self.advertisingSpace) { if (self.advertisingSpace) {
...@@ -731,6 +743,9 @@ static IOSADManager * manager = nil; ...@@ -731,6 +743,9 @@ static IOSADManager * manager = nil;
} }
} }
[weakSelf clearCache:model];
}else if(model.loadADType == ADType_OpenScreen){ }else if(model.loadADType == ADType_OpenScreen){
if (success) { if (success) {
[[CGUserManager shared] addLocCollection:@"splash_back" value:@"splash_display_success"]; [[CGUserManager shared] addLocCollection:@"splash_back" value:@"splash_display_success"];
...@@ -739,8 +754,9 @@ static IOSADManager * manager = nil; ...@@ -739,8 +754,9 @@ static IOSADManager * manager = nil;
[[CGUserManager shared] addLocCollection:@"splash_back" value:@"splash_display_failed"]; [[CGUserManager shared] addLocCollection:@"splash_back" value:@"splash_display_failed"];
} }
[weakSelf clearCache:model];
weakSelf.adShowBlock(success); weakSelf.adShowBlock(success);
[weakSelf clearCache:model];
weakSelf.showNow = NO; weakSelf.showNow = NO;
[[NSNotificationCenter defaultCenter] postNotificationName: LaunchAdSuccesShow object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName: LaunchAdSuccesShow object:nil];
...@@ -751,11 +767,10 @@ static IOSADManager * manager = nil; ...@@ -751,11 +767,10 @@ static IOSADManager * manager = nil;
}else{ }else{
[[CGUserManager shared] addLocCollection:@"native_back" value:@"native_display_failed"]; [[CGUserManager shared] addLocCollection:@"native_back" value:@"native_display_failed"];
} }
[weakSelf clearCache:model];
weakSelf.adShowBlock(success); weakSelf.adShowBlock(success);
weakSelf.showNow = NO; weakSelf.showNow = NO;
[weakSelf clearCache:model];
} }
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#import "AppDelegate.h" #import "AppDelegate.h"
@interface AddCSJADManager () @interface AddCSJADManager ()
@property (nonatomic ,retain) GYAdsTrackModel * currentData; @property (nonatomic ,retain) GYAdsTrackModel * currentData;
...@@ -25,7 +23,7 @@ ...@@ -25,7 +23,7 @@
- (void)loadAdWithData:(GYAdsTrackModel *)loadADModel withADType:(eADType)AdType{ - (void)loadAdWithData:(GYAdsTrackModel *)loadADModel withADType:(eADType)AdType{
self.currentData = loadADModel; self.currentData = loadADModel;
WEAKSELF; // WEAKSELF;
GYAdsTrackModel * model = loadADModel; GYAdsTrackModel * model = loadADModel;
if (AdType == ADType_OpenScreen) { // 开屏 if (AdType == ADType_OpenScreen) { // 开屏
CGRect frame = [UIScreen mainScreen].bounds; CGRect frame = [UIScreen mainScreen].bounds;
...@@ -45,6 +43,11 @@ ...@@ -45,6 +43,11 @@
}else if (AdType == ADType_Video){ //视频 }else if (AdType == ADType_Video){ //视频
GYAdsTrackModel * oldData = [IOSADManager shareADManager].cachevideo.firstObject;
if ([oldData.adPlatform isEqualToString: @"chuanshanjia"]) {
self.loadSuccessCallbackBlock(self.currentData, NO);
return;
}
BURewardedVideoModel * rewardedModel = [[BURewardedVideoModel alloc] init]; BURewardedVideoModel * rewardedModel = [[BURewardedVideoModel alloc] init];
rewardedModel.userId = USERID; rewardedModel.userId = USERID;
...@@ -72,15 +75,21 @@ ...@@ -72,15 +75,21 @@
/// @param showData 广告对象 /// @param showData 广告对象
/// @param adType 广告类型 /// @param adType 广告类型
- (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{ - (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{
WEAKSELF
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (adType == ADType_OpenScreen) { // 开屏 if (adType == ADType_OpenScreen) { // 开屏
}else if (adType == ADType_Video){ //视频 }else if (adType == ADType_Video){ //视频
if (self.rewardedAd.isAdValid) { if (weakSelf.rewardedAd.isAdValid) {
[self.rewardedAd showAdFromRootViewController:self.currentVC];
if ([weakSelf.rewardedAd showAdFromRootViewController: [(AppDelegate *)[UIApplication sharedApplication].delegate getTopViewController]]) {
}else{
weakSelf.showSuccessCallbackBlock(showData, NO);
}
}else{ }else{
self.showSuccessCallbackBlock(showData, NO); weakSelf.showSuccessCallbackBlock(showData, NO);
} }
}else if (adType == ADType_BigImage){ //大图 }else if (adType == ADType_BigImage){ //大图
...@@ -102,7 +111,8 @@ ...@@ -102,7 +111,8 @@
WEAKSELF; WEAKSELF;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIWindow *keyWindow = [UIApplication sharedApplication].windows.lastObject; // UIWindow *keyWindow = [UIApplication sharedApplication].windows.lastObject;
UIWindow *keyWindow = [(AppDelegate *)[UIApplication sharedApplication].delegate getMainWindow];
[keyWindow.rootViewController.view addSubview:weakSelf.splashAd_CSJ]; [keyWindow.rootViewController.view addSubview:weakSelf.splashAd_CSJ];
weakSelf.splashAd_CSJ.rootViewController = keyWindow.rootViewController; weakSelf.splashAd_CSJ.rootViewController = keyWindow.rootViewController;
}); });
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
// //
#import "AddGDTADManager.h" #import "AddGDTADManager.h"
#import "AppDelegate.h"
@interface AddGDTADManager () @interface AddGDTADManager ()
@property (nonatomic ,retain) GYAdsTrackModel * currentData; @property (nonatomic ,retain) GYAdsTrackModel * currentData;
...@@ -21,7 +23,7 @@ ...@@ -21,7 +23,7 @@
self.currentData = loadADModel; self.currentData = loadADModel;
WEAKSELF; // WEAKSELF;
GYAdsTrackModel * model = loadADModel; GYAdsTrackModel * model = loadADModel;
if (AdType == ADType_OpenScreen) { // 开屏 if (AdType == ADType_OpenScreen) { // 开屏
...@@ -46,6 +48,11 @@ ...@@ -46,6 +48,11 @@
// }); // });
}else if (AdType == ADType_Video){ //视频 }else if (AdType == ADType_Video){ //视频
GYAdsTrackModel * oldData = [IOSADManager shareADManager].cachevideo.firstObject;
if ([oldData.adPlatform isEqualToString: @"guangdiantong"]) {
self.loadSuccessCallbackBlock(self.currentData, NO);
return;
}
self.rewardVideoAd = [[GDTRewardVideoAd alloc] initWithPlacementId:model.codeId]; self.rewardVideoAd = [[GDTRewardVideoAd alloc] initWithPlacementId:model.codeId];
self.rewardVideoAd.videoMuted = NO; self.rewardVideoAd.videoMuted = NO;
...@@ -66,19 +73,26 @@ ...@@ -66,19 +73,26 @@
/// @param showData 广告对象 /// @param showData 广告对象
/// @param adType 广告类型 /// @param adType 广告类型
- (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{ - (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{
dispatch_async(dispatch_get_main_queue(), ^{ WEAKSELF
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (adType == ADType_OpenScreen) { // 开屏 if (adType == ADType_OpenScreen) { // 开屏
}else if (adType == ADType_Video){ //视频 }else if (adType == ADType_Video){ //视频
if (self.rewardVideoAd.isAdValid) { // if (weakSelf.rewardVideoAd.isAdValid && [weakSelf.rewardVideoAd eCPM] > 0) {
[self.rewardVideoAd showAdFromRootViewController:self.currentVC]; if (weakSelf.rewardVideoAd.isAdValid) {
if ([weakSelf.rewardVideoAd showAdFromRootViewController: [(AppDelegate *)[UIApplication sharedApplication].delegate getTopViewController]]) {
}else{
weakSelf.showSuccessCallbackBlock(showData, NO);
}
}else{ }else{
self.showSuccessCallbackBlock(showData, NO); weakSelf.showSuccessCallbackBlock(showData, NO);
} }
}else if (adType == ADType_BigImage){ //大图 }else if (adType == ADType_BigImage){ //大图
} }
}); });
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
- (void)loadAdWithData:(GYAdsTrackModel *)loadADModel withADType:(eADType)AdType{ - (void)loadAdWithData:(GYAdsTrackModel *)loadADModel withADType:(eADType)AdType{
self.currentData = loadADModel; self.currentData = loadADModel;
WEAKSELF; // WEAKSELF;
GYAdsTrackModel * model = loadADModel; GYAdsTrackModel * model = loadADModel;
if (AdType == ADType_OpenScreen) { // 开屏 if (AdType == ADType_OpenScreen) { // 开屏
...@@ -67,18 +67,20 @@ ...@@ -67,18 +67,20 @@
/// @param showData 广告对象 /// @param showData 广告对象
/// @param adType 广告类型 /// @param adType 广告类型
- (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{ - (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{
WEAKSELF
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (adType == ADType_OpenScreen) { // 开屏 if (adType == ADType_OpenScreen) { // 开屏
}else if (adType == ADType_Video){ //视频 }else if (adType == ADType_Video){ //视频
[self.vlnVideoAD showAdFromRootViewController:self.currentVC]; [weakSelf.vlnVideoAD showAdFromRootViewController:weakSelf.currentVC];
}else if (adType == ADType_BigImage){ //大图 }else if (adType == ADType_BigImage){ //大图
} }
}); });
} }
......
...@@ -65,20 +65,29 @@ ...@@ -65,20 +65,29 @@
/// @param adType 广告类型 /// @param adType 广告类型
- (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{ - (void)showAdWithData:(GYAdsTrackModel *)showData withADType:(eADType)adType;{
dispatch_async(dispatch_get_main_queue(), ^{ WEAKSELF
NSString * ADID = showData.codeId; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (adType == ADType_OpenScreen) { // 开屏 dispatch_async(dispatch_get_main_queue(), ^{
NSString * ADID = showData.codeId;
}else if (adType == ADType_Video){ //视频 if (adType == ADType_OpenScreen) { // 开屏
if ([[WindRewardedVideoAd sharedInstance] isReady:ADID]) {
[[WindRewardedVideoAd sharedInstance] playAd:self.currentVC withPlacementId:ADID options:@{} error:nil]; }else if (adType == ADType_Video){ //视频
}else{ if ([[WindRewardedVideoAd sharedInstance] isReady:ADID]) {
self.showSuccessCallbackBlock(showData, NO); NSError * error = nil;
[[WindRewardedVideoAd sharedInstance] playAd:weakSelf.currentVC withPlacementId:ADID options:@{} error:&error];
if (error) {
weakSelf.showSuccessCallbackBlock(showData, NO);
}
}else{
weakSelf.showSuccessCallbackBlock(showData, NO);
}
}else if (adType == ADType_BigImage){ //大图
} }
}else if (adType == ADType_BigImage){ //大图 });
}
}); });
} }
......
...@@ -522,20 +522,23 @@ ...@@ -522,20 +522,23 @@
NSLog(@"jumpWebActivity %@", dict); NSLog(@"jumpWebActivity %@", dict);
if ([dict[@"opentype"] integerValue] == 1) { if ([dict[@"opentype"] integerValue] == 1) {
// 播放视频 // 播放视频
WEAKSELF
[[IOSADManager shareADManager] showADType:ADType_Video resultBlock:^(BOOL success) { [[IOSADManager shareADManager] showADType:ADType_Video resultBlock:^(BOOL success) {
if (success) { if (success) {
[[CGUserManager shared] addLocCollection:@"play_adVideo_end_welfareTask" value:@""];
if ([dict[@"sid"] stringValue].length > 0) { if ([dict[@"sid"] stringValue].length > 0) {
[[CGNetworkTools shared] postWithAction:welfareVideoReport parameters:@{@"sid": [dict[@"sid"] stringValue]} success:^(id _Nonnull response) { [[CGNetworkTools shared] postWithAction:welfareVideoReport parameters:@{@"sid": [dict[@"sid"] stringValue]} success:^(id _Nonnull response) {
if ([[response objectForKey:@"status"] integerValue] == 200) { if ([[response objectForKey:@"status"] integerValue] == 200) {
// //
NSLog(@"welfare_video_report success"); NSLog(@"welfare_video_report success");
[weakSelf.webView reload];
} }
} failure:^(NSError * _Nonnull error) { } failure:^(NSError * _Nonnull error) {
}]; }];
} }
} else { } else {
[MBProgressHUD showError:@"抱歉, 请重试"]; // [MBProgressHUD showError:@"抱歉, 请重试"];
} }
}]; }];
} else { } else {
......
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
<key>BaiduMobAd_SDK.xcscheme_^#shared#^_</key> <key>BaiduMobAd_SDK.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>8</integer> <integer>9</integer>
</dict> </dict>
<key>Bytedance-UnionAD.xcscheme_^#shared#^_</key> <key>Bytedance-UnionAD.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>13</integer> <integer>16</integer>
</dict> </dict>
<key>GDTMobSDK.xcscheme_^#shared#^_</key> <key>GDTMobSDK.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>17</integer> <integer>7</integer>
</dict> </dict>
<key>KSAdSDK.xcscheme_^#shared#^_</key> <key>KSAdSDK.xcscheme_^#shared#^_</key>
<dict> <dict>
...@@ -41,12 +41,12 @@ ...@@ -41,12 +41,12 @@
<key>MJExtension.xcscheme_^#shared#^_</key> <key>MJExtension.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>15</integer> <integer>10</integer>
</dict> </dict>
<key>MJRefresh.xcscheme_^#shared#^_</key> <key>MJRefresh.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>7</integer> <integer>12</integer>
</dict> </dict>
<key>Masonry.xcscheme</key> <key>Masonry.xcscheme</key>
<dict> <dict>
...@@ -65,12 +65,12 @@ ...@@ -65,12 +65,12 @@
<key>RSPodKSAdaper.xcscheme_^#shared#^_</key> <key>RSPodKSAdaper.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>16</integer> <integer>8</integer>
</dict> </dict>
<key>SigmobAd-iOS.xcscheme_^#shared#^_</key> <key>SigmobAd-iOS.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>9</integer> <integer>17</integer>
</dict> </dict>
<key>SwiftyStoreKit.xcscheme</key> <key>SwiftyStoreKit.xcscheme</key>
<dict> <dict>
...@@ -82,12 +82,12 @@ ...@@ -82,12 +82,12 @@
<key>UMCCommon.xcscheme_^#shared#^_</key> <key>UMCCommon.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>10</integer> <integer>15</integer>
</dict> </dict>
<key>VLionAdSDKPoly.xcscheme_^#shared#^_</key> <key>VLionAdSDKPoly.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>14</integer> <integer>13</integer>
</dict> </dict>
<key>WechatOpenSDK.xcscheme_^#shared#^_</key> <key>WechatOpenSDK.xcscheme_^#shared#^_</key>
<dict> <dict>
......
This diff is collapsed.
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<key>UnityFramework.xcscheme_^#shared#^_</key> <key>UnityFramework.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>12</integer> <integer>14</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment