Commit e51b0931 authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent 45704270
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A91A7873253EE56B00F9B216"
BuildableName = "GYDemo.app"
BlueprintName = "GYDemo"
ReferencedContainer = "container:GYDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A91A788E253EE56E00F9B216"
BuildableName = "GYDemoTests.xctest"
BlueprintName = "GYDemoTests"
ReferencedContainer = "container:GYDemo.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A91A7899253EE56E00F9B216"
BuildableName = "GYDemoUITests.xctest"
BlueprintName = "GYDemoUITests"
ReferencedContainer = "container:GYDemo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A91A7873253EE56B00F9B216"
BuildableName = "GYDemo.app"
BlueprintName = "GYDemo"
ReferencedContainer = "container:GYDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A91A7873253EE56B00F9B216"
BuildableName = "GYDemo.app"
BlueprintName = "GYDemo"
ReferencedContainer = "container:GYDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
...@@ -7,7 +7,25 @@ ...@@ -7,7 +7,25 @@
<key>GYDemo.xcscheme_^#shared#^_</key> <key>GYDemo.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>11</integer> <integer>10</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>A91A7873253EE56B00F9B216</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>A91A788E253EE56E00F9B216</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>A91A7899253EE56E00F9B216</key>
<dict>
<key>primary</key>
<true/>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
...@@ -261,7 +261,7 @@ NSDictionary* appLaunchOpts; ...@@ -261,7 +261,7 @@ NSDictionary* appLaunchOpts;
// 数据埋点 // 数据埋点
- (void)ios_addGameEvent:(const char *)action event:(const char *)event { - (void)ios_addGameEvent:(const char *)action event:(const char *)event {
[MobClick event:[NSString stringWithFormat:@"%s", action] label:[NSString stringWithFormat:@"%s", event]];
} }
// ====================== 获取收据 接口回调 ====================== // ====================== 获取收据 接口回调 ======================
...@@ -439,7 +439,9 @@ NSDictionary* appLaunchOpts; ...@@ -439,7 +439,9 @@ NSDictionary* appLaunchOpts;
[[GYAdsManager shared] initWithAdsType:Video_ads window:[[self ufw] appController].window currentVC:[[self ufw] appController].window.rootViewController flowBgView:nil callBack:^(BOOL result, UIView * _Nullable flowView) { [[GYAdsManager shared] initWithAdsType:Video_ads window:[[self ufw] appController].window currentVC:[[self ufw] appController].window.rootViewController flowBgView:nil callBack:^(BOOL result, UIView * _Nullable flowView) {
if (result && flowView) { if (result && flowView) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[GYAdsManager shared] play]; [[GYAdsManager shared] play];
});
} }
if (result && !flowView) { if (result && !flowView) {
self.showVideo = NO; self.showVideo = NO;
......
...@@ -49,6 +49,12 @@ ...@@ -49,6 +49,12 @@
self.rewardedAd.delegate = self; self.rewardedAd.delegate = self;
[self.rewardedAd loadAdData]; [self.rewardedAd loadAdData];
// BURewardedVideoModel *rewardedModel = [[BURewardedVideoModel alloc] init];
// rewardedModel.userId = @"123";
// self.rewardedAd_CSJ = [[BURewardedVideoAd alloc] initWithSlotID:model.codeId rewardedVideoModel:rewardedModel];
// self.rewardedAd_CSJ.delegate = self;
// [self.rewardedAd_CSJ loadAdData];
if (self.adsFinishCallBack) { if (self.adsFinishCallBack) {
self.adsFinishCallBack(true, [UIView new]); self.adsFinishCallBack(true, [UIView new]);
} }
...@@ -76,36 +82,78 @@ ...@@ -76,36 +82,78 @@
} }
} }
- (UIViewController *)theTopviewControler{
//获取根控制器
UIViewController *rootVC = self.mainWindow.rootViewController;
UIViewController *parent = rootVC;
//遍历 如果是presentViewController
while ((parent = rootVC.presentedViewController) != nil ) {
rootVC = parent;
}
while ([rootVC isKindOfClass:[UINavigationController class]]) {
rootVC = [(UINavigationController *)rootVC topViewController];
}
return rootVC;
}
- (void)playVideo{ - (void)playVideo{
if ([self.currentAdsModel.adPlatform isEqualToString:@"chuanshanjia"]) { if ([self.currentAdsModel.adPlatform isEqualToString:@"chuanshanjia"]) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.CSJTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.CSJTimer, dispatch_walltime(NULL, 0), 1.0*NSEC_PER_SEC, 0); //每秒执行
dispatch_source_set_event_handler(self.CSJTimer, ^{
if (!self.rewardedAd.isAdValid) { // if (!self.rewardedAd.isAdValid) {
[self playVideo]; // [self playVideo];
return; // }else{
} dispatch_source_cancel(self.CSJTimer);
dispatch_async(dispatch_get_main_queue(), ^{
BOOL show = [self.rewardedAd showAdFromRootViewController:[self theTopviewControler]];
NSLog(@"%ld", show);
[self.rewardedAd showAdFromRootViewController:self.currentVC];
}); });
}else if ([self.currentAdsModel.adPlatform isEqualToString:@"guangdiantong"]){ // }
});
dispatch_resume(self.CSJTimer);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ }else if ([self.currentAdsModel.adPlatform isEqualToString:@"guangdiantong"]){
if (!self.rewardVideoAd.isAdValid) { __block int count = 0;
[self playVideo];
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.GDTTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.GDTTimer, dispatch_walltime(NULL, 0), 1.0*NSEC_PER_SEC, 0); //每秒执行
dispatch_source_set_event_handler(self.GDTTimer, ^{
// if (!self.rewardVideoAd.adValid) {
// [self playVideo];
// }else{
// if (count > 0) {
dispatch_source_cancel(self.GDTTimer);
dispatch_async(dispatch_get_main_queue(), ^{
BOOL show = [self.rewardVideoAd showAdFromRootViewController:self.currentVC];
if (!show){
self.videoIndex += 1;
[self videoPrepareModel];
return; return;
} }
[self.rewardVideoAd showAdFromRootViewController:self.currentVC];
if (self.rewardVideoAd.videoMuted) { if (self.rewardVideoAd.videoMuted) {
[[AVAudioSession sharedInstance] setActive:NO error:nil]; [[AVAudioSession sharedInstance] setActive:NO error:nil];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:nil];
} }
}); });
// }
count ++;
// }
});
dispatch_resume(self.GDTTimer);
}else if ([self.currentAdsModel.adPlatform isEqualToString:@"kuaishou"]){ }else if ([self.currentAdsModel.adPlatform isEqualToString:@"kuaishou"]){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
...@@ -120,6 +168,9 @@ ...@@ -120,6 +168,9 @@
#pragma mark CSJ #pragma mark CSJ
- (void)nativeExpressRewardedVideoAdDidLoad:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd{ - (void)nativeExpressRewardedVideoAdDidLoad:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd{
if (self.CSJTimer){
dispatch_source_cancel(self.CSJTimer);
}
// [rewardedVideoAd showAdFromRootViewController:self.currentVC]; // [rewardedVideoAd showAdFromRootViewController:self.currentVC];
[MobClick event:@"reward_display" label:@"reward_display_success"]; [MobClick event:@"reward_display" label:@"reward_display_success"];
} }
...@@ -129,6 +180,7 @@ This method is called when video ad materia failed to load. ...@@ -129,6 +180,7 @@ This method is called when video ad materia failed to load.
*/ */
- (void)nativeExpressRewardedVideoAd:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error{ - (void)nativeExpressRewardedVideoAd:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error{
[MobClick event:@"reward_display" label:@"reward_display_failed"]; [MobClick event:@"reward_display" label:@"reward_display_failed"];
dispatch_source_cancel(self.CSJTimer);
self.videoIndex += 1; self.videoIndex += 1;
[self videoPrepareModel]; [self videoPrepareModel];
} }
...@@ -162,7 +214,7 @@ This method is called when a nativeExpressAdView failed to render. ...@@ -162,7 +214,7 @@ This method is called when a nativeExpressAdView failed to render.
This method is called when video ad slot will be showing. This method is called when video ad slot will be showing.
*/ */
- (void)nativeExpressRewardedVideoAdWillVisible:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd{ - (void)nativeExpressRewardedVideoAdWillVisible:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd{
[self.rewardedAd showAdFromRootViewController:[self theTopviewControler]];
} }
/** /**
This method is called when video ad slot has been shown. This method is called when video ad slot has been shown.
...@@ -309,6 +361,8 @@ This method is called when another controller has been closed. ...@@ -309,6 +361,8 @@ This method is called when another controller has been closed.
NSLog(@"%s",__FUNCTION__); NSLog(@"%s",__FUNCTION__);
NSLog(@"eCPM:%ld eCPMLevel:%@", [rewardedVideoAd eCPM], [rewardedVideoAd eCPMLevel]); NSLog(@"eCPM:%ld eCPMLevel:%@", [rewardedVideoAd eCPM], [rewardedVideoAd eCPMLevel]);
NSLog(@"videoDuration :%lf rewardAdType:%ld", rewardedVideoAd.videoDuration, rewardedVideoAd.rewardAdType); NSLog(@"videoDuration :%lf rewardAdType:%ld", rewardedVideoAd.videoDuration, rewardedVideoAd.rewardAdType);
// dispatch_source_cancel(self.GDTTimer);
[MobClick event:@"reward_display" label:@"reward_display_success"]; [MobClick event:@"reward_display" label:@"reward_display_success"];
} }
...@@ -319,6 +373,7 @@ This method is called when another controller has been closed. ...@@ -319,6 +373,7 @@ This method is called when another controller has been closed.
- (void)gdt_rewardVideoAdWillVisible:(GDTRewardVideoAd *)rewardedVideoAd - (void)gdt_rewardVideoAdWillVisible:(GDTRewardVideoAd *)rewardedVideoAd
{ {
dispatch_source_cancel(self.GDTTimer);
NSLog(@"%s",__FUNCTION__); NSLog(@"%s",__FUNCTION__);
NSLog(@"视频播放页即将打开"); NSLog(@"视频播放页即将打开");
} }
...@@ -373,6 +428,9 @@ This method is called when another controller has been closed. ...@@ -373,6 +428,9 @@ This method is called when another controller has been closed.
NSLog(@"ERROR: %@", error); NSLog(@"ERROR: %@", error);
[MobClick event:@"reward_display" label:@"reward_display_failed"]; [MobClick event:@"reward_display" label:@"reward_display_failed"];
if (self.GDTTimer) {
dispatch_source_cancel(self.GDTTimer);
}
self.videoIndex += 1; self.videoIndex += 1;
[self videoPrepareModel]; [self videoPrepareModel];
} }
......
...@@ -26,7 +26,7 @@ typedef enum : NSUInteger { ...@@ -26,7 +26,7 @@ typedef enum : NSUInteger {
typedef void (^adsCallBack)(BOOL result, UIView * _Nullable flowView); typedef void (^adsCallBack)(BOOL result, UIView * _Nullable flowView);
@interface GYAdsManager : NSObject<BUSplashAdDelegate, GDTSplashAdDelegate, KSAdSplashInteractDelegate, BUNativeExpressAdViewDelegate, KSFeedAdsManagerDelegate, KSFeedAdDelegate, GDTNativeExpressProAdManagerDelegate, GDTNativeExpressProAdViewDelegate, BUNativeExpressRewardedVideoAdDelegate, KSRewardedVideoAdDelegate, GDTRewardedVideoAdDelegate> @interface GYAdsManager : NSObject<BUSplashAdDelegate, GDTSplashAdDelegate, KSAdSplashInteractDelegate, BUNativeExpressAdViewDelegate, KSFeedAdsManagerDelegate, KSFeedAdDelegate, GDTNativeExpressProAdManagerDelegate, GDTNativeExpressProAdViewDelegate, BUNativeExpressRewardedVideoAdDelegate, KSRewardedVideoAdDelegate, GDTRewardedVideoAdDelegate, BURewardedVideoAdDelegate>
+ (instancetype)shared; + (instancetype)shared;
...@@ -45,6 +45,9 @@ typedef void (^adsCallBack)(BOOL result, UIView * _Nullable flowView); ...@@ -45,6 +45,9 @@ typedef void (^adsCallBack)(BOOL result, UIView * _Nullable flowView);
@property (nonatomic, strong) BUSplashAdView *splashAd_CSJ; @property (nonatomic, strong) BUSplashAdView *splashAd_CSJ;
@property (nonatomic, strong) BUNativeExpressAdManager * nativeExpressAdManager; @property (nonatomic, strong) BUNativeExpressAdManager * nativeExpressAdManager;
@property (nonatomic, strong) BUNativeExpressRewardedVideoAd * rewardedAd; @property (nonatomic, strong) BUNativeExpressRewardedVideoAd * rewardedAd;
@property (nonatomic, strong) BURewardedVideoAd * rewardedAd_CSJ;
//广点通 //广点通
@property (nonatomic, strong) GDTSplashAd *splashAd_GDT; @property (nonatomic, strong) GDTSplashAd *splashAd_GDT;
@property (nonatomic, strong) GDTNativeExpressProAdManager *adManager; @property (nonatomic, strong) GDTNativeExpressProAdManager *adManager;
...@@ -62,6 +65,9 @@ typedef void (^adsCallBack)(BOOL result, UIView * _Nullable flowView); ...@@ -62,6 +65,9 @@ typedef void (^adsCallBack)(BOOL result, UIView * _Nullable flowView);
@property (nonatomic, assign) NSInteger bigImageIndex; @property (nonatomic, assign) NSInteger bigImageIndex;
@property (nonatomic, assign) NSInteger videoIndex; @property (nonatomic, assign) NSInteger videoIndex;
@property (nonatomic, strong) dispatch_source_t GDTTimer;
@property (nonatomic, strong) dispatch_source_t CSJTimer;
@property (nonatomic, copy) NSString *clk_tracking; @property (nonatomic, copy) NSString *clk_tracking;
@end @end
......
...@@ -9,63 +9,63 @@ ...@@ -9,63 +9,63 @@
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>2</integer> <integer>0</integer>
</dict> </dict>
<key>Bytedance-UnionAD.xcscheme</key> <key>Bytedance-UnionAD.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>3</integer> <integer>1</integer>
</dict> </dict>
<key>KSAdSDK.xcscheme</key> <key>KSAdSDK.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>4</integer> <integer>2</integer>
</dict> </dict>
<key>MBProgressHUD.xcscheme</key> <key>MBProgressHUD.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>6</integer> <integer>4</integer>
</dict> </dict>
<key>Masonry.xcscheme</key> <key>Masonry.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>5</integer> <integer>3</integer>
</dict> </dict>
<key>Pods-GYDemo.xcscheme</key> <key>Pods-GYDemo.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>7</integer> <integer>5</integer>
</dict> </dict>
<key>SwiftyStoreKit.xcscheme</key> <key>SwiftyStoreKit.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>8</integer> <integer>6</integer>
</dict> </dict>
<key>UMCCommon.xcscheme</key> <key>UMCCommon.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>9</integer> <integer>7</integer>
</dict> </dict>
<key>WechatOpenSDK.xcscheme</key> <key>WechatOpenSDK.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>10</integer> <integer>8</integer>
</dict> </dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Unity-iPhone.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>9</integer>
</dict>
<key>UnityFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
</dict>
</dict>
</dict>
</plist>
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