Prechádzať zdrojové kódy

Set status before running callbacks

cooperku_kdanmobile 4 rokov pred
rodič
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
                     }
                 }
             }