From ba6e55b9d633210e60f502b0d375f259bd362ed1 Mon Sep 17 00:00:00 2001 From: Aki Shinagawa Date: Wed, 31 Jul 2024 12:53:37 -0700 Subject: [PATCH] Updated to support Adaptive case (#19) Updated to support Adaptive case and Custom case properly --- Vungle/VungleAdapter/ALVungleMediationAdapter.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Vungle/VungleAdapter/ALVungleMediationAdapter.m b/Vungle/VungleAdapter/ALVungleMediationAdapter.m index c3dac9a9d9..59cf03c915 100644 --- a/Vungle/VungleAdapter/ALVungleMediationAdapter.m +++ b/Vungle/VungleAdapter/ALVungleMediationAdapter.m @@ -517,12 +517,14 @@ - (void)loadVungleNativeAdForParameters:(id)paramet - (VungleAdSize *)adSizeFromAdFormat:(MAAdFormat *)adFormat parameters:(id)parameters { - BOOL isAdaptiveBanner = [parameters.localExtraParameters al_boolForKey: @"adaptive_banner"]; - NSNumber *customWidth = [parameters.localExtraParameters al_numberForKey: @"adaptive_banner_width"]; - NSNumber *customHight = [parameters.localExtraParameters al_numberForKey: @"adaptive_banner_height"]; - - if (!isAdaptiveBanner && customWidth && customHight) { - return [VungleAdSize VungleAdSizeFromCGSize:(CGSizeMake(customWidth.floatValue, customHight.floatValue))]; + if ([parameters.localExtraParameters al_boolForKey: @"adaptive_banner"]) { + NSNumber *customWidth = [parameters.localExtraParameters al_numberForKey: @"adaptive_banner_width"]; + // Need to check `customHeight` to determine if the request is for Custom or Adaptive. + NSNumber *customHeight = [parameters.localExtraParameters al_numberForKey: @"adaptive_banner_height"]; + if (!customHeight) { + customHeight = 0; + } + return [VungleAdSize VungleAdSizeFromCGSize:(CGSizeMake(customWidth.floatValue, customHeight.floatValue))]; } else if ( adFormat == MAAdFormat.banner ) {