react-native-applovin-max 8.0.4 → 8.1.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.
Files changed (32) hide show
  1. package/android/build.gradle +3 -3
  2. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +72 -41
  3. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +7 -1
  4. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +45 -6
  5. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +5 -3
  6. package/ios/AppLovinMAX.h +3 -0
  7. package/ios/AppLovinMAX.m +8 -6
  8. package/ios/AppLovinMAXAdView.h +4 -2
  9. package/ios/AppLovinMAXAdView.m +71 -37
  10. package/ios/AppLovinMAXAdViewManager.m +1 -0
  11. package/ios/AppLovinMAXAdViewUIComponent.h +2 -1
  12. package/ios/AppLovinMAXAdViewUIComponent.m +42 -12
  13. package/lib/commonjs/AdView.js +29 -27
  14. package/lib/commonjs/AdView.js.map +1 -1
  15. package/lib/commonjs/AppLovinMAX.js +1 -1
  16. package/lib/commonjs/types/AdInfo.js.map +1 -1
  17. package/lib/module/AdView.js +29 -27
  18. package/lib/module/AdView.js.map +1 -1
  19. package/lib/module/AppLovinMAX.js +1 -1
  20. package/lib/module/types/AdInfo.js.map +1 -1
  21. package/lib/typescript/src/AdView.d.ts +29 -28
  22. package/lib/typescript/src/AdView.d.ts.map +1 -1
  23. package/lib/typescript/src/types/AdInfo.d.ts +9 -0
  24. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  25. package/lib/typescript/src/types/AdViewProps.d.ts +24 -8
  26. package/lib/typescript/src/types/AdViewProps.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/react-native-applovin-max.podspec +2 -2
  29. package/src/AdView.tsx +31 -29
  30. package/src/AppLovinMAX.ts +1 -1
  31. package/src/types/AdInfo.ts +11 -0
  32. package/src/types/AdViewProps.ts +26 -8
@@ -53,8 +53,8 @@ android {
53
53
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
54
54
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
55
55
 
56
- buildConfigField("int", "VERSION_CODE", "8000400")
57
- buildConfigField("String", "VERSION_NAME", "\"8.0.4\"")
56
+ buildConfigField("int", "VERSION_CODE", "8010000")
57
+ buildConfigField("String", "VERSION_NAME", "\"8.1.0\"")
58
58
  }
59
59
 
60
60
  buildTypes {
@@ -85,6 +85,6 @@ dependencies {
85
85
  //noinspection GradleDynamicVersion
86
86
  implementation "com.facebook.react:react-native:0.73.6"
87
87
 
88
- implementation "com.applovin:applovin-sdk:13.0.0"
88
+ implementation "com.applovin:applovin-sdk:13.0.1"
89
89
  }
90
90
 
@@ -21,8 +21,8 @@ import androidx.annotation.Nullable;
21
21
  class AppLovinMAXAdView
22
22
  extends ReactViewGroup
23
23
  {
24
- private static final Map<String, AppLovinMAXAdViewUiComponent> uiComponentInstances = new HashMap<>( 2 );
25
- private static final Map<String, AppLovinMAXAdViewUiComponent> preloadedUiComponentInstances = new HashMap<>( 2 );
24
+ private static final Map<Integer, AppLovinMAXAdViewUiComponent> uiComponentInstances = new HashMap<>( 2 );
25
+ private static final Map<Integer, AppLovinMAXAdViewUiComponent> preloadedUiComponentInstances = new HashMap<>( 2 );
26
26
 
27
27
  private final ReactContext reactContext;
28
28
 
@@ -31,23 +31,47 @@ class AppLovinMAXAdView
31
31
 
32
32
  private String adUnitId;
33
33
  private MaxAdFormat adFormat;
34
+ private int adViewId;
34
35
  @Nullable
35
36
  private String placement;
36
37
  @Nullable
37
38
  private String customData;
38
39
  private boolean adaptiveBannerEnabled;
39
- private boolean autoRefresh;
40
+ private boolean autoRefreshEnabled;
40
41
  private boolean loadOnMount;
41
42
  @Nullable
42
43
  private Map<String, Object> extraParameters;
43
44
  @Nullable
44
45
  private Map<String, Object> localExtraParameters;
45
46
 
47
+ // Returns an MaxAdView to support Amazon integrations. This method returns the first instance
48
+ // that matches the Ad Unit ID, consistent with the behavior introduced when this feature was
49
+ // first implemented.
50
+ @Nullable
46
51
  public static MaxAdView getInstance(final String adUnitId)
47
52
  {
48
- AppLovinMAXAdViewUiComponent uiComponent = preloadedUiComponentInstances.get( adUnitId );
49
- if ( uiComponent == null ) uiComponent = uiComponentInstances.get( adUnitId );
50
- return ( uiComponent != null ) ? uiComponent.getAdView() : null;
53
+ for ( Map.Entry<Integer, AppLovinMAXAdViewUiComponent> entry : preloadedUiComponentInstances.entrySet() )
54
+ {
55
+ if ( entry.getValue().getAdUnitId().equals ( adUnitId ) )
56
+ {
57
+ return entry.getValue().getAdView();
58
+ }
59
+ }
60
+
61
+ for ( Map.Entry<Integer, AppLovinMAXAdViewUiComponent> entry : uiComponentInstances.entrySet() )
62
+ {
63
+ if ( entry.getValue().getAdUnitId().equals( adUnitId ) )
64
+ {
65
+ return entry.getValue().getAdView();
66
+ }
67
+ }
68
+
69
+ return null;
70
+ }
71
+
72
+ public static boolean hasPreloadedAdView(final int adViewId)
73
+ {
74
+ return preloadedUiComponentInstances.get( adViewId ) != null;
51
75
  }
52
76
 
53
77
  public static void preloadNativeUIComponentAdView(final String adUnitId,
@@ -59,15 +83,8 @@ class AppLovinMAXAdView
59
83
  final Promise promise,
60
84
  final ReactContext context)
61
85
  {
62
- AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adUnitId );
63
- if ( preloadedUiComponent != null )
64
- {
65
- promise.reject( new IllegalStateException( "Cannot preload more than one for a single Ad Unit ID" ) );
66
- return;
67
- }
68
-
69
- preloadedUiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, context );
70
- preloadedUiComponentInstances.put( adUnitId, preloadedUiComponent );
86
+ AppLovinMAXAdViewUiComponent preloadedUiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, context );
87
+ preloadedUiComponentInstances.put( preloadedUiComponent.hashCode(), preloadedUiComponent );
71
88
 
72
89
  preloadedUiComponent.setPlacement( placement );
73
90
  preloadedUiComponent.setCustomData( customData );
@@ -76,25 +93,26 @@ class AppLovinMAXAdView
76
93
 
77
94
  preloadedUiComponent.loadAd();
78
95
 
79
- promise.resolve( null );
96
+ promise.resolve( preloadedUiComponent.hashCode() );
80
97
  }
81
98
 
82
- public static void destroyNativeUIComponentAdView(final String adUnitId, final Promise promise)
99
+ public static void destroyNativeUIComponentAdView(final int adViewId, final Promise promise)
83
100
  {
84
- AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adUnitId );
101
+ AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adViewId );
102
+
85
103
  if ( preloadedUiComponent == null )
86
104
  {
87
- promise.reject( new IllegalStateException( "No native UI component found to destroy" ) );
105
+ promise.reject( new IllegalStateException( "No preloaded AdView found to destroy" ) );
88
106
  return;
89
107
  }
90
108
 
91
109
  if ( preloadedUiComponent.hasContainerView() )
92
110
  {
93
- promise.reject( new IllegalStateException( "Cannot destroy - currently in use" ) );
111
+ promise.reject( new IllegalStateException( "Cannot destroy - the preloaded AdView is currently in use" ) );
94
112
  return;
95
113
  }
96
114
 
97
- preloadedUiComponentInstances.remove( adUnitId );
115
+ preloadedUiComponentInstances.remove( adViewId );
98
116
 
99
117
  preloadedUiComponent.detachAdView();
100
118
  preloadedUiComponent.destroy();
@@ -143,6 +161,11 @@ class AppLovinMAXAdView
143
161
  }
144
162
  }
145
163
 
164
+ public void setAdViewId(final int value)
165
+ {
166
+ adViewId = value;
167
+ }
168
+
146
169
  public void setPlacement(@Nullable final String value)
147
170
  {
148
171
  placement = value;
@@ -173,13 +196,13 @@ class AppLovinMAXAdView
173
196
  }
174
197
  }
175
198
 
176
- public void setAutoRefresh(final boolean enabled)
199
+ public void setAutoRefreshEnabled(final boolean enabled)
177
200
  {
178
- autoRefresh = enabled;
201
+ autoRefreshEnabled = enabled;
179
202
 
180
203
  if ( uiComponent != null )
181
204
  {
182
- uiComponent.setAutoRefresh( enabled );
205
+ uiComponent.setAutoRefreshEnabled( enabled );
183
206
  }
184
207
  }
185
208
 
@@ -222,7 +245,7 @@ class AppLovinMAXAdView
222
245
 
223
246
  if ( uiComponent != null )
224
247
  {
225
- uiComponent.setAutoRefresh( false );
248
+ uiComponent.setAutoRefreshEnabled( false );
226
249
  }
227
250
  }
228
251
 
@@ -233,7 +256,7 @@ class AppLovinMAXAdView
233
256
 
234
257
  if ( uiComponent != null )
235
258
  {
236
- uiComponent.setAutoRefresh( autoRefresh );
259
+ uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
237
260
  }
238
261
  }
239
262
 
@@ -272,35 +295,37 @@ class AppLovinMAXAdView
272
295
 
273
296
  if ( uiComponent != null )
274
297
  {
275
- AppLovinMAXModule.e( "Attempting to re-attach with existing native UI component: " + uiComponent.getAdView() );
298
+ AppLovinMAXModule.e( "Attempting to re-attach with existing AdView (" + uiComponent.hashCode() + ") for Ad Unit ID " + adUnitId );
276
299
  return;
277
300
  }
278
301
 
279
- AppLovinMAXModule.d( "Attaching a native UI component for " + adUnitId );
280
-
281
- uiComponent = preloadedUiComponentInstances.get( adUnitId );
302
+ uiComponent = preloadedUiComponentInstances.get( adViewId );
282
303
  if ( uiComponent != null )
283
304
  {
284
- // Attach the preloaded uiComponent if possible, otherwise create a new one for the
285
- // same adUnitId
286
- if ( !uiComponent.hasContainerView() )
305
+ // Attach the preloaded uiComponent if possible, otherwise create a new one for the same adUnitId
306
+ if ( !( uiComponent.hasContainerView() || uiComponent.isAdViewAttached() ) )
287
307
  {
308
+ AppLovinMAXModule.d( "Mounting the preloaded AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
309
+
288
310
  uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
289
- uiComponent.setAutoRefresh( autoRefresh );
311
+ uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
290
312
  uiComponent.attachAdView( AppLovinMAXAdView.this );
291
313
  return;
292
314
  }
293
315
  }
294
316
 
295
317
  uiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, reactContext );
296
- uiComponentInstances.put( adUnitId, uiComponent );
318
+ adViewId = uiComponent.hashCode();
319
+ uiComponentInstances.put( adViewId, uiComponent );
320
+
321
+ AppLovinMAXModule.d( "Mounting a new AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
297
322
 
298
323
  uiComponent.setPlacement( placement );
299
324
  uiComponent.setCustomData( customData );
300
325
  uiComponent.setExtraParameters( extraParameters );
301
326
  uiComponent.setLocalExtraParameters( localExtraParameters );
302
327
  uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
303
- uiComponent.setAutoRefresh( autoRefresh );
328
+ uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
304
329
 
305
330
  uiComponent.attachAdView( AppLovinMAXAdView.this );
306
331
 
@@ -326,15 +351,21 @@ class AppLovinMAXAdView
326
351
  {
327
352
  if ( uiComponent != null )
328
353
  {
329
- AppLovinMAXModule.d( "Unmounting the native UI component: " + uiComponent.getAdView() );
330
-
331
354
  uiComponent.detachAdView();
332
355
 
333
- AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adUnitId );
356
+ AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adViewId );
334
357
 
335
- if ( uiComponent != preloadedUiComponent )
358
+ if ( uiComponent == preloadedUiComponent )
336
359
  {
337
- uiComponentInstances.remove( adUnitId );
360
+ AppLovinMAXModule.d( "Unmounting the preloaded AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
361
+
362
+ uiComponent.setAutoRefreshEnabled( false );
363
+ }
364
+ else
365
+ {
366
+ AppLovinMAXModule.d( "Unmounting the AdView (" + adViewId + ") to destroy for Ad Unit ID " + adUnitId );
367
+
368
+ uiComponentInstances.remove( adViewId );
338
369
  uiComponent.destroy();
339
370
  }
340
371
  }
@@ -83,6 +83,12 @@ class AppLovinMAXAdViewManager
83
83
  view.setAdFormat( adFormatStr );
84
84
  }
85
85
 
86
+ @ReactProp(name = "adViewId")
87
+ public void setAdFormat(final AppLovinMAXAdView view, final int adViewId)
88
+ {
89
+ view.setAdViewId( adViewId );
90
+ }
91
+
86
92
  @ReactProp(name = "placement")
87
93
  public void setPlacement(final AppLovinMAXAdView view, @Nullable final String placement)
88
94
  {
@@ -104,7 +110,7 @@ class AppLovinMAXAdViewManager
104
110
  @ReactProp(name = "autoRefresh")
105
111
  public void setAutoRefresh(final AppLovinMAXAdView view, final boolean enabled)
106
112
  {
107
- view.setAutoRefresh( enabled );
113
+ view.setAutoRefreshEnabled( enabled );
108
114
  }
109
115
 
110
116
  @ReactProp(name = "loadOnMount")
@@ -34,11 +34,12 @@ class AppLovinMAXAdViewUiComponent
34
34
  adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), context );
35
35
  adView.setListener( this );
36
36
  adView.setRevenueListener( this );
37
-
38
37
  adView.setExtraParameter( "adaptive_banner", "true" );
39
38
 
40
39
  // Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
41
40
  adView.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" );
41
+
42
+ adView.stopAutoRefresh();
42
43
  }
43
44
 
44
45
  public MaxAdView getAdView()
@@ -46,6 +47,11 @@ class AppLovinMAXAdViewUiComponent
46
47
  return adView;
47
48
  }
48
49
 
50
+ public String getAdUnitId()
51
+ {
52
+ return adView.getAdUnitId();
53
+ }
54
+
49
55
  public void setPlacement(@Nullable final String value)
50
56
  {
51
57
  adView.setPlacement( value );
@@ -61,7 +67,7 @@ class AppLovinMAXAdViewUiComponent
61
67
  adView.setExtraParameter( "adaptive_banner", Boolean.toString( enabled ) );
62
68
  }
63
69
 
64
- public void setAutoRefresh(final boolean enabled)
70
+ public void setAutoRefreshEnabled(final boolean enabled)
65
71
  {
66
72
  if ( enabled )
67
73
  {
@@ -98,8 +104,23 @@ class AppLovinMAXAdViewUiComponent
98
104
  return containerView != null;
99
105
  }
100
106
 
107
+ // AdView should have no parent when containerView is null, but it retains a parent even after
108
+ // being removed from containerView when attached to react-native-screens views. This happens
109
+ // because react-native-screens replaces the default UI manager with its own, which includes
110
+ // caching for screen navigation.
111
+ public boolean isAdViewAttached()
112
+ {
113
+ return containerView == null && adView.getParent() != null;
114
+ }
115
+
101
116
  public void attachAdView(AppLovinMAXAdView view)
102
117
  {
118
+ if ( isAdViewAttached() )
119
+ {
120
+ AppLovinMAXModule.e( "Cannot attach AdView because it already has an existing parent: " + adView );
121
+ return;
122
+ }
123
+
103
124
  containerView = view;
104
125
  containerView.addView( adView );
105
126
  }
@@ -144,9 +165,13 @@ class AppLovinMAXAdViewUiComponent
144
165
  public void onAdLoaded(@NonNull final MaxAd ad)
145
166
  {
146
167
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
168
+ adInfo.putInt( "adViewId", hashCode() );
147
169
 
148
- // Copy the `adInfo` since sending the same map through the RN bridge more than once will result in `com.facebook.react.bridge.ObjectAlreadyConsumedException: Map already consumed`
149
- AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT, adInfo.copy() );
170
+ if ( AppLovinMAXAdView.hasPreloadedAdView( hashCode() ) )
171
+ {
172
+ // Copy the `adInfo` since sending the same map through the RN bridge more than once will result in `com.facebook.react.bridge.ObjectAlreadyConsumedException: Map already consumed`
173
+ AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT, adInfo.copy() );
174
+ }
150
175
 
151
176
  if ( containerView != null )
152
177
  {
@@ -158,9 +183,13 @@ class AppLovinMAXAdViewUiComponent
158
183
  public void onAdLoadFailed(@NonNull final String adUnitId, @NonNull final MaxError error)
159
184
  {
160
185
  WritableMap adLoadFailedInfo = AppLovinMAXModule.getInstance().getAdLoadFailedInfo( adUnitId, error );
186
+ adLoadFailedInfo.putInt( "adViewId", hashCode() );
161
187
 
162
- // Copy the `adLoadFailedInfo` since sending the same map through the RN bridge more than once will result in `com.facebook.react.bridge.ObjectAlreadyConsumedException: Map already consumed`
163
- AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT, adLoadFailedInfo.copy() );
188
+ if ( AppLovinMAXAdView.hasPreloadedAdView( hashCode() ) )
189
+ {
190
+ // Copy the `adLoadFailedInfo` since sending the same map through the RN bridge more than once will result in `com.facebook.react.bridge.ObjectAlreadyConsumedException: Map already consumed`
191
+ AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT, adLoadFailedInfo.copy() );
192
+ }
164
193
 
165
194
  if ( containerView != null )
166
195
  {
@@ -174,6 +203,8 @@ class AppLovinMAXAdViewUiComponent
174
203
  if ( containerView != null )
175
204
  {
176
205
  WritableMap adDisplayFailedInfo = AppLovinMAXModule.getInstance().getAdDisplayFailedInfo( ad, error );
206
+ adDisplayFailedInfo.putInt( "adViewId", hashCode() );
207
+
177
208
  sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT, adDisplayFailedInfo );
178
209
  }
179
210
  }
@@ -184,6 +215,8 @@ class AppLovinMAXAdViewUiComponent
184
215
  if ( containerView != null )
185
216
  {
186
217
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
218
+ adInfo.putInt( "adViewId", hashCode() );
219
+
187
220
  sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, adInfo );
188
221
  }
189
222
  }
@@ -194,6 +227,8 @@ class AppLovinMAXAdViewUiComponent
194
227
  if ( containerView != null )
195
228
  {
196
229
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
230
+ adInfo.putInt( "adViewId", hashCode() );
231
+
197
232
  sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT, adInfo );
198
233
  }
199
234
  }
@@ -204,6 +239,8 @@ class AppLovinMAXAdViewUiComponent
204
239
  if ( containerView != null )
205
240
  {
206
241
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
242
+ adInfo.putInt( "adViewId", hashCode() );
243
+
207
244
  sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT, adInfo );
208
245
  }
209
246
  }
@@ -214,6 +251,8 @@ class AppLovinMAXAdViewUiComponent
214
251
  if ( containerView != null )
215
252
  {
216
253
  WritableMap adRevenueInfo = AppLovinMAXModule.getInstance().getAdRevenueInfo( ad );
254
+ adRevenueInfo.putInt( "adViewId", hashCode() );
255
+
217
256
  sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, adRevenueInfo );
218
257
  }
219
258
  }
@@ -78,7 +78,7 @@ public class AppLovinMAXModule
78
78
  {
79
79
  private static final String SDK_TAG = "AppLovinSdk";
80
80
  private static final String TAG = "AppLovinMAXModule";
81
- private static final String PLUGIN_VERSION = "8.0.4";
81
+ private static final String PLUGIN_VERSION = "8.1.0";
82
82
 
83
83
  private static final String USER_GEOGRAPHY_GDPR = "G";
84
84
  private static final String USER_GEOGRAPHY_OTHER = "O";
@@ -100,6 +100,8 @@ public class AppLovinMAXModule
100
100
 
101
101
  static
102
102
  {
103
+ ALCompatibleNativeSdkVersions.put( "8.1.0", "13.0.1" );
104
+ ALCompatibleNativeSdkVersions.put( "8.0.5", "13.0.1" );
103
105
  ALCompatibleNativeSdkVersions.put( "8.0.4", "13.0.0" );
104
106
  ALCompatibleNativeSdkVersions.put( "8.0.3", "13.0.0" );
105
107
  ALCompatibleNativeSdkVersions.put( "8.0.2", "13.0.0" );
@@ -1133,9 +1135,9 @@ public class AppLovinMAXModule
1133
1135
  }
1134
1136
 
1135
1137
  @ReactMethod
1136
- public void destroyNativeUIComponentAdView(final String adUnitId, final Promise promise)
1138
+ public void destroyNativeUIComponentAdView(final int adViewId, final Promise promise)
1137
1139
  {
1138
- getReactApplicationContext().runOnUiQueueThread( () -> AppLovinMAXAdView.destroyNativeUIComponentAdView( adUnitId, promise ) );
1140
+ getReactApplicationContext().runOnUiQueueThread( () -> AppLovinMAXAdView.destroyNativeUIComponentAdView( adViewId, promise ) );
1139
1141
  }
1140
1142
 
1141
1143
  // AD CALLBACKS
package/ios/AppLovinMAX.h CHANGED
@@ -21,6 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
21
21
  */
22
22
  @interface AppLovinMAX : RCTEventEmitter<RCTBridgeModule, MAAdDelegate, MARewardedAdDelegate, MAAdViewAdDelegate, MAAdRevenueDelegate>
23
23
 
24
+ extern NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT;
25
+ extern NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT;
26
+
24
27
  /**
25
28
  * Shared instance of this bridge module.
26
29
  */
package/ios/AppLovinMAX.m 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 = @"8.0.4";
76
+ static NSString *const PLUGIN_VERSION = @"8.1.0";
77
77
 
78
78
  static NSString *const USER_GEOGRAPHY_GDPR = @"G";
79
79
  static NSString *const USER_GEOGRAPHY_OTHER = @"O";
@@ -124,9 +124,6 @@ static NSString *const ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT = @"OnAppOpenAdFail
124
124
  static NSString *const ON_APPOPEN_AD_HIDDEN_EVENT = @"OnAppOpenAdHiddenEvent";
125
125
  static NSString *const ON_APPOPEN_AD_REVENUE_PAID = @"OnAppOpenAdRevenuePaid";
126
126
 
127
- static NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT = @"OnNativeUIComponentAdViewAdLoadedEvent";
128
- static NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT = @"OnNativeUIComponentAdViewAdLoadFailedEvent";
129
-
130
127
  static NSString *const TOP_CENTER = @"top_center";
131
128
  static NSString *const TOP_LEFT = @"top_left";
132
129
  static NSString *const TOP_RIGHT = @"top_right";
@@ -141,6 +138,9 @@ static AppLovinMAX *AppLovinMAXShared; // Shared instance of this bridge module.
141
138
 
142
139
  static NSDictionary<NSString *, NSString *> *ALCompatibleNativeSDKVersions;
143
140
 
141
+ NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT = @"OnNativeUIComponentAdViewAdLoadedEvent";
142
+ NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT = @"OnNativeUIComponentAdViewAdLoadFailedEvent";
143
+
144
144
  // To export a module named AppLovinMAX ("RCT" automatically removed)
145
145
  RCT_EXPORT_MODULE()
146
146
 
@@ -149,6 +149,8 @@ RCT_EXPORT_MODULE()
149
149
  [super initialize];
150
150
 
151
151
  ALCompatibleNativeSDKVersions = @{
152
+ @"8.1.0" : @"13.0.1",
153
+ @"8.0.5" : @"13.0.1",
152
154
  @"8.0.4" : @"13.0.0",
153
155
  @"8.0.3" : @"13.0.0",
154
156
  @"8.0.2" : @"13.0.0",
@@ -983,11 +985,11 @@ RCT_EXPORT_METHOD(preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
983
985
  withPromiseRejecter: reject];
984
986
  }
985
987
 
986
- RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(NSString *)adUnitIdentifier
988
+ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(nonnull NSNumber *)adViewId
987
989
  :(RCTPromiseResolveBlock)resolve
988
990
  :(RCTPromiseRejectBlock)reject)
989
991
  {
990
- [AppLovinMAXAdView destroyNativeUIComponentAdView: adUnitIdentifier
992
+ [AppLovinMAXAdView destroyNativeUIComponentAdView: adViewId
991
993
  withPromiseResolver: resolve
992
994
  withPromiseRejecter: reject];
993
995
  }
@@ -21,7 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
21
21
  @property (nonatomic, copy) RCTDirectEventBlock onAdCollapsedEvent;
22
22
  @property (nonatomic, copy) RCTDirectEventBlock onAdRevenuePaidEvent;
23
23
 
24
- + (MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
24
+ + (nullable MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
25
+
26
+ + (BOOL)hasPreloadedAdViewForIdentifier:(NSNumber *)adViewId;
25
27
 
26
28
  + (void)preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
27
29
  adFormat:(MAAdFormat *)adFormat
@@ -32,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
32
34
  withPromiseResolver:(RCTPromiseResolveBlock)resolve
33
35
  withPromiseRejecter:(RCTPromiseRejectBlock)reject;
34
36
 
35
- + (void)destroyNativeUIComponentAdView:(NSString *)adUnitIdentifier
37
+ + (void)destroyNativeUIComponentAdView:(NSNumber *)adViewId
36
38
  withPromiseResolver:(RCTPromiseResolveBlock)resolve
37
39
  withPromiseRejecter:(RCTPromiseRejectBlock)reject;
38
40