@chiyou/minigame-framework 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Framework/Adapter/AdAdapter/AbsAdAdapter.ts +14 -12
- package/src/Framework/Adapter/AdAdapter/AdAdapterBilibili.ts +11 -16
- package/src/Framework/Adapter/AdAdapter/AdAdapterDouYin.ts +19 -30
- package/src/Framework/Adapter/AdAdapter/AdAdapterHonor.ts +15 -26
- package/src/Framework/Adapter/AdAdapter/AdAdapterHuaWei.ts +13 -14
- package/src/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.ts +16 -18
- package/src/Framework/Adapter/AdAdapter/AdAdapterOppo.ts +20 -30
- package/src/Framework/Adapter/AdAdapter/AdAdapterTapTap.ts +18 -29
- package/src/Framework/Adapter/AdAdapter/AdAdapterVivo.ts +14 -20
- package/src/Framework/Adapter/AdAdapter/AdAdapterWeiXin.ts +18 -26
- package/src/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.ts +19 -24
- package/src/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.ts +12 -16
- package/src/Framework/Definition/AdDefinition.ts +5 -42
- package/src/Framework/Definition/AnalyticsDefinition.ts +1 -1
- package/src/Framework/Definition/FwkErrorDefinition.ts +3 -3
- package/src/Framework/Manager/AdMgr.ts +73 -96
- package/src/Framework/Manager/AnalyticsMgr.ts +2 -2
- package/src/Framework/Manager/LifeCycleMgr.ts +5 -2
|
@@ -65,7 +65,7 @@ class OppoInterstitialAd {
|
|
|
65
65
|
constructor(adUnitId: string, callback: Function) {
|
|
66
66
|
this.unitId = adUnitId;
|
|
67
67
|
this.ad = null;
|
|
68
|
-
this.status = InterstitialAdStatus.
|
|
68
|
+
this.status = InterstitialAdStatus.Status_New;
|
|
69
69
|
this.callback = callback;
|
|
70
70
|
this.errorListener = null;
|
|
71
71
|
this.loadListener = null;
|
|
@@ -109,7 +109,7 @@ class OppoRewardedVideoAd {
|
|
|
109
109
|
constructor(adUnitId: string, callback: Function) {
|
|
110
110
|
this.unitId = adUnitId;
|
|
111
111
|
this.ad = null;
|
|
112
|
-
this.status = RewardedVideoAdStatus.
|
|
112
|
+
this.status = RewardedVideoAdStatus.Status_New;
|
|
113
113
|
this.callback = callback;
|
|
114
114
|
this.errorListener = null;
|
|
115
115
|
this.loadListener = null;
|
|
@@ -154,6 +154,7 @@ class OppoCustomAd {
|
|
|
154
154
|
this.errorListener = null;
|
|
155
155
|
this.loadListener = null;
|
|
156
156
|
this.isFirstLoad = isFirstLoad;
|
|
157
|
+
this.isRecreating = false;
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
public destroy(): void {
|
|
@@ -470,8 +471,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
470
471
|
reason: "平台API返回null",
|
|
471
472
|
adUnitId: this.oppoInterstitialAd.unitId
|
|
472
473
|
});
|
|
473
|
-
this.oppoInterstitialAd.
|
|
474
|
-
this.oppoInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
474
|
+
this.oppoInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
477
|
|
|
@@ -479,15 +479,15 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
479
479
|
this.oppoInterstitialAd.status = InterstitialAdStatus.Status_Init;
|
|
480
480
|
|
|
481
481
|
this.oppoInterstitialAd.errorListener = (err) => {
|
|
482
|
-
LogUtils.Instance.error(AdAdapterOppo.TAG, FwkErrorCode.Oppo_Ad.
|
|
482
|
+
LogUtils.Instance.error(AdAdapterOppo.TAG, FwkErrorCode.Oppo_Ad.LoadFailed, {
|
|
483
483
|
operation: "oppoInterstitialAd.ad.onError",
|
|
484
|
-
reason: "
|
|
484
|
+
reason: "插屏广告加载失败",
|
|
485
485
|
adUnitId: this.oppoInterstitialAd.unitId,
|
|
486
486
|
error: err
|
|
487
487
|
});
|
|
488
488
|
|
|
489
489
|
if (this.oppoInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
|
|
490
|
-
this.oppoInterstitialAd.status = InterstitialAdStatus.
|
|
490
|
+
this.oppoInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
|
|
491
491
|
this.oppoInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
492
492
|
}
|
|
493
493
|
};
|
|
@@ -551,7 +551,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
551
551
|
break;
|
|
552
552
|
case InterstitialAdStatus.Status_Watched:
|
|
553
553
|
case InterstitialAdStatus.Status_Init:
|
|
554
|
-
case InterstitialAdStatus.
|
|
554
|
+
case InterstitialAdStatus.Status_LoadError:
|
|
555
555
|
this._loadInterstitialAd(true);
|
|
556
556
|
break;
|
|
557
557
|
default:
|
|
@@ -583,12 +583,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
583
583
|
this.oppoInterstitialAd.ad.load().then(() => {
|
|
584
584
|
|
|
585
585
|
}).catch((err) => {
|
|
586
|
-
|
|
587
|
-
operation: "oppoInterstitialAd.ad.load",
|
|
588
|
-
reason: "插屏广告加载失败",
|
|
589
|
-
adUnitId: this.oppoInterstitialAd.unitId,
|
|
590
|
-
error: err
|
|
591
|
-
});
|
|
586
|
+
|
|
592
587
|
});
|
|
593
588
|
}
|
|
594
589
|
|
|
@@ -640,8 +635,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
640
635
|
reason: "平台API返回null",
|
|
641
636
|
adUnitId: this.oppoRewardedVideoAd.unitId
|
|
642
637
|
});
|
|
643
|
-
this.oppoRewardedVideoAd.
|
|
644
|
-
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
|
|
638
|
+
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
|
|
645
639
|
return;
|
|
646
640
|
}
|
|
647
641
|
|
|
@@ -649,16 +643,16 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
649
643
|
this.oppoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
|
|
650
644
|
|
|
651
645
|
this.oppoRewardedVideoAd.errorListener = (err) => {
|
|
652
|
-
LogUtils.Instance.error(AdAdapterOppo.TAG, FwkErrorCode.Oppo_Ad.
|
|
646
|
+
LogUtils.Instance.error(AdAdapterOppo.TAG, FwkErrorCode.Oppo_Ad.LoadFailed, {
|
|
653
647
|
operation: "oppoRewardedVideoAd.ad.onError",
|
|
654
|
-
reason: "
|
|
648
|
+
reason: "激励视频广告加载失败",
|
|
655
649
|
adUnitId: this.oppoRewardedVideoAd.unitId,
|
|
656
650
|
error: err
|
|
657
651
|
});
|
|
658
652
|
|
|
659
653
|
if (this.oppoRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
|
|
660
|
-
this.oppoRewardedVideoAd.status = RewardedVideoAdStatus.
|
|
661
|
-
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
654
|
+
this.oppoRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
|
|
655
|
+
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
|
|
662
656
|
}
|
|
663
657
|
};
|
|
664
658
|
this.oppoRewardedVideoAd.ad.onError(this.oppoRewardedVideoAd.errorListener);
|
|
@@ -670,6 +664,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
670
664
|
});
|
|
671
665
|
|
|
672
666
|
this.oppoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
|
|
667
|
+
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
|
|
673
668
|
|
|
674
669
|
if (this.oppoRewardedVideoAd.isShowImmediately) {
|
|
675
670
|
this.oppoRewardedVideoAd.isShowImmediately = false;
|
|
@@ -689,9 +684,9 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
689
684
|
|
|
690
685
|
this.oppoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
|
|
691
686
|
if (isEnded) {
|
|
692
|
-
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
687
|
+
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
|
|
693
688
|
} else {
|
|
694
|
-
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
689
|
+
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
|
|
695
690
|
}
|
|
696
691
|
|
|
697
692
|
this.scheduleOnce(() => {
|
|
@@ -729,7 +724,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
729
724
|
break;
|
|
730
725
|
case RewardedVideoAdStatus.Status_Watched:
|
|
731
726
|
case RewardedVideoAdStatus.Status_Init:
|
|
732
|
-
case RewardedVideoAdStatus.
|
|
727
|
+
case RewardedVideoAdStatus.Status_LoadError:
|
|
733
728
|
this._loadRewardedVideoAd(true);
|
|
734
729
|
break;
|
|
735
730
|
default:
|
|
@@ -771,12 +766,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
771
766
|
this.oppoRewardedVideoAd.ad.load().then(() => {
|
|
772
767
|
|
|
773
768
|
}).catch((err) => {
|
|
774
|
-
|
|
775
|
-
operation: "oppoRewardedVideoAd.ad.load",
|
|
776
|
-
reason: "激励视频广告加载失败",
|
|
777
|
-
adUnitId: this.oppoRewardedVideoAd.unitId,
|
|
778
|
-
error: err
|
|
779
|
-
});
|
|
769
|
+
|
|
780
770
|
});
|
|
781
771
|
}
|
|
782
772
|
|
|
@@ -787,7 +777,7 @@ export class AdAdapterOppo extends AbsAdAdapter {
|
|
|
787
777
|
|
|
788
778
|
// 上无法实时触发then回调
|
|
789
779
|
this.oppoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
|
|
790
|
-
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
780
|
+
this.oppoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
|
|
791
781
|
|
|
792
782
|
this.oppoRewardedVideoAd.ad.show()
|
|
793
783
|
.then(() => {
|
|
@@ -59,7 +59,7 @@ class TAPInterstitialAd {
|
|
|
59
59
|
constructor(adUnitId: string, callback: Function) {
|
|
60
60
|
this.unitId = adUnitId;
|
|
61
61
|
this.ad = null;
|
|
62
|
-
this.status = InterstitialAdStatus.
|
|
62
|
+
this.status = InterstitialAdStatus.Status_New;
|
|
63
63
|
this.callback = callback;
|
|
64
64
|
this.errorListener = null;
|
|
65
65
|
this.loadListener = null;
|
|
@@ -103,7 +103,7 @@ class TAPRewardedVideoAd {
|
|
|
103
103
|
constructor(adUnitId: string, callback: Function) {
|
|
104
104
|
this.unitId = adUnitId;
|
|
105
105
|
this.ad = null;
|
|
106
|
-
this.status = RewardedVideoAdStatus.
|
|
106
|
+
this.status = RewardedVideoAdStatus.Status_New;
|
|
107
107
|
this.callback = callback;
|
|
108
108
|
this.errorListener = null;
|
|
109
109
|
this.loadListener = null;
|
|
@@ -365,8 +365,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
365
365
|
reason: "平台API返回null",
|
|
366
366
|
adUnitId: this.tapInterstitialAd.unitId
|
|
367
367
|
});
|
|
368
|
-
this.tapInterstitialAd.
|
|
369
|
-
this.tapInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
368
|
+
this.tapInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
|
|
370
369
|
return;
|
|
371
370
|
}
|
|
372
371
|
|
|
@@ -374,15 +373,15 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
374
373
|
this.tapInterstitialAd.status = InterstitialAdStatus.Status_Init;
|
|
375
374
|
|
|
376
375
|
this.tapInterstitialAd.errorListener = (err) => {
|
|
377
|
-
LogUtils.Instance.error(AdAdapterTapTap.TAG, FwkErrorCode.TapTap_Ad.
|
|
376
|
+
LogUtils.Instance.error(AdAdapterTapTap.TAG, FwkErrorCode.TapTap_Ad.LoadFailed, {
|
|
378
377
|
operation: "tapInterstitialAd.ad.onError",
|
|
379
|
-
reason: "插屏广告加载失败",
|
|
380
378
|
adUnitId: this.tapInterstitialAd.unitId,
|
|
379
|
+
reason: "插屏广告加载失败",
|
|
381
380
|
error: err
|
|
382
381
|
});
|
|
383
382
|
|
|
384
383
|
if (this.tapInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
|
|
385
|
-
this.tapInterstitialAd.status = InterstitialAdStatus.
|
|
384
|
+
this.tapInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
|
|
386
385
|
this.tapInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
387
386
|
}
|
|
388
387
|
};
|
|
@@ -446,7 +445,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
446
445
|
this._showInterstitialAd();
|
|
447
446
|
break;
|
|
448
447
|
case InterstitialAdStatus.Status_Watched:
|
|
449
|
-
case InterstitialAdStatus.
|
|
448
|
+
case InterstitialAdStatus.Status_LoadError:
|
|
450
449
|
case InterstitialAdStatus.Status_Init:
|
|
451
450
|
this._loadInterstitialAd(true);
|
|
452
451
|
break;
|
|
@@ -480,12 +479,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
480
479
|
this.tapInterstitialAd.ad.load().then(() => {
|
|
481
480
|
|
|
482
481
|
}).catch((err) => {
|
|
483
|
-
|
|
484
|
-
operation: "tapInterstitialAd.ad.load",
|
|
485
|
-
adUnitId: this.tapInterstitialAd.unitId,
|
|
486
|
-
reason: "插屏广告加载失败",
|
|
487
|
-
error: err
|
|
488
|
-
});
|
|
482
|
+
|
|
489
483
|
});
|
|
490
484
|
}
|
|
491
485
|
|
|
@@ -537,8 +531,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
537
531
|
reason: "平台API返回null",
|
|
538
532
|
adUnitId: this.tapRewardedVideoAd.unitId
|
|
539
533
|
});
|
|
540
|
-
this.tapRewardedVideoAd.
|
|
541
|
-
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
|
|
534
|
+
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
|
|
542
535
|
return;
|
|
543
536
|
}
|
|
544
537
|
|
|
@@ -546,7 +539,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
546
539
|
this.tapRewardedVideoAd.status = RewardedVideoAdStatus.Status_Init;
|
|
547
540
|
|
|
548
541
|
this.tapRewardedVideoAd.errorListener = (err) => {
|
|
549
|
-
LogUtils.Instance.error(AdAdapterTapTap.TAG, FwkErrorCode.TapTap_Ad.
|
|
542
|
+
LogUtils.Instance.error(AdAdapterTapTap.TAG, FwkErrorCode.TapTap_Ad.LoadFailed, {
|
|
550
543
|
operation: "tapRewardedVideoAd.ad.onError",
|
|
551
544
|
reason: "激励视频广告加载失败",
|
|
552
545
|
adUnitId: this.tapRewardedVideoAd.unitId,
|
|
@@ -554,8 +547,8 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
554
547
|
});
|
|
555
548
|
|
|
556
549
|
if (this.tapRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
|
|
557
|
-
this.tapRewardedVideoAd.status = RewardedVideoAdStatus.
|
|
558
|
-
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
550
|
+
this.tapRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
|
|
551
|
+
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
|
|
559
552
|
}
|
|
560
553
|
};
|
|
561
554
|
this.tapRewardedVideoAd.ad.onError(this.tapRewardedVideoAd.errorListener);
|
|
@@ -567,6 +560,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
567
560
|
});
|
|
568
561
|
|
|
569
562
|
this.tapRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
|
|
563
|
+
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
|
|
570
564
|
|
|
571
565
|
if (this.tapRewardedVideoAd.isShowImmediately) {
|
|
572
566
|
this.tapRewardedVideoAd.isShowImmediately = false;
|
|
@@ -586,9 +580,9 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
586
580
|
|
|
587
581
|
this.tapRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
|
|
588
582
|
if (isEnded) {
|
|
589
|
-
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
583
|
+
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
|
|
590
584
|
} else {
|
|
591
|
-
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
585
|
+
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
|
|
592
586
|
}
|
|
593
587
|
|
|
594
588
|
this.scheduleOnce(() => {
|
|
@@ -625,7 +619,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
625
619
|
this._showRewardedVideoAd();
|
|
626
620
|
break;
|
|
627
621
|
case RewardedVideoAdStatus.Status_Watched:
|
|
628
|
-
case RewardedVideoAdStatus.
|
|
622
|
+
case RewardedVideoAdStatus.Status_LoadError:
|
|
629
623
|
case RewardedVideoAdStatus.Status_Init:
|
|
630
624
|
this._loadRewardedVideoAd(true);
|
|
631
625
|
break;
|
|
@@ -668,12 +662,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
668
662
|
this.tapRewardedVideoAd.ad.load().then(() => {
|
|
669
663
|
|
|
670
664
|
}).catch((err) => {
|
|
671
|
-
|
|
672
|
-
operation: "tapRewardedVideoAd.ad.load",
|
|
673
|
-
reason: "激励视频广告加载失败",
|
|
674
|
-
adUnitId: this.tapRewardedVideoAd.unitId,
|
|
675
|
-
error: err
|
|
676
|
-
});
|
|
665
|
+
|
|
677
666
|
});
|
|
678
667
|
}
|
|
679
668
|
|
|
@@ -684,7 +673,7 @@ export class AdAdapterTapTap extends AbsAdAdapter {
|
|
|
684
673
|
|
|
685
674
|
// iOS上无法实时触发then回调
|
|
686
675
|
this.tapRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
|
|
687
|
-
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
676
|
+
this.tapRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
|
|
688
677
|
|
|
689
678
|
this.tapRewardedVideoAd.ad.show()
|
|
690
679
|
.then(() => {
|
|
@@ -66,7 +66,7 @@ class VivoInterstitialAd {
|
|
|
66
66
|
constructor(adUnitId: string, callback: Function) {
|
|
67
67
|
this.unitId = adUnitId;
|
|
68
68
|
this.ad = null;
|
|
69
|
-
this.status = InterstitialAdStatus.
|
|
69
|
+
this.status = InterstitialAdStatus.Status_New;
|
|
70
70
|
this.callback = callback;
|
|
71
71
|
this.errorListener = null;
|
|
72
72
|
this.loadListener = null;
|
|
@@ -110,7 +110,7 @@ class VivoRewardedVideoAd {
|
|
|
110
110
|
constructor(adUnitId: string, callback: Function) {
|
|
111
111
|
this.unitId = adUnitId;
|
|
112
112
|
this.ad = null;
|
|
113
|
-
this.status = RewardedVideoAdStatus.
|
|
113
|
+
this.status = RewardedVideoAdStatus.Status_New;
|
|
114
114
|
this.callback = callback;
|
|
115
115
|
this.errorListener = null;
|
|
116
116
|
this.loadListener = null;
|
|
@@ -385,8 +385,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
385
385
|
reason: "平台API返回null"
|
|
386
386
|
});
|
|
387
387
|
|
|
388
|
-
this.vivoInterstitialAd.
|
|
389
|
-
this.vivoInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
388
|
+
this.vivoInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
|
|
390
389
|
return;
|
|
391
390
|
}
|
|
392
391
|
|
|
@@ -402,7 +401,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
402
401
|
});
|
|
403
402
|
|
|
404
403
|
if (this.vivoInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
|
|
405
|
-
this.vivoInterstitialAd.status = InterstitialAdStatus.
|
|
404
|
+
this.vivoInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
|
|
406
405
|
this.vivoInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
407
406
|
}
|
|
408
407
|
};
|
|
@@ -459,7 +458,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
459
458
|
break;
|
|
460
459
|
case InterstitialAdStatus.Status_Watched:
|
|
461
460
|
case InterstitialAdStatus.Status_Init:
|
|
462
|
-
case InterstitialAdStatus.
|
|
461
|
+
case InterstitialAdStatus.Status_LoadError:
|
|
463
462
|
this.createInterstitialAd();
|
|
464
463
|
break;
|
|
465
464
|
default:
|
|
@@ -540,8 +539,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
540
539
|
reason: "平台API返回null"
|
|
541
540
|
});
|
|
542
541
|
|
|
543
|
-
this.vivoRewardedVideoAd.
|
|
544
|
-
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
|
|
542
|
+
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
|
|
545
543
|
return;
|
|
546
544
|
}
|
|
547
545
|
|
|
@@ -557,8 +555,8 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
557
555
|
});
|
|
558
556
|
|
|
559
557
|
if (this.vivoRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
|
|
560
|
-
this.vivoRewardedVideoAd.status = RewardedVideoAdStatus.
|
|
561
|
-
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
558
|
+
this.vivoRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
|
|
559
|
+
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
|
|
562
560
|
}
|
|
563
561
|
};
|
|
564
562
|
this.vivoRewardedVideoAd.ad.onError(this.vivoRewardedVideoAd.errorListener);
|
|
@@ -570,6 +568,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
570
568
|
});
|
|
571
569
|
|
|
572
570
|
this.vivoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
|
|
571
|
+
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
|
|
573
572
|
|
|
574
573
|
if (this.vivoRewardedVideoAd.isShowImmediately) {
|
|
575
574
|
this.vivoRewardedVideoAd.isShowImmediately = false;
|
|
@@ -589,9 +588,9 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
589
588
|
|
|
590
589
|
this.vivoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
|
|
591
590
|
if (isEnded) {
|
|
592
|
-
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
591
|
+
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
|
|
593
592
|
} else {
|
|
594
|
-
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
593
|
+
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
|
|
595
594
|
}
|
|
596
595
|
|
|
597
596
|
this.scheduleOnce(() => {
|
|
@@ -628,7 +627,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
628
627
|
this._showRewardedVideoAd();
|
|
629
628
|
break;
|
|
630
629
|
case RewardedVideoAdStatus.Status_Watched:
|
|
631
|
-
case RewardedVideoAdStatus.
|
|
630
|
+
case RewardedVideoAdStatus.Status_LoadError:
|
|
632
631
|
case RewardedVideoAdStatus.Status_Init:
|
|
633
632
|
this._loadRewardedVideoAd(true);
|
|
634
633
|
break;
|
|
@@ -672,12 +671,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
672
671
|
this.vivoRewardedVideoAd.ad.load().then(() => {
|
|
673
672
|
|
|
674
673
|
}).catch((err) => {
|
|
675
|
-
|
|
676
|
-
operation: "vivoRewardedVideoAd.ad.load()",
|
|
677
|
-
adUnitId: this.vivoRewardedVideoAd.unitId,
|
|
678
|
-
reason: "激励视频广告加载失败",
|
|
679
|
-
error: err
|
|
680
|
-
});
|
|
674
|
+
|
|
681
675
|
});
|
|
682
676
|
}
|
|
683
677
|
|
|
@@ -688,7 +682,7 @@ export class AdAdapterVivo extends AbsAdAdapter {
|
|
|
688
682
|
|
|
689
683
|
// 无法实时触发then回调
|
|
690
684
|
this.vivoRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
|
|
691
|
-
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
685
|
+
this.vivoRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
|
|
692
686
|
|
|
693
687
|
this.vivoRewardedVideoAd.ad.show()
|
|
694
688
|
.then(() => {
|
|
@@ -18,7 +18,7 @@ class WXInterstitialAd {
|
|
|
18
18
|
constructor(adUnitId: string, callback: Function) {
|
|
19
19
|
this.unitId = adUnitId;
|
|
20
20
|
this.ad = null;
|
|
21
|
-
this.status = InterstitialAdStatus.
|
|
21
|
+
this.status = InterstitialAdStatus.Status_New;
|
|
22
22
|
this.callback = callback;
|
|
23
23
|
this.errorListener = null;
|
|
24
24
|
this.loadListener = null;
|
|
@@ -62,7 +62,7 @@ class WXRewardedVideoAd {
|
|
|
62
62
|
constructor(adUnitId: string, callback: Function) {
|
|
63
63
|
this.unitId = adUnitId;
|
|
64
64
|
this.ad = null;
|
|
65
|
-
this.status = RewardedVideoAdStatus.
|
|
65
|
+
this.status = RewardedVideoAdStatus.Status_New;
|
|
66
66
|
this.callback = callback;
|
|
67
67
|
this.errorListener = null;
|
|
68
68
|
this.loadListener = null;
|
|
@@ -332,8 +332,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
332
332
|
reason: "平台API返回null",
|
|
333
333
|
adUnitId: this.wxInterstitialAd.unitId
|
|
334
334
|
});
|
|
335
|
-
this.wxInterstitialAd.
|
|
336
|
-
this.wxInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
335
|
+
this.wxInterstitialAd.callback(InterstitialAd_Callback_Status.Status_NotSupport);
|
|
337
336
|
return;
|
|
338
337
|
}
|
|
339
338
|
|
|
@@ -341,7 +340,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
341
340
|
this.wxInterstitialAd.status = InterstitialAdStatus.Status_Init;
|
|
342
341
|
|
|
343
342
|
this.wxInterstitialAd.errorListener = (err) => {
|
|
344
|
-
LogUtils.Instance.error(AdAdapterWeiXin.TAG, FwkErrorCode.WeiXin_Ad.
|
|
343
|
+
LogUtils.Instance.error(AdAdapterWeiXin.TAG, FwkErrorCode.WeiXin_Ad.LoadFailed, {
|
|
345
344
|
operation: "wxInterstitialAd.ad.onError",
|
|
346
345
|
reason: "插屏广告加载失败",
|
|
347
346
|
adUnitId: this.wxInterstitialAd.unitId,
|
|
@@ -349,7 +348,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
349
348
|
});
|
|
350
349
|
|
|
351
350
|
if (this.wxInterstitialAd.status !== InterstitialAdStatus.Status_Watching) {
|
|
352
|
-
this.wxInterstitialAd.status = InterstitialAdStatus.
|
|
351
|
+
this.wxInterstitialAd.status = InterstitialAdStatus.Status_LoadError;
|
|
353
352
|
this.wxInterstitialAd.callback(InterstitialAd_Callback_Status.Status_Error);
|
|
354
353
|
}
|
|
355
354
|
};
|
|
@@ -414,7 +413,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
414
413
|
break;
|
|
415
414
|
case InterstitialAdStatus.Status_Watched:
|
|
416
415
|
case InterstitialAdStatus.Status_Init:
|
|
417
|
-
case InterstitialAdStatus.
|
|
416
|
+
case InterstitialAdStatus.Status_LoadError:
|
|
418
417
|
this._loadInterstitialAd(true);
|
|
419
418
|
break;
|
|
420
419
|
default:
|
|
@@ -446,12 +445,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
446
445
|
this.wxInterstitialAd.ad.load().then(() => {
|
|
447
446
|
|
|
448
447
|
}).catch((err) => {
|
|
449
|
-
|
|
450
|
-
operation: "wxInterstitialAd.ad.load",
|
|
451
|
-
reason: "插屏广告加载失败",
|
|
452
|
-
adUnitId: this.wxInterstitialAd.unitId,
|
|
453
|
-
error: err
|
|
454
|
-
});
|
|
448
|
+
|
|
455
449
|
});
|
|
456
450
|
}
|
|
457
451
|
|
|
@@ -503,8 +497,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
503
497
|
reason: "平台API返回null",
|
|
504
498
|
adUnitId: this.wxRewardedVideoAd.unitId
|
|
505
499
|
});
|
|
506
|
-
this.wxRewardedVideoAd.
|
|
507
|
-
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Error);
|
|
500
|
+
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_NotSupport);
|
|
508
501
|
return;
|
|
509
502
|
}
|
|
510
503
|
|
|
@@ -520,8 +513,8 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
520
513
|
});
|
|
521
514
|
|
|
522
515
|
if (this.wxRewardedVideoAd.status !== RewardedVideoAdStatus.Status_Watching) {
|
|
523
|
-
this.wxRewardedVideoAd.status = RewardedVideoAdStatus.
|
|
524
|
-
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
516
|
+
this.wxRewardedVideoAd.status = RewardedVideoAdStatus.Status_LoadError;
|
|
517
|
+
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadError, err?.errCode, err?.errMsg);
|
|
525
518
|
}
|
|
526
519
|
};
|
|
527
520
|
this.wxRewardedVideoAd.ad.onError(this.wxRewardedVideoAd.errorListener);
|
|
@@ -534,6 +527,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
534
527
|
});
|
|
535
528
|
|
|
536
529
|
this.wxRewardedVideoAd.status = RewardedVideoAdStatus.Status_Loaded;
|
|
530
|
+
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_LoadSuccess);
|
|
537
531
|
|
|
538
532
|
if (this.wxRewardedVideoAd.isShowImmediately) {
|
|
539
533
|
this.wxRewardedVideoAd.isShowImmediately = false;
|
|
@@ -552,9 +546,9 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
552
546
|
|
|
553
547
|
this.wxRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watched;
|
|
554
548
|
if (isEnded) {
|
|
555
|
-
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
549
|
+
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Complete);
|
|
556
550
|
} else {
|
|
557
|
-
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
551
|
+
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Giveup);
|
|
558
552
|
}
|
|
559
553
|
|
|
560
554
|
this.scheduleOnce(() => {
|
|
@@ -592,7 +586,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
592
586
|
break;
|
|
593
587
|
case RewardedVideoAdStatus.Status_Watched:
|
|
594
588
|
case RewardedVideoAdStatus.Status_Init:
|
|
595
|
-
case RewardedVideoAdStatus.
|
|
589
|
+
case RewardedVideoAdStatus.Status_LoadError:
|
|
596
590
|
this._loadRewardedVideoAd(true);
|
|
597
591
|
break;
|
|
598
592
|
default:
|
|
@@ -654,7 +648,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
654
648
|
|
|
655
649
|
if (this.wxRewardedVideoAd.status === RewardedVideoAdStatus.Status_StartToWatch) {
|
|
656
650
|
this.wxRewardedVideoAd.status = RewardedVideoAdStatus.Status_Watching;
|
|
657
|
-
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.
|
|
651
|
+
this.wxRewardedVideoAd.callback(RewardedVideoAd_Callback_Status.Status_Show_Watching);
|
|
658
652
|
}
|
|
659
653
|
}).catch((err) => {
|
|
660
654
|
LogUtils.Instance.error(AdAdapterWeiXin.TAG, FwkErrorCode.WeiXin_Ad.ShowFailed, {
|
|
@@ -884,7 +878,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
884
878
|
}, interval * 1000);
|
|
885
879
|
}
|
|
886
880
|
|
|
887
|
-
public createPortalAd(adUnitId: string):
|
|
881
|
+
public createPortalAd(adUnitId: string): void {
|
|
888
882
|
let isFirstLoad: boolean = true;
|
|
889
883
|
for (let i = 0; i < this.wxCustomAds.length; i++) {
|
|
890
884
|
if (this.wxCustomAds[i].unitId === adUnitId) {
|
|
@@ -908,7 +902,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
908
902
|
reason: "未找到Portal广告平台配置",
|
|
909
903
|
adUnitId: adUnitId
|
|
910
904
|
});
|
|
911
|
-
return
|
|
905
|
+
return;
|
|
912
906
|
}
|
|
913
907
|
|
|
914
908
|
let portalAdPostion: PortalAdPosition = this.calcPortalAdPosition(portalAdPlatformInfo);
|
|
@@ -930,7 +924,7 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
930
924
|
reason: "平台API返回null",
|
|
931
925
|
adUnitId: adUnitId
|
|
932
926
|
});
|
|
933
|
-
return
|
|
927
|
+
return;
|
|
934
928
|
}
|
|
935
929
|
|
|
936
930
|
let wxCustomAd: WXCustomAd = new WXCustomAd(adUnitId, customAd, isFirstLoad);
|
|
@@ -972,8 +966,6 @@ export class AdAdapterWeiXin extends AbsAdAdapter {
|
|
|
972
966
|
});
|
|
973
967
|
};
|
|
974
968
|
wxCustomAd.ad.onClose(wxCustomAd.closeListener);
|
|
975
|
-
|
|
976
|
-
return true;
|
|
977
969
|
}
|
|
978
970
|
|
|
979
971
|
public destroyPortalAd(adUnitId: string): void {
|