Skip to content

Commit

Permalink
* 优化广告加载失败回调
Browse files Browse the repository at this point in the history
* 发布1.1.1
  • Loading branch information
gstory0404 committed May 29, 2024
1 parent e0361e5 commit 97cc525
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.1.1
* 优化广告加载失败回调

## 1.1.0
* andorid升级4.17.1
* iOS升级4.13.0
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/interstitial/SigmobInterstitialAd.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ - (void)intersititialAdDidLoad:(WindNewIntersititialAd *)intersititialAd{
*/
- (void)intersititialAdDidLoad:(WindNewIntersititialAd *)intersititialAd didFailWithError:(NSError *)error{
[[SigmobLogUtil sharedInstance] print:([NSString stringWithFormat:@"激励广告加载失败 %@",error.description])];
NSDictionary *dictionary = @{@"adType":@"interstitialAd",@"onAdMethod":@"onFail",@"message":error.description};
NSDictionary *dictionary = @{@"adType":@"interstitialAd",@"onAdMethod":@"onFail",@"message":[NSString stringWithFormat:@"%@",error]};
[[SigmobAdEvent sharedInstance] sentEvent:dictionary];
}

Expand Down
3 changes: 1 addition & 2 deletions ios/Classes/native/SigmobAdNativeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ - (void)nativeAdsManagerSuccessToLoad:(WindNativeAdsManager *)adsManager nativeA
//广告加载失败
- (void)nativeAdsManager:(WindNativeAdsManager *)adsManager didFailWithError:(NSError *)error{
[[SigmobLogUtil sharedInstance] print:([NSString stringWithFormat:@"信息流广告拉取失败 %@",error])];
NSDictionary *dictionary = @{@"message":error.description};
[_channel invokeMethod:@"onFail" arguments:dictionary result:nil];
[_channel invokeMethod:@"onFail" arguments:[NSString stringWithFormat:@"%@",error] result:nil];
}

#pragma mark - WindNativeAdViewDelegate
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/reward/SigmobRewardAd.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ - (void)rewardVideoAdDidLoad:(WindRewardVideoAd *)rewardVideoAd{
*/
- (void)rewardVideoAdDidLoad:(WindRewardVideoAd *)rewardVideoAd didFailWithError:(NSError *)error{
[[SigmobLogUtil sharedInstance] print:([NSString stringWithFormat:@"激励广告加载失败 %@",error.description])];
NSDictionary *dictionary = @{@"adType":@"rewardAd",@"onAdMethod":@"onFail",@"message":error.description};
NSDictionary *dictionary = @{@"adType":@"rewardAd",@"onAdMethod":@"onFail",@"message":[NSString stringWithFormat:@"%@",error]};
[[SigmobAdEvent sharedInstance] sentEvent:dictionary];
}

Expand Down
6 changes: 2 additions & 4 deletions ios/Classes/splash/SigmobAdSplashView.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ - (void)onSplashAdDidLoad:(WindSplashAdView *)splashAdView{
*/
-(void)onSplashAdLoadFail:(WindSplashAdView *)splashAdView error:(NSError *)error{
[[SigmobLogUtil sharedInstance] print:([NSString stringWithFormat:@"开屏广告加载失败 %@",error])];
NSDictionary *dictionary = @{@"message":error.description};
[_channel invokeMethod:@"onFail" arguments:dictionary result:nil];
[_channel invokeMethod:@"onFail" arguments:[NSString stringWithFormat:@"%@",error] result:nil];
}

/**
Expand All @@ -119,8 +118,7 @@ -(void)onSplashAdSuccessPresentScreen:(WindSplashAdView *)splashAdView{
*/
-(void)onSplashAdFailToPresent:(WindSplashAdView *)splashAdView withError:(NSError *)error{
[[SigmobLogUtil sharedInstance] print:([NSString stringWithFormat:@"开屏广告展示失败 %@",error])];
NSDictionary *dictionary = @{@"message":error.description};
[_channel invokeMethod:@"onFail" arguments:dictionary result:nil];
[_channel invokeMethod:@"onFail" arguments:[NSString stringWithFormat:@"%@",error] result:nil];
}


Expand Down
3 changes: 1 addition & 2 deletions lib/widget/sigmobad_native_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ class _KSAdNativeWidgetState extends State<SigmobAdNativeWidget> {
break;
//广告加载失败
case SigmobAdMethod.onFail:
Map map = call.arguments;
widget.callBack?.onFail!(map["message"]);
widget.callBack?.onFail!(call.arguments);
if (mounted) {
setState(() {
_isShowAd = false;
Expand Down
3 changes: 1 addition & 2 deletions lib/widget/sigmobad_splash_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ class _SigmobAdSplashWidgetState extends State<SigmobAdSplashWidget> {
//广告加载失败
case SigmobAdMethod.onFail:
if (widget.callBack?.onFail != null) {
Map map = call.arguments;
widget.callBack?.onFail!(map["message"]);
widget.callBack?.onFail!(call.arguments);
}
if (mounted) {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sigmobad
description: Sigmob广告flutter版
version: 1.1.0
version: 1.1.1
homepage: https://github.com/gstory0404/sigmobad

environment:
Expand Down

0 comments on commit 97cc525

Please sign in to comment.