react-native-applovin-max 9.0.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +4 -10
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +17 -8
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModuleImpl.java +36 -14
- package/android/src/newarch/com/applovin/reactnative/AppLovinMAXModule.java +6 -6
- package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXModule.java +6 -6
- package/ios/AppLovinMAX.mm +36 -13
- package/ios/AppLovinMAXAdView.h +1 -0
- package/ios/AppLovinMAXAdView.mm +3 -9
- package/ios/AppLovinMAXAdViewUIComponent.h +1 -2
- package/ios/AppLovinMAXAdViewUIComponent.mm +18 -10
- package/lib/commonjs/AdView.js +63 -79
- package/lib/commonjs/AdView.js.map +1 -1
- package/lib/commonjs/AppLovinMAX.js +43 -29
- package/lib/commonjs/AppLovinMAX.js.map +1 -1
- package/lib/commonjs/BannerAd.js +2 -3
- package/lib/commonjs/BannerAd.js.map +1 -1
- package/lib/commonjs/ErrorCode.js +24 -31
- package/lib/commonjs/ErrorCode.js.map +1 -1
- package/lib/commonjs/EventEmitter.js +22 -1
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/Utils.js +22 -4
- package/lib/commonjs/Utils.js.map +1 -1
- package/lib/commonjs/index.js +1 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +34 -24
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js +85 -43
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js +30 -2
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js +27 -0
- package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js +23 -0
- package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/NativeAppLovinMAXModule.js +7 -0
- package/lib/commonjs/specs/NativeAppLovinMAXModule.js.map +1 -1
- package/lib/commonjs/types/AdInfo.js +13 -16
- package/lib/commonjs/types/AdInfo.js.map +1 -1
- package/lib/module/AdView.js +62 -77
- package/lib/module/AdView.js.map +1 -1
- package/lib/module/AppLovinMAX.js +44 -29
- package/lib/module/AppLovinMAX.js.map +1 -1
- package/lib/module/BannerAd.js +2 -3
- package/lib/module/BannerAd.js.map +1 -1
- package/lib/module/ErrorCode.js +24 -31
- package/lib/module/ErrorCode.js.map +1 -1
- package/lib/module/EventEmitter.js +22 -1
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/Utils.js +22 -4
- package/lib/module/Utils.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +34 -21
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js +87 -40
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js +30 -0
- package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js +28 -0
- package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -1
- package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js +24 -0
- package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -1
- package/lib/module/specs/NativeAppLovinMAXModule.js +9 -0
- package/lib/module/specs/NativeAppLovinMAXModule.js.map +1 -1
- package/lib/module/types/AdInfo.js +13 -16
- package/lib/module/types/AdInfo.js.map +1 -1
- package/lib/typescript/src/AdView.d.ts +27 -21
- package/lib/typescript/src/AdView.d.ts.map +1 -1
- package/lib/typescript/src/AppLovinMAX.d.ts +22 -21
- package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
- package/lib/typescript/src/BannerAd.d.ts.map +1 -1
- package/lib/typescript/src/ErrorCode.d.ts +24 -31
- package/lib/typescript/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/src/EventEmitter.d.ts +16 -0
- package/lib/typescript/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/src/Utils.d.ts +15 -0
- package/lib/typescript/src/Utils.d.ts.map +1 -1
- package/lib/typescript/src/nativeAd/NativeAdView.d.ts +15 -7
- package/lib/typescript/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts +65 -1
- package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts +17 -0
- package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts +45 -1
- package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts +57 -6
- package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts +13 -3
- package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts.map +1 -1
- package/lib/typescript/src/types/AdEvent.d.ts +10 -4
- package/lib/typescript/src/types/AdEvent.d.ts.map +1 -1
- package/lib/typescript/src/types/AdInfo.d.ts +78 -85
- package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/src/types/AdProps.d.ts +14 -15
- package/lib/typescript/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/src/types/AdViewProps.d.ts +32 -29
- package/lib/typescript/src/types/AdViewProps.d.ts.map +1 -1
- package/lib/typescript/src/types/AppLovinMAX.d.ts +50 -53
- package/lib/typescript/src/types/AppLovinMAX.d.ts.map +1 -1
- package/lib/typescript/src/types/BannerAd.d.ts +24 -18
- package/lib/typescript/src/types/BannerAd.d.ts.map +1 -1
- package/lib/typescript/src/types/CMPError.d.ts +7 -4
- package/lib/typescript/src/types/CMPError.d.ts.map +1 -1
- package/lib/typescript/src/types/Configuration.d.ts +12 -14
- package/lib/typescript/src/types/Configuration.d.ts.map +1 -1
- package/lib/typescript/src/types/FullscreenAd.d.ts +39 -46
- package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -1
- package/lib/typescript/src/types/MRecAd.d.ts +7 -3
- package/lib/typescript/src/types/MRecAd.d.ts.map +1 -1
- package/lib/typescript/src/types/NativeAd.d.ts +12 -11
- package/lib/typescript/src/types/NativeAd.d.ts.map +1 -1
- package/lib/typescript/src/types/NativeAdViewProps.d.ts +4 -3
- package/lib/typescript/src/types/NativeAdViewProps.d.ts.map +1 -1
- package/lib/typescript/src/types/Privacy.d.ts +13 -6
- package/lib/typescript/src/types/Privacy.d.ts.map +1 -1
- package/lib/typescript/src/types/RewardedAd.d.ts +7 -5
- package/lib/typescript/src/types/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/src/types/ViewAd.d.ts +46 -50
- package/lib/typescript/src/types/ViewAd.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AdView.tsx +64 -82
- package/src/AppLovinMAX.ts +39 -29
- package/src/BannerAd.ts +2 -3
- package/src/ErrorCode.ts +24 -31
- package/src/EventEmitter.ts +20 -2
- package/src/Utils.ts +20 -1
- package/src/nativeAd/NativeAdView.tsx +31 -21
- package/src/nativeAd/NativeAdViewComponents.tsx +97 -38
- package/src/nativeAd/NativeAdViewProvider.tsx +23 -0
- package/src/specs/AppLovinMAXAdViewNativeComponent.ts +62 -1
- package/src/specs/AppLovinMAXNativeAdViewNativeComponent.ts +70 -6
- package/src/specs/NativeAppLovinMAXModule.ts +77 -56
- package/src/types/AdEvent.ts +10 -4
- package/src/types/AdInfo.ts +78 -85
- package/src/types/AdProps.ts +14 -15
- package/src/types/AdViewProps.ts +33 -29
- package/src/types/AppLovinMAX.ts +50 -53
- package/src/types/BannerAd.ts +24 -18
- package/src/types/CMPError.ts +7 -4
- package/src/types/Configuration.ts +12 -14
- package/src/types/FullscreenAd.ts +39 -46
- package/src/types/MRecAd.ts +7 -3
- package/src/types/NativeAd.ts +12 -11
- package/src/types/NativeAdViewProps.ts +4 -3
- package/src/types/Privacy.ts +13 -6
- package/src/types/RewardedAd.ts +7 -5
- package/src/types/ViewAd.ts +46 -50
package/android/build.gradle
CHANGED
|
@@ -53,8 +53,8 @@ android {
|
|
|
53
53
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
54
54
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
55
55
|
|
|
56
|
-
buildConfigField("int", "VERSION_CODE", "
|
|
57
|
-
buildConfigField("String", "VERSION_NAME", "\"9.
|
|
56
|
+
buildConfigField("int", "VERSION_CODE", "9020000")
|
|
57
|
+
buildConfigField("String", "VERSION_NAME", "\"9.2.0\"")
|
|
58
58
|
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -96,6 +96,6 @@ dependencies {
|
|
|
96
96
|
//noinspection GradleDynamicVersion
|
|
97
97
|
implementation "com.facebook.react:react-native:0.75.4"
|
|
98
98
|
|
|
99
|
-
implementation "com.applovin:applovin-sdk:13.
|
|
99
|
+
implementation "com.applovin:applovin-sdk:13.3.0"
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -76,6 +76,7 @@ public class AppLovinMAXAdView
|
|
|
76
76
|
|
|
77
77
|
public static void preloadNativeUIComponentAdView(final String adUnitId,
|
|
78
78
|
final MaxAdFormat adFormat,
|
|
79
|
+
final boolean isAdaptive,
|
|
79
80
|
@Nullable final String placement,
|
|
80
81
|
@Nullable final String customData,
|
|
81
82
|
@Nullable final Map<String, Object> extraParameters,
|
|
@@ -83,7 +84,7 @@ public class AppLovinMAXAdView
|
|
|
83
84
|
final Promise promise,
|
|
84
85
|
final ReactContext context)
|
|
85
86
|
{
|
|
86
|
-
AppLovinMAXAdViewUiComponent preloadedUiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, context );
|
|
87
|
+
AppLovinMAXAdViewUiComponent preloadedUiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, isAdaptive, context );
|
|
87
88
|
preloadedUiComponentInstances.put( preloadedUiComponent.hashCode(), preloadedUiComponent );
|
|
88
89
|
|
|
89
90
|
preloadedUiComponent.setPlacement( placement );
|
|
@@ -189,11 +190,6 @@ public class AppLovinMAXAdView
|
|
|
189
190
|
public void setAdaptiveBannerEnabled(final boolean enabled)
|
|
190
191
|
{
|
|
191
192
|
adaptiveBannerEnabled = enabled;
|
|
192
|
-
|
|
193
|
-
if ( uiComponent != null )
|
|
194
|
-
{
|
|
195
|
-
uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
|
|
196
|
-
}
|
|
197
193
|
}
|
|
198
194
|
|
|
199
195
|
public void setAutoRefreshEnabled(final boolean enabled)
|
|
@@ -241,7 +237,7 @@ public class AppLovinMAXAdView
|
|
|
241
237
|
|
|
242
238
|
if ( uiComponent != null )
|
|
243
239
|
{
|
|
244
|
-
uiComponent.measureAndLayout( 0, 0, getWidth(), getHeight() );
|
|
240
|
+
postDelayed( () -> uiComponent.measureAndLayout( 0, 0, getWidth(), getHeight() ), 500 );
|
|
245
241
|
}
|
|
246
242
|
}
|
|
247
243
|
|
|
@@ -314,14 +310,13 @@ public class AppLovinMAXAdView
|
|
|
314
310
|
{
|
|
315
311
|
AppLovinMAXModuleImpl.d( "Mounting the preloaded AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
|
|
316
312
|
|
|
317
|
-
uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
|
|
318
313
|
uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
|
|
319
314
|
uiComponent.attachAdView( AppLovinMAXAdView.this );
|
|
320
315
|
return;
|
|
321
316
|
}
|
|
322
317
|
}
|
|
323
318
|
|
|
324
|
-
uiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, reactContext );
|
|
319
|
+
uiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, adaptiveBannerEnabled, reactContext );
|
|
325
320
|
adViewId = uiComponent.hashCode();
|
|
326
321
|
uiComponentInstances.put( adViewId, uiComponent );
|
|
327
322
|
|
|
@@ -331,7 +326,6 @@ public class AppLovinMAXAdView
|
|
|
331
326
|
uiComponent.setCustomData( customData );
|
|
332
327
|
uiComponent.setExtraParameters( extraParameters );
|
|
333
328
|
uiComponent.setLocalExtraParameters( localExtraParameters );
|
|
334
|
-
uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
|
|
335
329
|
uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
|
|
336
330
|
|
|
337
331
|
uiComponent.attachAdView( AppLovinMAXAdView.this );
|
|
@@ -7,6 +7,7 @@ import com.applovin.mediation.MaxAdFormat;
|
|
|
7
7
|
import com.applovin.mediation.MaxAdListener;
|
|
8
8
|
import com.applovin.mediation.MaxAdRevenueListener;
|
|
9
9
|
import com.applovin.mediation.MaxAdViewAdListener;
|
|
10
|
+
import com.applovin.mediation.MaxAdViewConfiguration;
|
|
10
11
|
import com.applovin.mediation.MaxError;
|
|
11
12
|
import com.applovin.mediation.ads.MaxAdView;
|
|
12
13
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -28,15 +29,28 @@ class AppLovinMAXAdViewUiComponent
|
|
|
28
29
|
@Nullable
|
|
29
30
|
private AppLovinMAXAdView containerView;
|
|
30
31
|
|
|
31
|
-
public AppLovinMAXAdViewUiComponent(final String adUnitId, final MaxAdFormat adFormat, final ReactContext context)
|
|
32
|
+
public AppLovinMAXAdViewUiComponent(final String adUnitId, final MaxAdFormat adFormat, final boolean isAdaptive, final ReactContext context)
|
|
32
33
|
{
|
|
33
34
|
reactContext = context;
|
|
34
35
|
surfaceId = UIManagerHelper.getSurfaceId( context );
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
MaxAdViewConfiguration.Builder builder = MaxAdViewConfiguration.builder();
|
|
38
|
+
|
|
39
|
+
if ( adFormat.isBannerOrLeaderAd() )
|
|
40
|
+
{
|
|
41
|
+
if ( isAdaptive )
|
|
42
|
+
{
|
|
43
|
+
builder.setAdaptiveType( MaxAdViewConfiguration.AdaptiveType.ANCHORED );
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
{
|
|
47
|
+
builder.setAdaptiveType( MaxAdViewConfiguration.AdaptiveType.NONE );
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
adView = new MaxAdView( adUnitId, adFormat, builder.build() );
|
|
37
52
|
adView.setListener( this );
|
|
38
53
|
adView.setRevenueListener( this );
|
|
39
|
-
adView.setExtraParameter( "adaptive_banner", "true" );
|
|
40
54
|
|
|
41
55
|
// Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
|
|
42
56
|
adView.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" );
|
|
@@ -64,11 +78,6 @@ class AppLovinMAXAdViewUiComponent
|
|
|
64
78
|
adView.setCustomData( value );
|
|
65
79
|
}
|
|
66
80
|
|
|
67
|
-
public void setAdaptiveBannerEnabled(final boolean enabled)
|
|
68
|
-
{
|
|
69
|
-
adView.setExtraParameter( "adaptive_banner", Boolean.toString( enabled ) );
|
|
70
|
-
}
|
|
71
|
-
|
|
72
81
|
public void setAutoRefreshEnabled(final boolean enabled)
|
|
73
82
|
{
|
|
74
83
|
if ( enabled )
|
|
@@ -23,6 +23,7 @@ import com.applovin.mediation.MaxAdFormat;
|
|
|
23
23
|
import com.applovin.mediation.MaxAdListener;
|
|
24
24
|
import com.applovin.mediation.MaxAdRevenueListener;
|
|
25
25
|
import com.applovin.mediation.MaxAdViewAdListener;
|
|
26
|
+
import com.applovin.mediation.MaxAdViewConfiguration;
|
|
26
27
|
import com.applovin.mediation.MaxAdWaterfallInfo;
|
|
27
28
|
import com.applovin.mediation.MaxError;
|
|
28
29
|
import com.applovin.mediation.MaxErrorCode;
|
|
@@ -78,7 +79,7 @@ public class AppLovinMAXModuleImpl
|
|
|
78
79
|
{
|
|
79
80
|
private static final String SDK_TAG = "AppLovinSdk";
|
|
80
81
|
private static final String TAG = "AppLovinMAXModule";
|
|
81
|
-
private static final String PLUGIN_VERSION = "9.
|
|
82
|
+
private static final String PLUGIN_VERSION = "9.2.0";
|
|
82
83
|
|
|
83
84
|
private static final String USER_GEOGRAPHY_GDPR = "G";
|
|
84
85
|
private static final String USER_GEOGRAPHY_OTHER = "O";
|
|
@@ -100,6 +101,8 @@ public class AppLovinMAXModuleImpl
|
|
|
100
101
|
|
|
101
102
|
static
|
|
102
103
|
{
|
|
104
|
+
ALCompatibleNativeSdkVersions.put( "9.2.0", "13.3.0" );
|
|
105
|
+
ALCompatibleNativeSdkVersions.put( "9.1.0", "13.2.0" );
|
|
103
106
|
ALCompatibleNativeSdkVersions.put( "9.0.0", "13.0.1" );
|
|
104
107
|
ALCompatibleNativeSdkVersions.put( "8.2.0", "13.0.1" );
|
|
105
108
|
ALCompatibleNativeSdkVersions.put( "8.1.1", "13.0.1" );
|
|
@@ -524,7 +527,7 @@ public class AppLovinMAXModuleImpl
|
|
|
524
527
|
|
|
525
528
|
// BANNERS
|
|
526
529
|
|
|
527
|
-
public void createBanner(final String adUnitId, final String bannerPosition)
|
|
530
|
+
public void createBanner(final String adUnitId, final String bannerPosition, final boolean isAdaptive)
|
|
528
531
|
{
|
|
529
532
|
if ( sdk == null )
|
|
530
533
|
{
|
|
@@ -532,11 +535,11 @@ public class AppLovinMAXModuleImpl
|
|
|
532
535
|
return;
|
|
533
536
|
}
|
|
534
537
|
|
|
535
|
-
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, DEFAULT_AD_VIEW_OFFSET );
|
|
538
|
+
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, DEFAULT_AD_VIEW_OFFSET, isAdaptive );
|
|
536
539
|
}
|
|
537
540
|
|
|
538
541
|
// NOTE: No function overloading in JS so we need new method signature
|
|
539
|
-
public void createBannerWithOffsets(final String adUnitId, final String bannerPosition, final float x, final float y)
|
|
542
|
+
public void createBannerWithOffsets(final String adUnitId, final String bannerPosition, final float x, final float y, final boolean isAdaptive)
|
|
540
543
|
{
|
|
541
544
|
if ( sdk == null )
|
|
542
545
|
{
|
|
@@ -544,7 +547,7 @@ public class AppLovinMAXModuleImpl
|
|
|
544
547
|
return;
|
|
545
548
|
}
|
|
546
549
|
|
|
547
|
-
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, getOffsetPixels( x, y, reactContext ) );
|
|
550
|
+
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, getOffsetPixels( x, y, reactContext ), isAdaptive );
|
|
548
551
|
}
|
|
549
552
|
|
|
550
553
|
public void setBannerBackgroundColor(final String adUnitId, final String hexColorCode)
|
|
@@ -700,7 +703,7 @@ public class AppLovinMAXModuleImpl
|
|
|
700
703
|
return;
|
|
701
704
|
}
|
|
702
705
|
|
|
703
|
-
createAdView( adUnitId, MaxAdFormat.MREC, mrecPosition, DEFAULT_AD_VIEW_OFFSET );
|
|
706
|
+
createAdView( adUnitId, MaxAdFormat.MREC, mrecPosition, DEFAULT_AD_VIEW_OFFSET, false );
|
|
704
707
|
}
|
|
705
708
|
|
|
706
709
|
public void setMRecPlacement(final String adUnitId, @Nullable final String placement)
|
|
@@ -1034,7 +1037,7 @@ public class AppLovinMAXModuleImpl
|
|
|
1034
1037
|
|
|
1035
1038
|
// ADVIEW PRELOADING
|
|
1036
1039
|
|
|
1037
|
-
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormatStr, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameterMap, @Nullable final ReadableMap localExtraParameterMap, final Promise promise)
|
|
1040
|
+
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormatStr, final boolean isAdaptive, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameterMap, @Nullable final ReadableMap localExtraParameterMap, final Promise promise)
|
|
1038
1041
|
{
|
|
1039
1042
|
MaxAdFormat adFormat;
|
|
1040
1043
|
|
|
@@ -1058,6 +1061,7 @@ public class AppLovinMAXModuleImpl
|
|
|
1058
1061
|
|
|
1059
1062
|
reactContext.runOnUiQueueThread( () -> AppLovinMAXAdView.preloadNativeUIComponentAdView( adUnitId,
|
|
1060
1063
|
finalAdFormat,
|
|
1064
|
+
isAdaptive,
|
|
1061
1065
|
placement,
|
|
1062
1066
|
customData,
|
|
1063
1067
|
extraParameters,
|
|
@@ -1346,7 +1350,7 @@ public class AppLovinMAXModuleImpl
|
|
|
1346
1350
|
|
|
1347
1351
|
// INTERNAL METHODS
|
|
1348
1352
|
|
|
1349
|
-
private void createAdView(final String adUnitId, final MaxAdFormat adFormat, final String adViewPosition, final Point adViewOffsetPixels)
|
|
1353
|
+
private void createAdView(final String adUnitId, final MaxAdFormat adFormat, final String adViewPosition, final Point adViewOffsetPixels, final boolean isAdaptive)
|
|
1350
1354
|
{
|
|
1351
1355
|
// Run on main thread to ensure there are no concurrency issues with other ad view methods
|
|
1352
1356
|
reactContext.runOnUiQueueThread( () -> {
|
|
@@ -1354,7 +1358,7 @@ public class AppLovinMAXModuleImpl
|
|
|
1354
1358
|
d( "Creating " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\", position: \"" + adViewPosition + "\", and offset: " + adViewOffsetPixels );
|
|
1355
1359
|
|
|
1356
1360
|
// Retrieve ad view from the map
|
|
1357
|
-
final MaxAdView adView = retrieveAdView( adUnitId, adFormat, adViewPosition, adViewOffsetPixels );
|
|
1361
|
+
final MaxAdView adView = retrieveAdView( adUnitId, adFormat, adViewPosition, adViewOffsetPixels, isAdaptive );
|
|
1358
1362
|
if ( adView == null )
|
|
1359
1363
|
{
|
|
1360
1364
|
e( adFormat.getLabel() + " does not exist" );
|
|
@@ -1389,7 +1393,7 @@ public class AppLovinMAXModuleImpl
|
|
|
1389
1393
|
|
|
1390
1394
|
d( "Setting placement \"" + placement + "\" for " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1391
1395
|
|
|
1392
|
-
final MaxAdView adView = retrieveAdView( adUnitId, adFormat, "", DEFAULT_AD_VIEW_OFFSET );
|
|
1396
|
+
final MaxAdView adView = retrieveAdView( adUnitId, adFormat, "", DEFAULT_AD_VIEW_OFFSET, true );
|
|
1393
1397
|
if ( adView == null )
|
|
1394
1398
|
{
|
|
1395
1399
|
e( adFormat.getLabel() + " does not exist" );
|
|
@@ -1406,7 +1410,7 @@ public class AppLovinMAXModuleImpl
|
|
|
1406
1410
|
|
|
1407
1411
|
d( "Setting custom data \"" + customData + "\" for " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1408
1412
|
|
|
1409
|
-
final MaxAdView adView = retrieveAdView( adUnitId, adFormat, "", DEFAULT_AD_VIEW_OFFSET );
|
|
1413
|
+
final MaxAdView adView = retrieveAdView( adUnitId, adFormat, "", DEFAULT_AD_VIEW_OFFSET, true );
|
|
1410
1414
|
if ( adView == null )
|
|
1411
1415
|
{
|
|
1412
1416
|
e( adFormat.getLabel() + " does not exist" );
|
|
@@ -1580,6 +1584,8 @@ public class AppLovinMAXModuleImpl
|
|
|
1580
1584
|
}
|
|
1581
1585
|
else if ( "adaptive_banner".equalsIgnoreCase( key ) )
|
|
1582
1586
|
{
|
|
1587
|
+
e( "Setting adaptive banners via extra parameters is deprecated and will be removed in a future plugin version. Please use the BannerAd.createAd(adUnitId: string, position: AdViewPosition, xOffset: number, yOffset: number, isAdaptive: boolean) API to properly configure adaptive banners." );
|
|
1588
|
+
|
|
1583
1589
|
boolean useAdaptiveBannerAdSize = Boolean.parseBoolean( value );
|
|
1584
1590
|
if ( useAdaptiveBannerAdSize )
|
|
1585
1591
|
{
|
|
@@ -1726,15 +1732,31 @@ public class AppLovinMAXModuleImpl
|
|
|
1726
1732
|
|
|
1727
1733
|
private MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat)
|
|
1728
1734
|
{
|
|
1729
|
-
return retrieveAdView( adUnitId, adFormat, null, DEFAULT_AD_VIEW_OFFSET );
|
|
1735
|
+
return retrieveAdView( adUnitId, adFormat, null, DEFAULT_AD_VIEW_OFFSET, true );
|
|
1730
1736
|
}
|
|
1731
1737
|
|
|
1732
|
-
private MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat, String adViewPosition, Point adViewOffsetPixels)
|
|
1738
|
+
private MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat, String adViewPosition, Point adViewOffsetPixels, final boolean isAdaptive)
|
|
1733
1739
|
{
|
|
1734
1740
|
MaxAdView result = adViews.get( adUnitId );
|
|
1735
1741
|
if ( result == null && adViewPosition != null && adViewOffsetPixels != null )
|
|
1736
1742
|
{
|
|
1737
|
-
|
|
1743
|
+
MaxAdViewConfiguration.Builder builder = MaxAdViewConfiguration.builder();
|
|
1744
|
+
|
|
1745
|
+
// Set adaptive type only for banner ads. If adaptive is enabled, use ANCHORED; otherwise, fall back to NONE.
|
|
1746
|
+
if ( adFormat.isBannerOrLeaderAd() )
|
|
1747
|
+
{
|
|
1748
|
+
if ( isAdaptive )
|
|
1749
|
+
{
|
|
1750
|
+
builder.setAdaptiveType( MaxAdViewConfiguration.AdaptiveType.ANCHORED );
|
|
1751
|
+
}
|
|
1752
|
+
else
|
|
1753
|
+
{
|
|
1754
|
+
builder.setAdaptiveType( MaxAdViewConfiguration.AdaptiveType.NONE );
|
|
1755
|
+
disabledAdaptiveBannerAdUnitIds.add( adUnitId );
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
result = new MaxAdView( adUnitId, adFormat, builder.build() );
|
|
1738
1760
|
result.setListener( this );
|
|
1739
1761
|
result.setRevenueListener( this );
|
|
1740
1762
|
|
|
@@ -175,15 +175,15 @@ public class AppLovinMAXModule
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
@Override
|
|
178
|
-
public void createBanner(final String adUnitId, final String position)
|
|
178
|
+
public void createBanner(final String adUnitId, final String position, final boolean isAdaptive)
|
|
179
179
|
{
|
|
180
|
-
impl.createBanner( adUnitId, position );
|
|
180
|
+
impl.createBanner( adUnitId, position, isAdaptive );
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
@Override
|
|
184
|
-
public void createBannerWithOffsets(final String adUnitId, final String position, final double xOffset, final double yOffset)
|
|
184
|
+
public void createBannerWithOffsets(final String adUnitId, final String position, final double xOffset, final double yOffset, final boolean isAdaptive)
|
|
185
185
|
{
|
|
186
|
-
impl.createBannerWithOffsets( adUnitId, position, (float) xOffset, (float) yOffset );
|
|
186
|
+
impl.createBannerWithOffsets( adUnitId, position, (float) xOffset, (float) yOffset, isAdaptive );
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
@Override
|
|
@@ -427,9 +427,9 @@ public class AppLovinMAXModule
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
@Override
|
|
430
|
-
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormat, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameters, @Nullable final ReadableMap localExtraParameters, final Promise promise)
|
|
430
|
+
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormat, final boolean isAdaptive, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameters, @Nullable final ReadableMap localExtraParameters, final Promise promise)
|
|
431
431
|
{
|
|
432
|
-
impl.preloadNativeUIComponentAdView( adUnitId, adFormat, placement, customData, extraParameters, localExtraParameters, promise );
|
|
432
|
+
impl.preloadNativeUIComponentAdView( adUnitId, adFormat, isAdaptive, placement, customData, extraParameters, localExtraParameters, promise );
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
@Override
|
|
@@ -175,15 +175,15 @@ public class AppLovinMAXModule
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
@ReactMethod
|
|
178
|
-
public void createBanner(final String adUnitId, final String position)
|
|
178
|
+
public void createBanner(final String adUnitId, final String position, final boolean isAdaptive)
|
|
179
179
|
{
|
|
180
|
-
impl.createBanner( adUnitId, position );
|
|
180
|
+
impl.createBanner( adUnitId, position, isAdaptive );
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
@ReactMethod
|
|
184
|
-
public void createBannerWithOffsets(final String adUnitId, final String position, final double xOffset, final double yOffset)
|
|
184
|
+
public void createBannerWithOffsets(final String adUnitId, final String position, final double xOffset, final double yOffset, final boolean isAdaptive)
|
|
185
185
|
{
|
|
186
|
-
impl.createBannerWithOffsets( adUnitId, position, (float) xOffset, (float) yOffset );
|
|
186
|
+
impl.createBannerWithOffsets( adUnitId, position, (float) xOffset, (float) yOffset, isAdaptive );
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
@ReactMethod
|
|
@@ -427,9 +427,9 @@ public class AppLovinMAXModule
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
@ReactMethod
|
|
430
|
-
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormat, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameters, @Nullable final ReadableMap localExtraParameters, final Promise promise)
|
|
430
|
+
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormat, final boolean isAdaptive, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameters, @Nullable final ReadableMap localExtraParameters, final Promise promise)
|
|
431
431
|
{
|
|
432
|
-
impl.preloadNativeUIComponentAdView( adUnitId, adFormat, placement, customData, extraParameters, localExtraParameters, promise );
|
|
432
|
+
impl.preloadNativeUIComponentAdView( adUnitId, adFormat, isAdaptive, placement, customData, extraParameters, localExtraParameters, promise );
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
@ReactMethod
|
package/ios/AppLovinMAX.mm
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
@implementation AppLovinMAX
|
|
74
74
|
static NSString *const SDK_TAG = @"AppLovinSdk";
|
|
75
75
|
static NSString *const TAG = @"AppLovinMAX";
|
|
76
|
-
static NSString *const PLUGIN_VERSION = @"9.
|
|
76
|
+
static NSString *const PLUGIN_VERSION = @"9.2.0";
|
|
77
77
|
|
|
78
78
|
static NSString *const USER_GEOGRAPHY_GDPR = @"G";
|
|
79
79
|
static NSString *const USER_GEOGRAPHY_OTHER = @"O";
|
|
@@ -149,6 +149,8 @@ RCT_EXPORT_MODULE()
|
|
|
149
149
|
[super initialize];
|
|
150
150
|
|
|
151
151
|
ALCompatibleNativeSDKVersions = @{
|
|
152
|
+
@"9.2.0" : @"13.3.0",
|
|
153
|
+
@"9.1.0" : @"13.2.0",
|
|
152
154
|
@"9.0.0" : @"13.0.1",
|
|
153
155
|
@"8.2.0" : @"13.0.1",
|
|
154
156
|
@"8.1.1" : @"13.0.1",
|
|
@@ -484,7 +486,7 @@ RCT_EXPORT_METHOD(trackEvent:(NSString *)event :(NSDictionary<NSString *, id> *)
|
|
|
484
486
|
|
|
485
487
|
#pragma mark - Banners
|
|
486
488
|
|
|
487
|
-
RCT_EXPORT_METHOD(createBanner:(NSString *)adUnitIdentifier position:(NSString *)bannerPosition)
|
|
489
|
+
RCT_EXPORT_METHOD(createBanner:(NSString *)adUnitIdentifier position:(NSString *)bannerPosition isAdaptive:(BOOL)isAdaptive)
|
|
488
490
|
{
|
|
489
491
|
if ( !self.sdk )
|
|
490
492
|
{
|
|
@@ -492,11 +494,11 @@ RCT_EXPORT_METHOD(createBanner:(NSString *)adUnitIdentifier position:(NSString *
|
|
|
492
494
|
return;
|
|
493
495
|
}
|
|
494
496
|
|
|
495
|
-
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: DEVICE_SPECIFIC_ADVIEW_AD_FORMAT atPosition: bannerPosition withOffset: CGPointZero];
|
|
497
|
+
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: DEVICE_SPECIFIC_ADVIEW_AD_FORMAT atPosition: bannerPosition withOffset: CGPointZero isAdaptive: isAdaptive];
|
|
496
498
|
}
|
|
497
499
|
|
|
498
500
|
// NOTE: No function overloading in JS so we need new method signature
|
|
499
|
-
RCT_EXPORT_METHOD(createBannerWithOffsets:(NSString *)adUnitIdentifier position:(NSString *)bannerPosition xOffset:(double)xOffset yOffset:(double)yOffset)
|
|
501
|
+
RCT_EXPORT_METHOD(createBannerWithOffsets:(NSString *)adUnitIdentifier position:(NSString *)bannerPosition xOffset:(double)xOffset yOffset:(double)yOffset isAdaptive:(BOOL)isAdaptive)
|
|
500
502
|
{
|
|
501
503
|
if ( !self.sdk )
|
|
502
504
|
{
|
|
@@ -504,7 +506,7 @@ RCT_EXPORT_METHOD(createBannerWithOffsets:(NSString *)adUnitIdentifier position:
|
|
|
504
506
|
return;
|
|
505
507
|
}
|
|
506
508
|
|
|
507
|
-
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: DEVICE_SPECIFIC_ADVIEW_AD_FORMAT atPosition: bannerPosition withOffset: CGPointMake(xOffset, yOffset)];
|
|
509
|
+
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: DEVICE_SPECIFIC_ADVIEW_AD_FORMAT atPosition: bannerPosition withOffset: CGPointMake(xOffset, yOffset) isAdaptive: isAdaptive];
|
|
508
510
|
}
|
|
509
511
|
|
|
510
512
|
RCT_EXPORT_METHOD(setBannerBackgroundColor:(NSString *)adUnitIdentifier hexColorCode:(NSString *)hexColorCode)
|
|
@@ -663,7 +665,7 @@ RCT_EXPORT_METHOD(createMRec:(NSString *)adUnitIdentifier position:(NSString *)m
|
|
|
663
665
|
return;
|
|
664
666
|
}
|
|
665
667
|
|
|
666
|
-
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: mrecPosition withOffset: CGPointZero];
|
|
668
|
+
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: mrecPosition withOffset: CGPointZero isAdaptive: NO];
|
|
667
669
|
}
|
|
668
670
|
|
|
669
671
|
RCT_EXPORT_METHOD(setMRecPlacement:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement)
|
|
@@ -955,6 +957,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier p
|
|
|
955
957
|
|
|
956
958
|
RCT_EXPORT_METHOD(preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
957
959
|
adFormat:(NSString *)adFormatStr
|
|
960
|
+
isAdaptive:(BOOL)isAdaptive
|
|
958
961
|
placement:(nullable NSString *)placement
|
|
959
962
|
customData:(nullable NSString *)customData
|
|
960
963
|
extraParameters:(nullable NSDictionary<NSString *, id> *)extraParameterDict
|
|
@@ -980,6 +983,7 @@ RCT_EXPORT_METHOD(preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
|
980
983
|
|
|
981
984
|
[AppLovinMAXAdView preloadNativeUIComponentAdView: adUnitIdentifier
|
|
982
985
|
adFormat: adFormat
|
|
986
|
+
isAdaptive: isAdaptive
|
|
983
987
|
placement: placement
|
|
984
988
|
customData: customData
|
|
985
989
|
extraParameters: extraParameterDict
|
|
@@ -1267,14 +1271,14 @@ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(double)adViewId
|
|
|
1267
1271
|
|
|
1268
1272
|
#pragma mark - Internal Methods
|
|
1269
1273
|
|
|
1270
|
-
- (void)createAdViewWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset
|
|
1274
|
+
- (void)createAdViewWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset isAdaptive:(BOOL)isAdaptive
|
|
1271
1275
|
{
|
|
1272
1276
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1273
1277
|
|
|
1274
1278
|
[self log: @"Creating %@ with ad unit identifier \"%@\", position: \"%@\", and offset: %@", adFormat, adUnitIdentifier, adViewPosition, NSStringFromCGPoint(offset)];
|
|
1275
1279
|
|
|
1276
1280
|
// Retrieve ad view from the map
|
|
1277
|
-
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: adViewPosition withOffset: offset];
|
|
1281
|
+
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: adViewPosition withOffset: offset isAdaptive: isAdaptive];
|
|
1278
1282
|
adView.hidden = YES;
|
|
1279
1283
|
self.safeAreaBackground.hidden = YES;
|
|
1280
1284
|
|
|
@@ -1322,7 +1326,7 @@ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(double)adViewId
|
|
|
1322
1326
|
|
|
1323
1327
|
[self log: @"Setting placement \"%@\" for \"%@\" with ad unit identifier \"%@\"", placement, adFormat, adUnitIdentifier];
|
|
1324
1328
|
|
|
1325
|
-
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: @"" withOffset: CGPointZero];
|
|
1329
|
+
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: @"" withOffset: CGPointZero isAdaptive: YES];
|
|
1326
1330
|
adView.placement = placement;
|
|
1327
1331
|
});
|
|
1328
1332
|
}
|
|
@@ -1333,7 +1337,7 @@ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(double)adViewId
|
|
|
1333
1337
|
|
|
1334
1338
|
[self log: @"Setting custom data \"%@\" for \"%@\" with ad unit identifier \"%@\"", customData, adFormat, adUnitIdentifier];
|
|
1335
1339
|
|
|
1336
|
-
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: @"" withOffset: CGPointZero];
|
|
1340
|
+
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: @"" withOffset: CGPointZero isAdaptive: YES];
|
|
1337
1341
|
adView.customData = customData;
|
|
1338
1342
|
});
|
|
1339
1343
|
}
|
|
@@ -1392,6 +1396,8 @@ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(double)adViewId
|
|
|
1392
1396
|
}
|
|
1393
1397
|
else if ( [@"adaptive_banner" isEqualToString: key] )
|
|
1394
1398
|
{
|
|
1399
|
+
[self log: @"Setting adaptive banners via extra parameters is deprecated and will be removed in a future plugin version. Please use the BannerAd.createAd(adUnitId: string, position: AdViewPosition, xOffset: number, yOffset: number, isAdaptive: boolean) API to properly configure adaptive banners."];
|
|
1400
|
+
|
|
1395
1401
|
BOOL shouldUseAdaptiveBanner = [NSNumber al_numberWithString: value].boolValue;
|
|
1396
1402
|
if ( shouldUseAdaptiveBanner )
|
|
1397
1403
|
{
|
|
@@ -1544,15 +1550,32 @@ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(double)adViewId
|
|
|
1544
1550
|
|
|
1545
1551
|
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat
|
|
1546
1552
|
{
|
|
1547
|
-
return [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: nil withOffset: CGPointZero];
|
|
1553
|
+
return [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: nil withOffset: CGPointZero isAdaptive: YES];
|
|
1548
1554
|
}
|
|
1549
1555
|
|
|
1550
|
-
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset
|
|
1556
|
+
- (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset isAdaptive:(BOOL)isAdaptive
|
|
1551
1557
|
{
|
|
1552
1558
|
MAAdView *result = self.adViews[adUnitIdentifier];
|
|
1553
1559
|
if ( !result && adViewPosition )
|
|
1554
1560
|
{
|
|
1555
|
-
|
|
1561
|
+
MAAdViewConfiguration *config = [MAAdViewConfiguration configurationWithBuilderBlock:^(MAAdViewConfigurationBuilder *builder) {
|
|
1562
|
+
|
|
1563
|
+
// Set adaptive type only for banner ads. If adaptive is enabled, use ANCHORED; otherwise, fall back to NONE.
|
|
1564
|
+
if ( [adFormat isBannerOrLeaderAd] )
|
|
1565
|
+
{
|
|
1566
|
+
if ( isAdaptive )
|
|
1567
|
+
{
|
|
1568
|
+
builder.adaptiveType = MAAdViewAdaptiveTypeAnchored;
|
|
1569
|
+
}
|
|
1570
|
+
else
|
|
1571
|
+
{
|
|
1572
|
+
builder.adaptiveType = MAAdViewAdaptiveTypeNone;
|
|
1573
|
+
[self.disabledAdaptiveBannerAdUnitIdentifiers addObject: adUnitIdentifier];
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}];
|
|
1577
|
+
|
|
1578
|
+
result = [[MAAdView alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat configuration: config];
|
|
1556
1579
|
result.delegate = self;
|
|
1557
1580
|
result.revenueDelegate = self;
|
|
1558
1581
|
result.userInteractionEnabled = NO;
|
package/ios/AppLovinMAXAdView.h
CHANGED
|
@@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
32
32
|
|
|
33
33
|
+ (void)preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
34
34
|
adFormat:(MAAdFormat *)adFormat
|
|
35
|
+
isAdaptive:(BOOL)isAdaptive
|
|
35
36
|
placement:(nullable NSString *)placement
|
|
36
37
|
customData:(nullable NSString *)customData
|
|
37
38
|
extraParameters:(nullable NSDictionary<NSString *, id> *)extraParameters
|
package/ios/AppLovinMAXAdView.mm
CHANGED
|
@@ -87,6 +87,7 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
|
|
|
87
87
|
|
|
88
88
|
+ (void)preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
89
89
|
adFormat:(MAAdFormat *)adFormat
|
|
90
|
+
isAdaptive:(BOOL)isAdaptive
|
|
90
91
|
placement:(nullable NSString *)placement
|
|
91
92
|
customData:(nullable NSString *)customData
|
|
92
93
|
extraParameters:(nullable NSDictionary<NSString *, id> *)extraParameters
|
|
@@ -94,7 +95,7 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
|
|
|
94
95
|
withPromiseResolver:(RCTPromiseResolveBlock)resolve
|
|
95
96
|
withPromiseRejecter:(RCTPromiseRejectBlock)reject
|
|
96
97
|
{
|
|
97
|
-
AppLovinMAXAdViewUIComponent *preloadedUIComponent = [[AppLovinMAXAdViewUIComponent alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
|
|
98
|
+
AppLovinMAXAdViewUIComponent *preloadedUIComponent = [[AppLovinMAXAdViewUIComponent alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat isAdaptive: isAdaptive];
|
|
98
99
|
preloadedUIComponentInstances[@(preloadedUIComponent.hash)] = preloadedUIComponent;
|
|
99
100
|
|
|
100
101
|
preloadedUIComponent.placement = placement;
|
|
@@ -548,11 +549,6 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
|
|
|
548
549
|
- (void)setAdaptiveBannerEnabled:(BOOL)adaptiveBannerEnabled
|
|
549
550
|
{
|
|
550
551
|
_adaptiveBannerEnabled = adaptiveBannerEnabled;
|
|
551
|
-
|
|
552
|
-
if ( self.uiComponent )
|
|
553
|
-
{
|
|
554
|
-
self.uiComponent.adaptiveBannerEnabled = adaptiveBannerEnabled;
|
|
555
|
-
}
|
|
556
552
|
}
|
|
557
553
|
|
|
558
554
|
- (void)setAutoRefresh:(BOOL)autoRefresh
|
|
@@ -640,14 +636,13 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
|
|
|
640
636
|
{
|
|
641
637
|
[[AppLovinMAX shared] log: @"Mounting the preloaded AdView (%@) for Ad Unit ID %@", self.adViewId, self.adUnitId];
|
|
642
638
|
|
|
643
|
-
self.uiComponent.adaptiveBannerEnabled = [self isAdaptiveBannerEnabled];
|
|
644
639
|
self.uiComponent.autoRefreshEnabled = [self isAutoRefreshEnabled];
|
|
645
640
|
[self.uiComponent attachAdView: self];
|
|
646
641
|
return;
|
|
647
642
|
}
|
|
648
643
|
}
|
|
649
644
|
|
|
650
|
-
self.uiComponent = [[AppLovinMAXAdViewUIComponent alloc] initWithAdUnitIdentifier: adUnitId adFormat: adFormat];
|
|
645
|
+
self.uiComponent = [[AppLovinMAXAdViewUIComponent alloc] initWithAdUnitIdentifier: adUnitId adFormat: adFormat isAdaptive: [self isAdaptiveBannerEnabled]];
|
|
651
646
|
self.adViewId = @(self.uiComponent.hash);
|
|
652
647
|
uiComponentInstances[self.adViewId] = self.uiComponent;
|
|
653
648
|
|
|
@@ -677,7 +672,6 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
|
|
|
677
672
|
self.uiComponent.customData = self.customData;
|
|
678
673
|
self.uiComponent.extraParameters = flattenedExtraParameters;
|
|
679
674
|
self.uiComponent.localExtraParameters = flattenedLocalExtraParameters;
|
|
680
|
-
self.uiComponent.adaptiveBannerEnabled = [self isAdaptiveBannerEnabled];
|
|
681
675
|
self.uiComponent.autoRefreshEnabled = [self isAutoRefreshEnabled];
|
|
682
676
|
|
|
683
677
|
[self.uiComponent attachAdView: self];
|
|
@@ -14,7 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
@property (nonatomic, copy, nullable) NSString *customData;
|
|
15
15
|
@property (nonatomic, copy, nullable) NSDictionary<NSString *, id> *extraParameters;
|
|
16
16
|
@property (nonatomic, copy, nullable) NSDictionary<NSString *, id> *localExtraParameters;
|
|
17
|
-
@property (nonatomic, assign, getter=isAdaptiveBannerEnabled) BOOL adaptiveBannerEnabled;
|
|
18
17
|
@property (nonatomic, assign, getter=isAutoRefreshEnabled) BOOL autoRefreshEnabled;
|
|
19
18
|
|
|
20
19
|
- (void)loadAd;
|
|
@@ -22,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
22
21
|
- (void)detachAdView;
|
|
23
22
|
- (void)destroy;
|
|
24
23
|
|
|
25
|
-
- (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat;
|
|
24
|
+
- (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat isAdaptive:(BOOL)isAdaptive;
|
|
26
25
|
|
|
27
26
|
@end
|
|
28
27
|
|
|
@@ -13,17 +13,30 @@
|
|
|
13
13
|
|
|
14
14
|
@implementation AppLovinMAXAdViewUIComponent
|
|
15
15
|
|
|
16
|
-
- (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat
|
|
16
|
+
- (instancetype)initWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat isAdaptive:(BOOL)isAdaptive
|
|
17
17
|
{
|
|
18
18
|
self = [super init];
|
|
19
19
|
if ( self )
|
|
20
20
|
{
|
|
21
|
-
|
|
21
|
+
MAAdViewConfiguration *config = [MAAdViewConfiguration configurationWithBuilderBlock:^(MAAdViewConfigurationBuilder *builder) {
|
|
22
|
+
|
|
23
|
+
if ( [adFormat isBannerOrLeaderAd] )
|
|
24
|
+
{
|
|
25
|
+
if ( isAdaptive )
|
|
26
|
+
{
|
|
27
|
+
builder.adaptiveType = MAAdViewAdaptiveTypeAnchored;
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
{
|
|
31
|
+
builder.adaptiveType = MAAdViewAdaptiveTypeNone;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}];
|
|
35
|
+
|
|
36
|
+
self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat configuration: config];
|
|
22
37
|
self.adView.delegate = self;
|
|
23
38
|
self.adView.revenueDelegate = self;
|
|
24
|
-
|
|
25
|
-
[self.adView setExtraParameterForKey: @"adaptive_banner" value: @"true"];
|
|
26
|
-
|
|
39
|
+
|
|
27
40
|
// Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
|
|
28
41
|
[self.adView setExtraParameterForKey: @"allow_pause_auto_refresh_immediately" value: @"true"];
|
|
29
42
|
|
|
@@ -50,11 +63,6 @@
|
|
|
50
63
|
self.adView.customData = customData;
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
- (void)setAdaptiveBannerEnabled:(BOOL)adaptiveBannerEnabled
|
|
54
|
-
{
|
|
55
|
-
[self.adView setExtraParameterForKey: @"adaptive_banner" value: adaptiveBannerEnabled ? @"true" : @"false"];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
66
|
- (void)setAutoRefreshEnabled:(BOOL)autoRefresh
|
|
59
67
|
{
|
|
60
68
|
if ( autoRefresh )
|