react-native-applovin-max 8.0.3 → 8.0.5

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.
@@ -53,8 +53,8 @@ android {
53
53
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
54
54
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
55
55
 
56
- buildConfigField("int", "VERSION_CODE", "8000300")
57
- buildConfigField("String", "VERSION_NAME", "\"8.0.3\"")
56
+ buildConfigField("int", "VERSION_CODE", "8000500")
57
+ buildConfigField("String", "VERSION_NAME", "\"8.0.5\"")
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
 
@@ -276,22 +276,23 @@ class AppLovinMAXAdView
276
276
  return;
277
277
  }
278
278
 
279
- AppLovinMAXModule.d( "Attaching a native UI component for " + adUnitId );
280
-
281
279
  uiComponent = preloadedUiComponentInstances.get( adUnitId );
282
280
  if ( uiComponent != null )
283
281
  {
284
282
  // Attach the preloaded uiComponent if possible, otherwise create a new one for the
285
283
  // same adUnitId
286
- if ( !uiComponent.hasContainerView() )
284
+ if ( !( uiComponent.hasContainerView() || uiComponent.isAdViewAttached() ) )
287
285
  {
288
- uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
286
+ AppLovinMAXModule.d( "Mounting the preloaded native UI component for " + adUnitId );
287
+
289
288
  uiComponent.setAutoRefresh( autoRefresh );
290
289
  uiComponent.attachAdView( AppLovinMAXAdView.this );
291
290
  return;
292
291
  }
293
292
  }
294
293
 
294
+ AppLovinMAXModule.d( "Mounting a new native UI component for " + adUnitId );
295
+
295
296
  uiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, reactContext );
296
297
  uiComponentInstances.put( adUnitId, uiComponent );
297
298
 
@@ -326,14 +327,20 @@ class AppLovinMAXAdView
326
327
  {
327
328
  if ( uiComponent != null )
328
329
  {
329
- AppLovinMAXModule.d( "Unmounting the native UI component: " + uiComponent.getAdView() );
330
-
331
330
  uiComponent.detachAdView();
332
331
 
333
332
  AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adUnitId );
334
333
 
335
- if ( uiComponent != preloadedUiComponent )
334
+ if ( uiComponent == preloadedUiComponent )
336
335
  {
336
+ AppLovinMAXModule.d( "Unmounting the preloaded native UI component: " + uiComponent.getAdView() );
337
+
338
+ uiComponent.setAutoRefresh( false );
339
+ }
340
+ else
341
+ {
342
+ AppLovinMAXModule.d( "Unmounting the native UI component to destroy: " + uiComponent.getAdView() );
343
+
337
344
  uiComponentInstances.remove( adUnitId );
338
345
  uiComponent.destroy();
339
346
  }
@@ -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()
@@ -98,8 +99,23 @@ class AppLovinMAXAdViewUiComponent
98
99
  return containerView != null;
99
100
  }
100
101
 
102
+ // AdView should have no parent when containerView is null, but it retains a parent even after
103
+ // being removed from containerView when attached to react-native-screens views. This happens
104
+ // because react-native-screens replaces the default UI manager with its own, which includes
105
+ // caching for screen navigation.
106
+ public boolean isAdViewAttached()
107
+ {
108
+ return containerView == null && adView.getParent() != null;
109
+ }
110
+
101
111
  public void attachAdView(AppLovinMAXAdView view)
102
112
  {
113
+ if ( isAdViewAttached() )
114
+ {
115
+ AppLovinMAXModule.e( "Cannot attach AdView because it already has an existing parent: " + adView );
116
+ return;
117
+ }
118
+
103
119
  containerView = view;
104
120
  containerView.addView( adView );
105
121
  }
@@ -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.3";
81
+ private static final String PLUGIN_VERSION = "8.0.5";
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.0.5", "13.0.1" );
104
+ ALCompatibleNativeSdkVersions.put( "8.0.4", "13.0.0" );
103
105
  ALCompatibleNativeSdkVersions.put( "8.0.3", "13.0.0" );
104
106
  ALCompatibleNativeSdkVersions.put( "8.0.2", "13.0.0" );
105
107
  ALCompatibleNativeSdkVersions.put( "8.0.1", "13.0.0" );
@@ -337,6 +337,14 @@ public class AppLovinMAXNativeAdView
337
337
  view.setImageDrawable( icon.getDrawable() );
338
338
  }
339
339
  }
340
+ else
341
+ {
342
+ ImageView iconView = (ImageView) nativeAd.getNativeAd().getIconView();
343
+ if ( iconView != null )
344
+ {
345
+ view.setImageDrawable( iconView.getDrawable() );
346
+ }
347
+ }
340
348
  }
341
349
 
342
350
  public void setOptionsView(final int tag)
@@ -379,7 +387,7 @@ public class AppLovinMAXNativeAdView
379
387
  return;
380
388
  }
381
389
 
382
- view.setTag( MEDIA_VIEW_CONTAINER_TAG );
390
+ mediaView.setTag( MEDIA_VIEW_CONTAINER_TAG );
383
391
  clickableViews.add( mediaView );
384
392
 
385
393
  view.addOnLayoutChangeListener( this );
@@ -504,7 +512,7 @@ public class AppLovinMAXNativeAdView
504
512
  nativeAdInfo.putDouble( "mediaContentAspectRatio", aspectRatio );
505
513
  }
506
514
 
507
- nativeAdInfo.putBoolean( "isIconImageAvailable", ( ad.getIcon() != null ) );
515
+ nativeAdInfo.putBoolean( "isIconImageAvailable", ( ad.getIcon() != null || ad.getIconView() != null ) );
508
516
  nativeAdInfo.putBoolean( "isOptionsViewAvailable", ( ad.getOptionsView() != null ) );
509
517
  nativeAdInfo.putBoolean( "isMediaViewAvailable", ( ad.getMediaView() != null ) );
510
518
 
@@ -536,6 +544,10 @@ public class AppLovinMAXNativeAdView
536
544
  jsNativeAd.putBoolean( "image", true );
537
545
  }
538
546
  }
547
+ else if ( ad.getIconView() != null )
548
+ {
549
+ jsNativeAd.putBoolean( "image", true );
550
+ }
539
551
 
540
552
  jsNativeAd.putBoolean( "isOptionsViewAvailable", ( ad.getOptionsView() != null ) );
541
553
  jsNativeAd.putBoolean( "isMediaViewAvailable", ( ad.getMediaView() != null ) );
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.3";
76
+ static NSString *const PLUGIN_VERSION = @"8.0.5";
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
+ @"8.0.5" : @"13.0.1",
153
+ @"8.0.4" : @"13.0.0",
152
154
  @"8.0.3" : @"13.0.0",
153
155
  @"8.0.2" : @"13.0.0",
154
156
  @"8.0.1" : @"13.0.0",
@@ -277,7 +277,11 @@ static NSMutableDictionary<NSString *, AppLovinMAXAdViewUIComponent *> *preloade
277
277
 
278
278
  AppLovinMAXAdViewUIComponent *preloadedUIComponent = preloadedUIComponentInstances[self.adUnitId];
279
279
 
280
- if ( self.uiComponent != preloadedUIComponent )
280
+ if ( self.uiComponent == preloadedUIComponent )
281
+ {
282
+ self.uiComponent.autoRefresh = NO;
283
+ }
284
+ else
281
285
  {
282
286
  [uiComponentInstances removeObjectForKey: self.adUnitId];
283
287
  [self.uiComponent destroy];
@@ -21,11 +21,13 @@
21
21
  self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat sdk: [AppLovinMAX shared].sdk];
22
22
  self.adView.delegate = self;
23
23
  self.adView.revenueDelegate = self;
24
-
24
+
25
25
  [self.adView setExtraParameterForKey: @"adaptive_banner" value: @"true"];
26
26
 
27
27
  // Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
28
28
  [self.adView setExtraParameterForKey: @"allow_pause_auto_refresh_immediately" value: @"true"];
29
+
30
+ [self.adView stopAutoRefresh];
29
31
 
30
32
  // Set a frame size to suppress an error of zero area for MAAdView
31
33
  self.adView.frame = (CGRect) { CGPointZero, adFormat.size };
@@ -231,6 +231,15 @@
231
231
  }
232
232
  }
233
233
  }
234
+ else
235
+ {
236
+ UIView *iconView = self.nativeAd.nativeAd.iconView;
237
+ if ( iconView )
238
+ {
239
+ [view addSubview: iconView];
240
+ [iconView al_pinToSuperview];
241
+ }
242
+ }
234
243
  }
235
244
 
236
245
  - (void)setOptionsView:(NSNumber *)tag
@@ -331,7 +340,7 @@
331
340
  nativeAdInfo[@"mediaContentAspectRatio"] = @(ad.mediaContentAspectRatio);
332
341
  }
333
342
 
334
- nativeAdInfo[@"isIconImageAvailable"] = @(ad.icon != nil);
343
+ nativeAdInfo[@"isIconImageAvailable"] = @(ad.icon != nil || ad.iconView != nil);
335
344
  nativeAdInfo[@"isOptionsViewAvailable"] = @(ad.optionsView != nil);
336
345
  nativeAdInfo[@"isMediaViewAvailable"] = @(ad.mediaView != nil);
337
346
 
@@ -358,6 +367,10 @@
358
367
  jsNativeAd[@"image"] = @(YES);
359
368
  }
360
369
  }
370
+ else if ( ad.iconView )
371
+ {
372
+ jsNativeAd[@"image"] = @(YES);
373
+ }
361
374
 
362
375
  jsNativeAd[@"isOptionsViewAvailable"] = ad.optionsView ? @(YES) : @(NO);
363
376
  jsNativeAd[@"isMediaViewAvailable"] = ad.mediaView ? @(YES) : @(NO);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.ConsentFlowUserGeography = exports.CMPErrorCode = exports.AppTrackingStatus = exports.AppLovinMAX = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const NativeAppLovinMAX = _reactNative.NativeModules.AppLovinMAX;
9
- const VERSION = '8.0.3';
9
+ const VERSION = '8.0.5';
10
10
 
11
11
  /**
12
12
  * This enum represents the user's geography used to determine the type of consent flow shown to the
@@ -1,6 +1,6 @@
1
1
  import { NativeModules } from 'react-native';
2
2
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
3
- const VERSION = '8.0.3';
3
+ const VERSION = '8.0.5';
4
4
 
5
5
  /**
6
6
  * This enum represents the user's geography used to determine the type of consent flow shown to the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-applovin-max",
3
3
  "author": "AppLovin Corporation <support@applovin.com> (https://applovin.com)",
4
- "version": "8.0.3",
4
+ "version": "8.0.5",
5
5
  "description": "AppLovin MAX React Native Plugin for Android and iOS",
6
6
  "main": "lib/commonjs/index",
7
7
  "module": "lib/module/index",
@@ -12,11 +12,11 @@ Pod::Spec.new do |s|
12
12
  s.authors = package["author"]
13
13
 
14
14
  s.platforms = { :ios => min_ios_version_supported }
15
- s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_8_0_3" }
15
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_8_0_5" }
16
16
 
17
17
  s.source_files = "ios/AppLovinMAX*.{h,m}"
18
18
 
19
- s.dependency "AppLovinSDK", "13.0.0"
19
+ s.dependency "AppLovinSDK", "13.0.1"
20
20
 
21
21
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
22
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -4,7 +4,7 @@ import type { Configuration } from './types/Configuration';
4
4
 
5
5
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
6
6
 
7
- const VERSION = '8.0.3';
7
+ const VERSION = '8.0.5';
8
8
 
9
9
  /**
10
10
  * This enum represents the user's geography used to determine the type of consent flow shown to the