浏览代码

Set status before running callbacks

cooperku_kdanmobile 4 年之前
父节点
当前提交
4bb567188a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/main/java/com/kdanmobile/admanager/admob/AdMobRewardedAdManager.kt

+ 2 - 2
src/main/java/com/kdanmobile/admanager/admob/AdMobRewardedAdManager.kt

@@ -52,10 +52,10 @@ class AdMobRewardedAdManager: RewardedAdManager {
                     }
 
                     override fun onRewardedVideoAdLoaded() {
+                        rewardedAdDataMap[adUnitId]?.status = RewardedAdStatus.LOADED
                         adListeners.forEach {
                             it.onRewardedAdLoaded(adUnitId)
                         }
-                        rewardedAdDataMap[adUnitId]?.status = RewardedAdStatus.LOADED
                     }
 
                     override fun onRewardedVideoAdOpened() {
@@ -84,10 +84,10 @@ class AdMobRewardedAdManager: RewardedAdManager {
                     }
 
                     override fun onRewardedVideoAdFailedToLoad(errorCode: Int) {
+                        rewardedAdDataMap[adUnitId]?.status = RewardedAdStatus.FAILED
                         adListeners.forEach {
                             it.onRewardedAdFailedToLoad(adUnitId, errorCode)
                         }
-                        rewardedAdDataMap[adUnitId]?.status = RewardedAdStatus.FAILED
                     }
                 }
             }