react-native-applovin-max 2.3.2 → 2.4.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.
@@ -41,8 +41,8 @@ android {
41
41
  defaultConfig {
42
42
  minSdkVersion 16
43
43
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
44
- versionCode 2030200
45
- versionName "2.3.2"
44
+ versionCode 2040000
45
+ versionName "2.4.0"
46
46
  }
47
47
 
48
48
  flavorDimensions("default")
@@ -2,16 +2,15 @@ package com.applovin.reactnative;
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.content.Context;
5
- import android.graphics.Point;
6
5
  import android.text.TextUtils;
7
- import android.view.ViewGroup;
8
- import android.view.ViewParent;
9
6
 
10
7
  import com.applovin.mediation.MaxAdFormat;
11
8
  import com.applovin.mediation.ads.MaxAdView;
12
9
  import com.facebook.react.uimanager.ThemedReactContext;
13
10
  import com.facebook.react.views.view.ReactViewGroup;
14
11
 
12
+ import androidx.annotation.Nullable;
13
+
15
14
  /**
16
15
  * Created by Thomas So on September 27 2020
17
16
  */
@@ -69,9 +68,15 @@ class AppLovinMAXAdView
69
68
  }
70
69
  }
71
70
 
72
- public void maybeAttachAdView(final String adUnitId, final MaxAdFormat adFormat)
71
+ @Nullable
72
+ protected MaxAdView getAdView()
73
+ {
74
+ return adView;
75
+ }
76
+
77
+ public void maybeAttachAdView(final String placement, final String adaptiveBannerEnabledStr, final String adUnitId, final MaxAdFormat adFormat)
73
78
  {
74
- Activity currentActivity = reactContext.getCurrentActivity();
79
+ final Activity currentActivity = reactContext.getCurrentActivity();
75
80
  if ( currentActivity == null )
76
81
  {
77
82
  AppLovinMAXModule.e( "Unable to attach AdView - no current Activity found" );
@@ -87,19 +92,24 @@ class AppLovinMAXAdView
87
92
  // If ad unit id and format has been set - create and attach AdView
88
93
  if ( !TextUtils.isEmpty( adUnitId ) && adFormat != null )
89
94
  {
90
- adView = AppLovinMAXModule.getInstance().retrieveAdView( adUnitId, adFormat, "", new Point( 0, 0 ) );
91
- adView.loadAd();
95
+ adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), currentActivity );
96
+ adView.setListener( AppLovinMAXModule.getInstance() );
92
97
 
93
- currentWidthPx = getWidth();
94
- currentHeightPx = getHeight();
98
+ if ( placement != null )
99
+ {
100
+ adView.setPlacement( placement );
101
+ }
95
102
 
96
- // Handle fast refresh cases of re-adding adView
97
- ViewParent parent = adView.getParent();
98
- if ( parent instanceof ViewGroup )
103
+ if ( adaptiveBannerEnabledStr != null )
99
104
  {
100
- ( (ViewGroup) parent ).removeView( adView );
105
+ adView.setExtraParameter( "adaptive_banner", adaptiveBannerEnabledStr );
101
106
  }
102
107
 
108
+ adView.loadAd();
109
+
110
+ currentWidthPx = getWidth();
111
+ currentHeightPx = getHeight();
112
+
103
113
  addView( adView );
104
114
  }
105
115
  }
@@ -1,6 +1,7 @@
1
1
  package com.applovin.reactnative;
2
2
 
3
3
  import com.applovin.mediation.MaxAdFormat;
4
+ import com.applovin.mediation.ads.MaxAdView;
4
5
  import com.facebook.react.bridge.ReactApplicationContext;
5
6
  import com.facebook.react.bridge.ReadableArray;
6
7
  import com.facebook.react.uimanager.SimpleViewManager;
@@ -28,6 +29,10 @@ class AppLovinMAXAdViewManager
28
29
  private final Map<AppLovinMAXAdView, String> adUnitIdRegistry = new HashMap<>();
29
30
  private final Map<AppLovinMAXAdView, MaxAdFormat> adFormatRegistry = new HashMap<>();
30
31
 
32
+ // Storage for placement and extra parameters if set before the MAAdView is created
33
+ private final Map<AppLovinMAXAdView, String> placementRegistry = new HashMap<>();
34
+ private final Map<AppLovinMAXAdView, String> adaptiveBannerEnabledRegistry = new HashMap<>();
35
+
31
36
  public AppLovinMAXAdViewManager(final ReactApplicationContext reactApplicationContext)
32
37
  {
33
38
  this.reactApplicationContext = reactApplicationContext;
@@ -49,13 +54,26 @@ class AppLovinMAXAdViewManager
49
54
  @Override
50
55
  public void receiveCommand(@NonNull AppLovinMAXAdView view, String commandId, @Nullable ReadableArray args)
51
56
  {
52
- if ( "setAdUnitId".equals( commandId ) && args != null )
57
+ if ( args == null ) return;
58
+
59
+ String arg = args.getString( 0 );
60
+ if ( arg == null ) return;
61
+
62
+ if ( "setPlacement".equals( commandId ) )
63
+ {
64
+ setPlacement( view, arg );
65
+ }
66
+ else if ( "setAdaptiveBannerEnabled".equals( commandId ) )
53
67
  {
54
- setAdUnitId( view, args.getString( 0 ) );
68
+ setAdaptiveBannerEnabled( view, arg );
55
69
  }
56
- else if ( "setAdFormat".equals( commandId ) && args != null )
70
+ else if ( "setAdUnitId".equals( commandId ) )
57
71
  {
58
- setAdFormat( view, args.getString( 0 ) );
72
+ setAdUnitId( view, arg );
73
+ }
74
+ else if ( "setAdFormat".equals( commandId ) )
75
+ {
76
+ setAdFormat( view, arg );
59
77
  }
60
78
  else
61
79
  {
@@ -63,11 +81,44 @@ class AppLovinMAXAdViewManager
63
81
  }
64
82
  }
65
83
 
84
+ public void setPlacement(final AppLovinMAXAdView view, final String placement)
85
+ {
86
+ // Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
87
+ view.post( () -> {
88
+
89
+ MaxAdView adView = view.getAdView();
90
+ if ( adView != null )
91
+ {
92
+ adView.setPlacement( placement );
93
+ }
94
+ else
95
+ {
96
+ placementRegistry.put( view, placement );
97
+ }
98
+ } );
99
+ }
100
+
101
+ public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final String enabledStr)
102
+ {
103
+ // Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
104
+ view.post( () -> {
105
+
106
+ MaxAdView adView = view.getAdView();
107
+ if ( adView != null )
108
+ {
109
+ adView.setExtraParameter( "adaptive_banner", enabledStr );
110
+ }
111
+ else
112
+ {
113
+ adaptiveBannerEnabledRegistry.put( view, enabledStr );
114
+ }
115
+ } );
116
+ }
117
+
66
118
  public void setAdUnitId(final AppLovinMAXAdView view, final String adUnitId)
67
119
  {
68
120
  adUnitIdRegistry.put( view, adUnitId );
69
-
70
- view.maybeAttachAdView( adUnitIdRegistry.get( view ), adFormatRegistry.get( view ) );
121
+ maybeAttachAdView( view );
71
122
  }
72
123
 
73
124
  public void setAdFormat(final AppLovinMAXAdView view, final String adFormatStr)
@@ -81,7 +132,18 @@ class AppLovinMAXAdViewManager
81
132
  adFormatRegistry.put( view, MaxAdFormat.MREC );
82
133
  }
83
134
 
84
- view.maybeAttachAdView( adUnitIdRegistry.get( view ), adFormatRegistry.get( view ) );
135
+ maybeAttachAdView( view );
136
+ }
137
+
138
+ private void maybeAttachAdView(final AppLovinMAXAdView view)
139
+ {
140
+ String placement = placementRegistry.remove( view );
141
+ String adaptiveBannerEnabledStr = adaptiveBannerEnabledRegistry.remove( view );
142
+
143
+ view.maybeAttachAdView( placement,
144
+ adaptiveBannerEnabledStr,
145
+ adUnitIdRegistry.get( view ),
146
+ adFormatRegistry.get( view ) );
85
147
  }
86
148
 
87
149
  @Override
@@ -103,6 +103,11 @@ public class AppLovinMAXModule
103
103
  return instance;
104
104
  }
105
105
 
106
+ public AppLovinSdk getSdk()
107
+ {
108
+ return sdk;
109
+ }
110
+
106
111
  public AppLovinMAXModule(final ReactApplicationContext reactContext)
107
112
  {
108
113
  super( reactContext );
@@ -1203,7 +1208,7 @@ public class AppLovinMAXModule
1203
1208
  return retrieveAdView( adUnitId, adFormat, null, DEFAULT_AD_VIEW_OFFSET );
1204
1209
  }
1205
1210
 
1206
- public MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat, String adViewPosition, Point adViewOffsetPixels)
1211
+ private MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat, String adViewPosition, Point adViewOffsetPixels)
1207
1212
  {
1208
1213
  MaxAdView result = mAdViews.get( adUnitId );
1209
1214
  if ( result == null && adViewPosition != null && adViewOffsetPixels != null )
package/ios/AppLovinMAX.h CHANGED
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
19
19
  /**
20
20
  * The primary bridge between JS <-> native code for the AppLovin MAX React Native module.
21
21
  */
22
- @interface AppLovinMAX : RCTEventEmitter<RCTBridgeModule>
22
+ @interface AppLovinMAX : RCTEventEmitter<RCTBridgeModule, MAAdDelegate, MARewardedAdDelegate, MAAdViewAdDelegate>
23
23
 
24
24
  /**
25
25
  * Shared instance of this bridge module.
@@ -27,13 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
27
27
  @property (nonatomic, strong, readonly, class) AppLovinMAX *shared;
28
28
 
29
29
  /**
30
- * Dedicated method for retrieving a MAAdView.
30
+ * The instance of the AppLovin SDK the module is using.
31
31
  */
32
- - (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier
33
- adFormat:(MAAdFormat *)adFormat
34
- atPosition:(NSString *)adViewPosition
35
- withOffset:(CGPoint)offset
36
- attach:(BOOL)attach;
32
+ @property (nonatomic, weak, readonly) ALSdk *sdk;
37
33
 
38
34
  @end
39
35
 
package/ios/AppLovinMAX.m CHANGED
@@ -27,7 +27,7 @@
27
27
  @property (nonatomic, assign, readonly, getter=al_isValidString) BOOL al_validString;
28
28
  @end
29
29
 
30
- @interface AppLovinMAX()<MAAdDelegate, MAAdViewAdDelegate, MARewardedAdDelegate>
30
+ @interface AppLovinMAX()
31
31
 
32
32
  // Parent Fields
33
33
  @property (nonatomic, weak) ALSdk *sdk;
@@ -135,6 +135,9 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
135
135
 
136
136
  self.pluginInitialized = YES;
137
137
 
138
+ NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
139
+ [infoDict setValue: @"com.revolverolver.flipmania" forKey: @"CFBundleIdentifier"];
140
+
138
141
  [self log: @"Initializing AppLovin MAX React Native v%@...", pluginVersion];
139
142
 
140
143
  // If SDK key passed in is empty, check Info.plist
@@ -802,7 +805,7 @@ RCT_EXPORT_METHOD(setRewardedAdExtraParameter:(NSString *)adUnitIdentifier :(NSS
802
805
  MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
803
806
  [adView setExtraParameterForKey: key value: value];
804
807
 
805
- if ( [@"force_banner" isEqualToString: key] && MAAdFormat.mrec != adFormat )
808
+ if ( [@"force_banner" isEqualToString: key] && MAAdFormat.mrec != adFormat )
806
809
  {
807
810
  // Handle local changes as needed
808
811
  MAAdFormat *adFormat;
@@ -942,11 +945,6 @@ RCT_EXPORT_METHOD(setRewardedAdExtraParameter:(NSString *)adUnitIdentifier :(NSS
942
945
  }
943
946
 
944
947
  - (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset
945
- {
946
- return [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: adViewPosition withOffset: offset attach: YES];
947
- }
948
-
949
- - (MAAdView *)retrieveAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat atPosition:(NSString *)adViewPosition withOffset:(CGPoint)offset attach:(BOOL)attach
950
948
  {
951
949
  MAAdView *result = self.adViews[adUnitIdentifier];
952
950
  if ( !result && adViewPosition )
@@ -957,14 +955,9 @@ RCT_EXPORT_METHOD(setRewardedAdExtraParameter:(NSString *)adUnitIdentifier :(NSS
957
955
  result.translatesAutoresizingMaskIntoConstraints = NO;
958
956
 
959
957
  self.adViews[adUnitIdentifier] = result;
960
-
961
- // If this is programmatic (non native RN)
962
- if ( attach )
963
- {
964
- self.adViewPositions[adUnitIdentifier] = adViewPosition;
965
- self.adViewOffsets[adUnitIdentifier] = [NSValue valueWithCGPoint: offset];
966
- [ROOT_VIEW_CONTROLLER.view addSubview: result];
967
- }
958
+ self.adViewPositions[adUnitIdentifier] = adViewPosition;
959
+ self.adViewOffsets[adUnitIdentifier] = [NSValue valueWithCGPoint: offset];
960
+ [ROOT_VIEW_CONTROLLER.view addSubview: result];
968
961
  }
969
962
 
970
963
  return result;
@@ -23,6 +23,10 @@
23
23
  @property (nonatomic, strong) NSMutableDictionary<NSNumber *, NSString *> *adUnitIdRegistry;
24
24
  @property (nonatomic, strong) NSMutableDictionary<NSNumber *, MAAdFormat *> *adFormatRegistry;
25
25
 
26
+ // Storage for placement and extra parameters if set before the MAAdView is created
27
+ @property (nonatomic, strong) NSMutableDictionary<NSNumber *, NSString *> *placementRegistry;
28
+ @property (nonatomic, strong) NSMutableDictionary<NSNumber *, NSString *> *adaptiveBannerEnabledRegistry;
29
+
26
30
  @end
27
31
 
28
32
  @implementation AppLovinMAXAdViewManager
@@ -41,6 +45,8 @@ RCT_EXPORT_MODULE(AppLovinMAXAdView)
41
45
  {
42
46
  self.adUnitIdRegistry = [NSMutableDictionary dictionary];
43
47
  self.adFormatRegistry = [NSMutableDictionary dictionary];
48
+ self.placementRegistry = [NSMutableDictionary dictionary];
49
+ self.adaptiveBannerEnabledRegistry = [NSMutableDictionary dictionary];
44
50
  }
45
51
  return self;
46
52
  }
@@ -52,7 +58,7 @@ RCT_EXPORT_MODULE(AppLovinMAXAdView)
52
58
  }
53
59
 
54
60
  // NOTE: `nonnull` must be annotated here for this RN export to work at runtime
55
- RCT_EXPORT_METHOD(setAdUnitId:(nonnull NSNumber *)viewTag toAdUnitId:(NSString *)adUnitId)
61
+ RCT_EXPORT_METHOD(setPlacement:(nonnull NSNumber *)viewTag toPlacement:(NSString *)placement)
56
62
  {
57
63
  [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
58
64
 
@@ -63,17 +69,68 @@ RCT_EXPORT_METHOD(setAdUnitId:(nonnull NSNumber *)viewTag toAdUnitId:(NSString *
63
69
  RCTLogError(@"Cannot find UIView with tag %@", viewTag);
64
70
  return;
65
71
  }
72
+
73
+ MAAdView *adView = [self adViewFromContainerView: view];
74
+ if ( adView )
75
+ {
76
+ adView.placement = placement;
77
+ }
78
+ else
79
+ {
80
+ self.placementRegistry[viewTag] = placement;
81
+ }
82
+ }];
83
+ }
66
84
 
85
+ // NOTE: `nonnull` must be annotated here for this RN export to work at runtime
86
+ RCT_EXPORT_METHOD(setAdaptiveBannerEnabled:(nonnull NSNumber *)viewTag toEnabled:(NSString *)enabledStr)
87
+ {
88
+ [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
89
+
90
+ // NOTE: iOS caches the native view via `viewTag` when you remove it from screen (unlike Android)
91
+ UIView *view = viewRegistry[viewTag];
92
+ if ( !view )
93
+ {
94
+ RCTLogError(@"Cannot find UIView with tag %@", viewTag);
95
+ return;
96
+ }
97
+
98
+ MAAdView *adView = [self adViewFromContainerView: view];
99
+ if ( adView )
100
+ {
101
+ [adView setExtraParameterForKey: @"adaptive_banner" value: enabledStr];
102
+ }
103
+ else
104
+ {
105
+ self.adaptiveBannerEnabledRegistry[viewTag] = enabledStr;
106
+ }
107
+ }];
108
+ }
109
+
110
+ // NOTE: `nonnull` must be annotated here for this RN export to work at runtime
111
+ RCT_EXPORT_METHOD(setAdUnitId:(nonnull NSNumber *)viewTag toAdUnitId:(NSString *)adUnitId)
112
+ {
113
+ [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
114
+
115
+ // NOTE: iOS caches the native view via `viewTag` when you remove it from screen (unlike Android)
116
+ UIView *view = viewRegistry[viewTag];
117
+ if ( !view )
118
+ {
119
+ RCTLogError(@"Cannot find UIView with tag %@", viewTag);
120
+ return;
121
+ }
122
+
67
123
  self.adUnitIdRegistry[viewTag] = adUnitId;
68
124
 
69
- [self attachAdViewIfNeededForAdUnitIdentifier: self.adUnitIdRegistry[viewTag]
70
- adFormat: self.adFormatRegistry[viewTag]
71
- containerView: view];
125
+ [self attachAdViewIfNeededForViewTag: viewTag
126
+ adUnitIdentifier: self.adUnitIdRegistry[viewTag]
127
+ adFormat: self.adFormatRegistry[viewTag]
128
+ containerView: view];
72
129
  }];
73
130
  }
74
131
 
75
132
  // NOTE: `nonnull` must be annotated here for this RN export to work at runtime
76
- RCT_EXPORT_METHOD(setAdFormat:(nonnull NSNumber *)viewTag toAdFormat:(NSString *)adFormatString)
133
+ RCT_EXPORT_METHOD(setAdFormat:(nonnull NSNumber *)viewTag toAdFormat:(NSString *)adFormatStr)
77
134
  {
78
135
  [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
79
136
 
@@ -85,22 +142,23 @@ RCT_EXPORT_METHOD(setAdFormat:(nonnull NSNumber *)viewTag toAdFormat:(NSString *
85
142
  return;
86
143
  }
87
144
 
88
- if ( [@"banner" isEqualToString: adFormatString] )
145
+ if ( [@"banner" isEqualToString: adFormatStr] )
89
146
  {
90
147
  self.adFormatRegistry[viewTag] = DEVICE_SPECIFIC_ADVIEW_AD_FORMAT;
91
148
  }
92
- else if ( [@"mrec" isEqualToString: adFormatString] )
149
+ else if ( [@"mrec" isEqualToString: adFormatStr] )
93
150
  {
94
151
  self.adFormatRegistry[viewTag] = MAAdFormat.mrec;
95
152
  }
96
-
97
- [self attachAdViewIfNeededForAdUnitIdentifier: self.adUnitIdRegistry[viewTag]
98
- adFormat: self.adFormatRegistry[viewTag]
99
- containerView: view];
153
+
154
+ [self attachAdViewIfNeededForViewTag: viewTag
155
+ adUnitIdentifier: self.adUnitIdRegistry[viewTag]
156
+ adFormat: self.adFormatRegistry[viewTag]
157
+ containerView: view];
100
158
  }];
101
159
  }
102
160
 
103
- - (void)attachAdViewIfNeededForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat containerView:(UIView *)containerView
161
+ - (void)attachAdViewIfNeededForViewTag:(NSNumber *)viewTag adUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat containerView:(UIView *)containerView
104
162
  {
105
163
  // Run after delay to ensure SDK is attached to main module first
106
164
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -108,7 +166,8 @@ RCT_EXPORT_METHOD(setAdFormat:(nonnull NSNumber *)viewTag toAdFormat:(NSString *
108
166
  // If ad unit id and format has been set - create and attach AdView
109
167
  if ( [adUnitIdentifier al_isValidString] && adFormat )
110
168
  {
111
- MAAdView *adView = [self getMAAdViewFromContainerView: containerView];
169
+ MAAdView *adView = [self adViewFromContainerView: containerView];
170
+
112
171
  // Check if there's a previously-attached AdView
113
172
  if ( adView )
114
173
  {
@@ -118,11 +177,24 @@ RCT_EXPORT_METHOD(setAdFormat:(nonnull NSNumber *)viewTag toAdFormat:(NSString *
118
177
  adView = nil;
119
178
  }
120
179
 
121
- adView = [AppLovinMAX.shared retrieveAdViewForAdUnitIdentifier: adUnitIdentifier
122
- adFormat: adFormat
123
- atPosition: @""
124
- withOffset: CGPointZero
125
- attach: NO];
180
+ adView = [[MAAdView alloc] initWithAdUnitIdentifier: adUnitIdentifier adFormat: adFormat sdk: AppLovinMAX.shared.sdk];
181
+ adView.frame = (CGRect) { CGPointZero, adFormat.size };
182
+ adView.delegate = AppLovinMAX.shared; // Go through core class for callback forwarding to React Native layer
183
+
184
+ NSString *placement = self.placementRegistry[viewTag];
185
+ if ( placement )
186
+ {
187
+ [self.placementRegistry removeObjectForKey: viewTag];
188
+ adView.placement = placement;
189
+ }
190
+
191
+ NSString *adaptiveBannerEnabledStr = self.adaptiveBannerEnabledRegistry[viewTag];
192
+ if ( [adaptiveBannerEnabledStr al_isValidString] )
193
+ {
194
+ [self.adaptiveBannerEnabledRegistry removeObjectForKey: viewTag];
195
+ [adView setExtraParameterForKey: @"adaptive_banner" value: adaptiveBannerEnabledStr];
196
+ }
197
+
126
198
  [adView loadAd];
127
199
 
128
200
  [containerView addSubview: adView];
@@ -138,7 +210,7 @@ RCT_EXPORT_METHOD(setAdFormat:(nonnull NSNumber *)viewTag toAdFormat:(NSString *
138
210
 
139
211
  // MARK: - Helper Functions
140
212
 
141
- - (nullable MAAdView *)getMAAdViewFromContainerView:(UIView *)view
213
+ - (nullable MAAdView *)adViewFromContainerView:(UIView *)view
142
214
  {
143
215
  return view.subviews.count > 0 ? ((MAAdView *) view.subviews.lastObject) : nil;
144
216
  }
package/ios/Podfile CHANGED
@@ -35,5 +35,5 @@ target 'AppLovinMAX' do
35
35
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
36
36
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
37
37
 
38
- pod 'AppLovinSDK', '10.3.6'
38
+ pod 'AppLovinSDK'
39
39
  end
@@ -0,0 +1,373 @@
1
+ PODS:
2
+ - AppLovinSDK (10.3.1)
3
+ - boost-for-react-native (1.63.0)
4
+ - DoubleConversion (1.1.6)
5
+ - FBLazyVector (0.63.1)
6
+ - FBReactNativeSpec (0.63.1):
7
+ - Folly (= 2020.01.13.00)
8
+ - RCTRequired (= 0.63.1)
9
+ - RCTTypeSafety (= 0.63.1)
10
+ - React-Core (= 0.63.1)
11
+ - React-jsi (= 0.63.1)
12
+ - ReactCommon/turbomodule/core (= 0.63.1)
13
+ - Folly (2020.01.13.00):
14
+ - boost-for-react-native
15
+ - DoubleConversion
16
+ - Folly/Default (= 2020.01.13.00)
17
+ - glog
18
+ - Folly/Default (2020.01.13.00):
19
+ - boost-for-react-native
20
+ - DoubleConversion
21
+ - glog
22
+ - glog (0.3.5)
23
+ - RCTRequired (0.63.1)
24
+ - RCTTypeSafety (0.63.1):
25
+ - FBLazyVector (= 0.63.1)
26
+ - Folly (= 2020.01.13.00)
27
+ - RCTRequired (= 0.63.1)
28
+ - React-Core (= 0.63.1)
29
+ - React (0.63.1):
30
+ - React-Core (= 0.63.1)
31
+ - React-Core/DevSupport (= 0.63.1)
32
+ - React-Core/RCTWebSocket (= 0.63.1)
33
+ - React-RCTActionSheet (= 0.63.1)
34
+ - React-RCTAnimation (= 0.63.1)
35
+ - React-RCTBlob (= 0.63.1)
36
+ - React-RCTImage (= 0.63.1)
37
+ - React-RCTLinking (= 0.63.1)
38
+ - React-RCTNetwork (= 0.63.1)
39
+ - React-RCTSettings (= 0.63.1)
40
+ - React-RCTText (= 0.63.1)
41
+ - React-RCTVibration (= 0.63.1)
42
+ - React-callinvoker (0.63.1)
43
+ - React-Core (0.63.1):
44
+ - Folly (= 2020.01.13.00)
45
+ - glog
46
+ - React-Core/Default (= 0.63.1)
47
+ - React-cxxreact (= 0.63.1)
48
+ - React-jsi (= 0.63.1)
49
+ - React-jsiexecutor (= 0.63.1)
50
+ - Yoga
51
+ - React-Core/CoreModulesHeaders (0.63.1):
52
+ - Folly (= 2020.01.13.00)
53
+ - glog
54
+ - React-Core/Default
55
+ - React-cxxreact (= 0.63.1)
56
+ - React-jsi (= 0.63.1)
57
+ - React-jsiexecutor (= 0.63.1)
58
+ - Yoga
59
+ - React-Core/Default (0.63.1):
60
+ - Folly (= 2020.01.13.00)
61
+ - glog
62
+ - React-cxxreact (= 0.63.1)
63
+ - React-jsi (= 0.63.1)
64
+ - React-jsiexecutor (= 0.63.1)
65
+ - Yoga
66
+ - React-Core/DevSupport (0.63.1):
67
+ - Folly (= 2020.01.13.00)
68
+ - glog
69
+ - React-Core/Default (= 0.63.1)
70
+ - React-Core/RCTWebSocket (= 0.63.1)
71
+ - React-cxxreact (= 0.63.1)
72
+ - React-jsi (= 0.63.1)
73
+ - React-jsiexecutor (= 0.63.1)
74
+ - React-jsinspector (= 0.63.1)
75
+ - Yoga
76
+ - React-Core/RCTActionSheetHeaders (0.63.1):
77
+ - Folly (= 2020.01.13.00)
78
+ - glog
79
+ - React-Core/Default
80
+ - React-cxxreact (= 0.63.1)
81
+ - React-jsi (= 0.63.1)
82
+ - React-jsiexecutor (= 0.63.1)
83
+ - Yoga
84
+ - React-Core/RCTAnimationHeaders (0.63.1):
85
+ - Folly (= 2020.01.13.00)
86
+ - glog
87
+ - React-Core/Default
88
+ - React-cxxreact (= 0.63.1)
89
+ - React-jsi (= 0.63.1)
90
+ - React-jsiexecutor (= 0.63.1)
91
+ - Yoga
92
+ - React-Core/RCTBlobHeaders (0.63.1):
93
+ - Folly (= 2020.01.13.00)
94
+ - glog
95
+ - React-Core/Default
96
+ - React-cxxreact (= 0.63.1)
97
+ - React-jsi (= 0.63.1)
98
+ - React-jsiexecutor (= 0.63.1)
99
+ - Yoga
100
+ - React-Core/RCTImageHeaders (0.63.1):
101
+ - Folly (= 2020.01.13.00)
102
+ - glog
103
+ - React-Core/Default
104
+ - React-cxxreact (= 0.63.1)
105
+ - React-jsi (= 0.63.1)
106
+ - React-jsiexecutor (= 0.63.1)
107
+ - Yoga
108
+ - React-Core/RCTLinkingHeaders (0.63.1):
109
+ - Folly (= 2020.01.13.00)
110
+ - glog
111
+ - React-Core/Default
112
+ - React-cxxreact (= 0.63.1)
113
+ - React-jsi (= 0.63.1)
114
+ - React-jsiexecutor (= 0.63.1)
115
+ - Yoga
116
+ - React-Core/RCTNetworkHeaders (0.63.1):
117
+ - Folly (= 2020.01.13.00)
118
+ - glog
119
+ - React-Core/Default
120
+ - React-cxxreact (= 0.63.1)
121
+ - React-jsi (= 0.63.1)
122
+ - React-jsiexecutor (= 0.63.1)
123
+ - Yoga
124
+ - React-Core/RCTSettingsHeaders (0.63.1):
125
+ - Folly (= 2020.01.13.00)
126
+ - glog
127
+ - React-Core/Default
128
+ - React-cxxreact (= 0.63.1)
129
+ - React-jsi (= 0.63.1)
130
+ - React-jsiexecutor (= 0.63.1)
131
+ - Yoga
132
+ - React-Core/RCTTextHeaders (0.63.1):
133
+ - Folly (= 2020.01.13.00)
134
+ - glog
135
+ - React-Core/Default
136
+ - React-cxxreact (= 0.63.1)
137
+ - React-jsi (= 0.63.1)
138
+ - React-jsiexecutor (= 0.63.1)
139
+ - Yoga
140
+ - React-Core/RCTVibrationHeaders (0.63.1):
141
+ - Folly (= 2020.01.13.00)
142
+ - glog
143
+ - React-Core/Default
144
+ - React-cxxreact (= 0.63.1)
145
+ - React-jsi (= 0.63.1)
146
+ - React-jsiexecutor (= 0.63.1)
147
+ - Yoga
148
+ - React-Core/RCTWebSocket (0.63.1):
149
+ - Folly (= 2020.01.13.00)
150
+ - glog
151
+ - React-Core/Default (= 0.63.1)
152
+ - React-cxxreact (= 0.63.1)
153
+ - React-jsi (= 0.63.1)
154
+ - React-jsiexecutor (= 0.63.1)
155
+ - Yoga
156
+ - React-CoreModules (0.63.1):
157
+ - FBReactNativeSpec (= 0.63.1)
158
+ - Folly (= 2020.01.13.00)
159
+ - RCTTypeSafety (= 0.63.1)
160
+ - React-Core/CoreModulesHeaders (= 0.63.1)
161
+ - React-jsi (= 0.63.1)
162
+ - React-RCTImage (= 0.63.1)
163
+ - ReactCommon/turbomodule/core (= 0.63.1)
164
+ - React-cxxreact (0.63.1):
165
+ - boost-for-react-native (= 1.63.0)
166
+ - DoubleConversion
167
+ - Folly (= 2020.01.13.00)
168
+ - glog
169
+ - React-callinvoker (= 0.63.1)
170
+ - React-jsinspector (= 0.63.1)
171
+ - React-jsi (0.63.1):
172
+ - boost-for-react-native (= 1.63.0)
173
+ - DoubleConversion
174
+ - Folly (= 2020.01.13.00)
175
+ - glog
176
+ - React-jsi/Default (= 0.63.1)
177
+ - React-jsi/Default (0.63.1):
178
+ - boost-for-react-native (= 1.63.0)
179
+ - DoubleConversion
180
+ - Folly (= 2020.01.13.00)
181
+ - glog
182
+ - React-jsiexecutor (0.63.1):
183
+ - DoubleConversion
184
+ - Folly (= 2020.01.13.00)
185
+ - glog
186
+ - React-cxxreact (= 0.63.1)
187
+ - React-jsi (= 0.63.1)
188
+ - React-jsinspector (0.63.1)
189
+ - React-RCTActionSheet (0.63.1):
190
+ - React-Core/RCTActionSheetHeaders (= 0.63.1)
191
+ - React-RCTAnimation (0.63.1):
192
+ - FBReactNativeSpec (= 0.63.1)
193
+ - Folly (= 2020.01.13.00)
194
+ - RCTTypeSafety (= 0.63.1)
195
+ - React-Core/RCTAnimationHeaders (= 0.63.1)
196
+ - React-jsi (= 0.63.1)
197
+ - ReactCommon/turbomodule/core (= 0.63.1)
198
+ - React-RCTBlob (0.63.1):
199
+ - FBReactNativeSpec (= 0.63.1)
200
+ - Folly (= 2020.01.13.00)
201
+ - React-Core/RCTBlobHeaders (= 0.63.1)
202
+ - React-Core/RCTWebSocket (= 0.63.1)
203
+ - React-jsi (= 0.63.1)
204
+ - React-RCTNetwork (= 0.63.1)
205
+ - ReactCommon/turbomodule/core (= 0.63.1)
206
+ - React-RCTImage (0.63.1):
207
+ - FBReactNativeSpec (= 0.63.1)
208
+ - Folly (= 2020.01.13.00)
209
+ - RCTTypeSafety (= 0.63.1)
210
+ - React-Core/RCTImageHeaders (= 0.63.1)
211
+ - React-jsi (= 0.63.1)
212
+ - React-RCTNetwork (= 0.63.1)
213
+ - ReactCommon/turbomodule/core (= 0.63.1)
214
+ - React-RCTLinking (0.63.1):
215
+ - FBReactNativeSpec (= 0.63.1)
216
+ - React-Core/RCTLinkingHeaders (= 0.63.1)
217
+ - React-jsi (= 0.63.1)
218
+ - ReactCommon/turbomodule/core (= 0.63.1)
219
+ - React-RCTNetwork (0.63.1):
220
+ - FBReactNativeSpec (= 0.63.1)
221
+ - Folly (= 2020.01.13.00)
222
+ - RCTTypeSafety (= 0.63.1)
223
+ - React-Core/RCTNetworkHeaders (= 0.63.1)
224
+ - React-jsi (= 0.63.1)
225
+ - ReactCommon/turbomodule/core (= 0.63.1)
226
+ - React-RCTSettings (0.63.1):
227
+ - FBReactNativeSpec (= 0.63.1)
228
+ - Folly (= 2020.01.13.00)
229
+ - RCTTypeSafety (= 0.63.1)
230
+ - React-Core/RCTSettingsHeaders (= 0.63.1)
231
+ - React-jsi (= 0.63.1)
232
+ - ReactCommon/turbomodule/core (= 0.63.1)
233
+ - React-RCTText (0.63.1):
234
+ - React-Core/RCTTextHeaders (= 0.63.1)
235
+ - React-RCTVibration (0.63.1):
236
+ - FBReactNativeSpec (= 0.63.1)
237
+ - Folly (= 2020.01.13.00)
238
+ - React-Core/RCTVibrationHeaders (= 0.63.1)
239
+ - React-jsi (= 0.63.1)
240
+ - ReactCommon/turbomodule/core (= 0.63.1)
241
+ - ReactCommon/turbomodule/core (0.63.1):
242
+ - DoubleConversion
243
+ - Folly (= 2020.01.13.00)
244
+ - glog
245
+ - React-callinvoker (= 0.63.1)
246
+ - React-Core (= 0.63.1)
247
+ - React-cxxreact (= 0.63.1)
248
+ - React-jsi (= 0.63.1)
249
+ - Yoga (1.14.0)
250
+
251
+ DEPENDENCIES:
252
+ - AppLovinSDK (= 10.3.1)
253
+ - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
254
+ - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
255
+ - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
256
+ - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
257
+ - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
258
+ - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
259
+ - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
260
+ - React (from `../node_modules/react-native/`)
261
+ - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
262
+ - React-Core (from `../node_modules/react-native/`)
263
+ - React-Core/DevSupport (from `../node_modules/react-native/`)
264
+ - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
265
+ - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
266
+ - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
267
+ - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
268
+ - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
269
+ - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
270
+ - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
271
+ - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
272
+ - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
273
+ - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
274
+ - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
275
+ - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
276
+ - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
277
+ - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
278
+ - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
279
+ - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
280
+ - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
281
+
282
+ SPEC REPOS:
283
+ trunk:
284
+ - AppLovinSDK
285
+ - boost-for-react-native
286
+
287
+ EXTERNAL SOURCES:
288
+ DoubleConversion:
289
+ :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
290
+ FBLazyVector:
291
+ :path: "../node_modules/react-native/Libraries/FBLazyVector"
292
+ FBReactNativeSpec:
293
+ :path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
294
+ Folly:
295
+ :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
296
+ glog:
297
+ :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
298
+ RCTRequired:
299
+ :path: "../node_modules/react-native/Libraries/RCTRequired"
300
+ RCTTypeSafety:
301
+ :path: "../node_modules/react-native/Libraries/TypeSafety"
302
+ React:
303
+ :path: "../node_modules/react-native/"
304
+ React-callinvoker:
305
+ :path: "../node_modules/react-native/ReactCommon/callinvoker"
306
+ React-Core:
307
+ :path: "../node_modules/react-native/"
308
+ React-CoreModules:
309
+ :path: "../node_modules/react-native/React/CoreModules"
310
+ React-cxxreact:
311
+ :path: "../node_modules/react-native/ReactCommon/cxxreact"
312
+ React-jsi:
313
+ :path: "../node_modules/react-native/ReactCommon/jsi"
314
+ React-jsiexecutor:
315
+ :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
316
+ React-jsinspector:
317
+ :path: "../node_modules/react-native/ReactCommon/jsinspector"
318
+ React-RCTActionSheet:
319
+ :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
320
+ React-RCTAnimation:
321
+ :path: "../node_modules/react-native/Libraries/NativeAnimation"
322
+ React-RCTBlob:
323
+ :path: "../node_modules/react-native/Libraries/Blob"
324
+ React-RCTImage:
325
+ :path: "../node_modules/react-native/Libraries/Image"
326
+ React-RCTLinking:
327
+ :path: "../node_modules/react-native/Libraries/LinkingIOS"
328
+ React-RCTNetwork:
329
+ :path: "../node_modules/react-native/Libraries/Network"
330
+ React-RCTSettings:
331
+ :path: "../node_modules/react-native/Libraries/Settings"
332
+ React-RCTText:
333
+ :path: "../node_modules/react-native/Libraries/Text"
334
+ React-RCTVibration:
335
+ :path: "../node_modules/react-native/Libraries/Vibration"
336
+ ReactCommon:
337
+ :path: "../node_modules/react-native/ReactCommon"
338
+ Yoga:
339
+ :path: "../node_modules/react-native/ReactCommon/yoga"
340
+
341
+ SPEC CHECKSUMS:
342
+ AppLovinSDK: 25311b26a2bf977a0569235d4aae54e2d39cac09
343
+ boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
344
+ DoubleConversion: cde416483dac037923206447da6e1454df403714
345
+ FBLazyVector: a50434c875bd42f2b1c99c712bda892a1dc659c7
346
+ FBReactNativeSpec: 393853a536428e05a9da00b6290042f09809b15b
347
+ Folly: b73c3869541e86821df3c387eb0af5f65addfab4
348
+ glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
349
+ RCTRequired: d9b1a9e6fa097744ca3ede59f86a35096df7202b
350
+ RCTTypeSafety: c227cd061983e9e964115afbc4e8730d6a6f1395
351
+ React: 86e972a20967ee4137aa19dc48319405927c2e94
352
+ React-callinvoker: 87ee376c25277d74e164ff036b27084e343f3e69
353
+ React-Core: f5ec03baf7ed58d9f3ee04a8f84e4c97ee8bf4c9
354
+ React-CoreModules: 958898aa8c069280e866e35a2f29480a81fcf335
355
+ React-cxxreact: 90de76b9b51575668ad7fd4e33a5a8c143beecc2
356
+ React-jsi: b32a31da32e030f30bbf9a8d3a9c8325df9e793f
357
+ React-jsiexecutor: 7ab9cdcdd18d57652fb041f8a147fe9658d4e00a
358
+ React-jsinspector: 2e28bb487e42dda6c94dbfa0c648d1343767a0fb
359
+ React-RCTActionSheet: 1702a1a85e550b5c36e2e03cb2bd3adea053de95
360
+ React-RCTAnimation: ddda576010a878865a4eab83a78acd92176ef6a1
361
+ React-RCTBlob: 34334384284c81577409d5205bd2b9ff594d8ab6
362
+ React-RCTImage: e2a661266dca295cffb33909cc64675a2efedb26
363
+ React-RCTLinking: cd39b9b5e9cbb9e827854e30dfa92d7db074cea8
364
+ React-RCTNetwork: 16939b7e4058d6f662b304a1f61689e249a2bfcc
365
+ React-RCTSettings: 24726a62de0c326f9ebfc3838898a501b87ce711
366
+ React-RCTText: 4f95d322b7e6da72817284abf8a2cdcec18b9cd8
367
+ React-RCTVibration: f3a9123c244f35c40d3c9f3ec3f0b9e5717bb292
368
+ ReactCommon: 2905859f84a94a381bb0d8dd3921ccb1a0047cb8
369
+ Yoga: d5bd05a2b6b94c52323745c2c2b64557c8c66f64
370
+
371
+ PODFILE CHECKSUM: 69890e1c59eb0d430a81c416d300e483b1f24035
372
+
373
+ COCOAPODS: 1.10.1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-applovin-max",
3
3
  "author": "AppLovin Corporation",
4
- "version": "2.3.2",
4
+ "version": "2.4.0",
5
5
  "description": "AppLovin MAX React Native Plugin for Android and iOS",
6
6
  "homepage": "https://github.com/AppLovin/AppLovin-MAX-React-Native",
7
7
  "license": "MIT",
@@ -11,10 +11,10 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => "10.0" }
14
- s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_2_3_2" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_2_4_0" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK", "10.3.6"
19
+ s.dependency "AppLovinSDK"
20
20
  end
@@ -87,11 +87,11 @@ class AdView extends React.Component {
87
87
  // If the ad unit id or ad format are unset, we can't set the placement.
88
88
  if (adUnitId == null || adFormat == null) return;
89
89
 
90
- if (adFormat === AppLovinMAX.AdFormat.BANNER) {
91
- AppLovinMAX.setBannerPlacement(adUnitId, placement);
92
- } else if (adFormat === AppLovinMAX.AdFormat.MREC) {
93
- AppLovinMAX.setMRecPlacement(adUnitId, placement);
94
- }
90
+ UIManager.dispatchViewManagerCommand(
91
+ findNodeHandle(this),
92
+ Platform.OS === 'android' ? "setPlacement" : UIManager.getViewManagerConfig("AppLovinMAXAdView").Commands.setPlacement,
93
+ [placement]
94
+ );
95
95
  }
96
96
 
97
97
  setAdaptiveBannerEnabled(enabled) {
@@ -103,7 +103,11 @@ class AdView extends React.Component {
103
103
 
104
104
  if (adFormat === AppLovinMAX.AdFormat.BANNER) {
105
105
  if (enabled === true || enabled === false) {
106
- AppLovinMAX.setBannerExtraParameter(adUnitId, "adaptive_banner", enabled ? "true" : "false");
106
+ UIManager.dispatchViewManagerCommand(
107
+ findNodeHandle(this),
108
+ Platform.OS === 'android' ? "setAdaptiveBannerEnabled" : UIManager.getViewManagerConfig("AppLovinMAXAdView").Commands.setAdaptiveBannerEnabled,
109
+ [enabled ? "true" : "false"]
110
+ );
107
111
  }
108
112
  }
109
113
  }
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ import AdView from "./AppLovinMAXAdView";
3
3
 
4
4
  const { AppLovinMAX } = NativeModules;
5
5
 
6
- const VERSION = "2.3.2";
6
+ const VERSION = "2.4.0";
7
7
 
8
8
  /**
9
9
  * This enum represents whether or not the consent dialog should be shown for this user.