Parcourir la source

Set status before running callbacks

cooperku_kdanmobile il y a 4 ans
Parent
commit
4bb567188a

+ 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
                     }
                 }
             }