Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Adapters/Vungle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Version 5.11.0
* Supporting Adapter Logging 2

## Version 5.10.0
* Supporting SDK version 7.7.4

Expand Down
48 changes: 28 additions & 20 deletions Adapters/Vungle/ISVungleAdapter/ISVungleAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ - (instancetype)initAdapter:(NSString *)name {
}

// Rewarded video
_rewardedVideoPlacementIdToSmashDelegate = [ISConcurrentMutableDictionary dictionary];
_rewardedVideoPlacementIdToVungleAdDelegate = [ISConcurrentMutableDictionary dictionary];
_rewardedVideoPlacementIdToAd = [ISConcurrentMutableDictionary dictionary];
_rewardedVideoPlacementIdToSmashDelegate = [ISConcurrentMutableDictionary lpmDictionary];
_rewardedVideoPlacementIdToVungleAdDelegate = [ISConcurrentMutableDictionary lpmDictionary];
_rewardedVideoPlacementIdToAd = [ISConcurrentMutableDictionary lpmDictionary];
_rewardedVideoPlacementIdsForInitCallbacks = [ISConcurrentMutableSet set];

// Interstitial
_interstitialPlacementIdToSmashDelegate = [ISConcurrentMutableDictionary dictionary];
_interstitialPlacementIdToVungleAdDelegate = [ISConcurrentMutableDictionary dictionary];
_interstitialPlacementIdToAd = [ISConcurrentMutableDictionary dictionary];
_interstitialPlacementIdToSmashDelegate = [ISConcurrentMutableDictionary lpmDictionary];
_interstitialPlacementIdToVungleAdDelegate = [ISConcurrentMutableDictionary lpmDictionary];
_interstitialPlacementIdToAd = [ISConcurrentMutableDictionary lpmDictionary];

// Banner
_bannerPlacementIdToSmashDelegate = [ISConcurrentMutableDictionary dictionary];
_bannerPlacementIdToVungleAdDelegate = [ISConcurrentMutableDictionary dictionary];
_bannerPlacementIdToAd = [ISConcurrentMutableDictionary dictionary];
_bannerPlacementIdToAdSize = [ISConcurrentMutableDictionary dictionary];
_bannerPlacementIdToSmashDelegate = [ISConcurrentMutableDictionary lpmDictionary];
_bannerPlacementIdToVungleAdDelegate = [ISConcurrentMutableDictionary lpmDictionary];
_bannerPlacementIdToAd = [ISConcurrentMutableDictionary lpmDictionary];
_bannerPlacementIdToAdSize = [ISConcurrentMutableDictionary lpmDictionary];

// The network's capability to load a Rewarded Video ad while another Rewarded Video ad of that network is showing
LWSState = LOAD_WHILE_SHOW_BY_INSTANCE;
Expand Down Expand Up @@ -233,15 +233,15 @@ - (void)initRewardedVideoForCallbacksWithUserId:(NSString *)userId
if (![self isConfigValueValid:appId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kAppId];
LogAdapterApi_Internal(@"error = %@", error.description);

[VungleMediationLogger logErrorForAd:nil message:@"NoAppId:RewardedWithInit"];
[delegate adapterRewardedVideoInitFailed:error];
return;
}

if (![self isConfigValueValid:placementId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kPlacementId];
LogAdapterApi_Internal(@"error = %@", error.description);

[VungleMediationLogger logErrorForAd:nil message:@"NoPlacementId:RewardedWithInit"];
[delegate adapterRewardedVideoInitFailed:error];
return;
}
Expand Down Expand Up @@ -284,13 +284,15 @@ - (void)initAndLoadRewardedVideoWithUserId:(NSString *)userId
if (![self isConfigValueValid:appId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kAppId];
LogAdapterApi_Internal(@"error = %@", error.description);
[VungleMediationLogger logErrorForAd:nil message:@"NoAppId:Rewarded"];
[delegate adapterRewardedVideoHasChangedAvailability:NO];
return;
}

if (![self isConfigValueValid:placementId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kPlacementId];
LogAdapterApi_Internal(@"error = %@", error.description);
[VungleMediationLogger logErrorForAd:nil message:@"NoPlacementId:Rewarded"];
[delegate adapterRewardedVideoHasChangedAvailability:NO];
return;
}
Expand Down Expand Up @@ -370,17 +372,18 @@ - (void)showRewardedVideoWithViewController:(UIViewController *)viewController

NSString *placementId = adapterConfig.settings[kPlacementId];
LogAdapterApi_Internal(@"placementId = %@", placementId);


VungleRewarded *rewardedVideoAd = [self.rewardedVideoPlacementIdToAd objectForKey:placementId];

if (![self hasRewardedVideoWithAdapterConfig:adapterConfig]) {
NSError *error = [ISError createError:ERROR_CODE_NO_ADS_TO_SHOW
withMessage:[NSString stringWithFormat: @"%@ show failed", kAdapterName]];
LogAdapterApi_Internal(@"error = %@", error);
[VungleMediationLogger logErrorForAd:rewardedVideoAd message:@"NoAdsToShow:Rewarded"];
[delegate adapterRewardedVideoDidFailToShowWithError:error];
return;
}

VungleRewarded *rewardedVideoAd = [self.rewardedVideoPlacementIdToAd objectForKey:placementId];


//set dynamic user Id
if ([self dynamicUserId]) {
LogAdapterApi_Internal(@"set userID to %@", [self dynamicUserId]);
Expand Down Expand Up @@ -426,14 +429,15 @@ - (void)initInterstitialWithUserId:(NSString *)userId
if (![self isConfigValueValid:appId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kAppId];
LogAdapterApi_Internal(@"error = %@", error.description);
[VungleMediationLogger logErrorForAd:nil message:@"NoAppId:Interstitial"];
[delegate adapterInterstitialInitFailedWithError:error];
return;
}

if (![self isConfigValueValid:placementId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kPlacementId];
LogAdapterApi_Internal(@"error = %@", error.description);

[VungleMediationLogger logErrorForAd:nil message:@"NoPlacementId:Interstitial"];
[delegate adapterInterstitialInitFailedWithError:error];
return;
}
Expand Down Expand Up @@ -517,16 +521,18 @@ - (void)showInterstitialWithViewController:(UIViewController *)viewController

NSString *placementId = adapterConfig.settings[kPlacementId];
LogAdapterApi_Internal(@"placementId = %@", placementId);


VungleInterstitial *interstitialAd = [self.interstitialPlacementIdToAd objectForKey:placementId];

if (![self hasInterstitialWithAdapterConfig:adapterConfig]) {
NSError *error = [ISError createError:ERROR_CODE_NO_ADS_TO_SHOW
withMessage:[NSString stringWithFormat: @"%@ show failed", kAdapterName]];
LogAdapterApi_Internal(@"error = %@", error);
[VungleMediationLogger logErrorForAd:interstitialAd message:@"NoAdsToShow:Interstitial"];
[delegate adapterInterstitialDidFailToShowWithError:error];
return;
}

VungleInterstitial *interstitialAd = [self.interstitialPlacementIdToAd objectForKey:placementId];

dispatch_async(dispatch_get_main_queue(), ^{
[interstitialAd presentWith:viewController];
});
Expand Down Expand Up @@ -566,13 +572,15 @@ - (void)initBannerWithUserId:(NSString *)userId
if (![self isConfigValueValid:appId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kAppId];
LogAdapterApi_Internal(@"error = %@", error.description);
[VungleMediationLogger logErrorForAd:nil message:@"NoAppId:Banner"];
[delegate adapterBannerInitFailedWithError:error];
return;
}

if (![self isConfigValueValid:placementId]) {
NSError *error = [self errorForMissingCredentialFieldWithName:kPlacementId];
LogAdapterApi_Internal(@"error = %@", error.description);
[VungleMediationLogger logErrorForAd:nil message:@"NoPlacementId:Banner"];
[delegate adapterBannerInitFailedWithError:error];
return;
}
Expand Down