react-native-applovin-max 6.2.0 → 6.2.1

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.
@@ -35,8 +35,8 @@ android {
35
35
  defaultConfig {
36
36
  minSdkVersion 16
37
37
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
38
- versionCode 6020000
39
- versionName "6.2.0"
38
+ versionCode 6020100
39
+ versionName "6.2.1"
40
40
  }
41
41
 
42
42
  flavorDimensions("default")
@@ -16,6 +16,7 @@ import com.facebook.react.uimanager.ThemedReactContext;
16
16
  import com.facebook.react.uimanager.events.RCTEventEmitter;
17
17
  import com.facebook.react.views.view.ReactViewGroup;
18
18
 
19
+ import java.util.HashMap;
19
20
  import java.util.Map;
20
21
 
21
22
  import androidx.annotation.Nullable;
@@ -27,6 +28,8 @@ class AppLovinMAXAdView
27
28
  extends ReactViewGroup
28
29
  implements MaxAdListener, MaxAdViewAdListener, MaxAdRevenueListener
29
30
  {
31
+ private static final Map<String, MaxAdView> adViewInstances = new HashMap<>( 2 );
32
+
30
33
  private final ThemedReactContext reactContext;
31
34
 
32
35
  @Nullable
@@ -45,6 +48,11 @@ class AppLovinMAXAdView
45
48
  @Nullable
46
49
  private Map<String, Object> localExtraParameters;
47
50
 
51
+ public static MaxAdView getInstance(final String adUnitId)
52
+ {
53
+ return adViewInstances.get( adUnitId );
54
+ }
55
+
48
56
  public AppLovinMAXAdView(final Context context)
49
57
  {
50
58
  super( context );
@@ -268,6 +276,8 @@ class AppLovinMAXAdView
268
276
  adView.loadAd();
269
277
 
270
278
  addView( adView );
279
+
280
+ adViewInstances.put( adUnitId, adView );
271
281
  }, 250 );
272
282
  }
273
283
 
@@ -277,6 +287,8 @@ class AppLovinMAXAdView
277
287
  {
278
288
  AppLovinMAXModule.d( "Unmounting MaxAdView: " + adView );
279
289
 
290
+ adViewInstances.remove( adView.getAdUnitId() );
291
+
280
292
  removeView( adView );
281
293
 
282
294
  adView.setListener( null );
@@ -2711,16 +2711,29 @@ public class AppLovinMAXModule
2711
2711
  MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "setAmazonResult" );
2712
2712
  if ( interstitial == null )
2713
2713
  {
2714
- e( "Unable to set Amazon result - unable to retrieve interstitial" );
2714
+ e( "Failed to set Amazon result - unable to retrieve interstitial" );
2715
2715
  return;
2716
2716
  }
2717
2717
 
2718
2718
  interstitial.setLocalExtraParameter( key, result );
2719
2719
  }
2720
- else
2720
+ else // MaxAdFormat.BANNER or MaxAdFormat.MREC
2721
2721
  {
2722
- MaxAdView adView = retrieveAdView( adUnitId, adFormat );
2723
- adView.setLocalExtraParameter( key, result );
2722
+ MaxAdView adView = AppLovinMAXAdView.getInstance( adUnitId );
2723
+
2724
+ if ( adView == null )
2725
+ {
2726
+ adView = retrieveAdView( adUnitId, adFormat );
2727
+ }
2728
+
2729
+ if ( adView != null )
2730
+ {
2731
+ adView.setLocalExtraParameter( key, result );
2732
+ }
2733
+ else
2734
+ {
2735
+ e( "Failed to set Amazon result - unable to retrieve " + adFormat );
2736
+ }
2724
2737
  }
2725
2738
  }
2726
2739
 
package/ios/AppLovinMAX.m CHANGED
@@ -7,6 +7,7 @@
7
7
  //
8
8
 
9
9
  #import "AppLovinMAX.h"
10
+ #import "AppLovinMAXAdView.h"
10
11
  #import "AppLovinMAXNativeAdView.h"
11
12
 
12
13
  #define ROOT_VIEW_CONTROLLER (UIApplication.sharedApplication.keyWindow.rootViewController)
@@ -2266,12 +2267,31 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
2266
2267
  if ( adFormat == MAAdFormat.interstitial )
2267
2268
  {
2268
2269
  MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
2270
+ if ( !interstitial )
2271
+ {
2272
+ [self log: @"Failed to set Amazon result - unable to find interstitial"];
2273
+ return;
2274
+ }
2275
+
2269
2276
  [interstitial setLocalExtraParameterForKey: key value: result];
2270
2277
  }
2271
- else
2278
+ else // MAAdFormat.banner or MAAdFormat.mrec
2272
2279
  {
2273
- MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
2274
- [adView setLocalExtraParameterForKey: key value: result];
2280
+ MAAdView *adView = [AppLovinMAXAdView sharedWithAdUnitIdentifier: adUnitIdentifier];
2281
+
2282
+ if ( !adView )
2283
+ {
2284
+ adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
2285
+ }
2286
+
2287
+ if ( adView )
2288
+ {
2289
+ [adView setLocalExtraParameterForKey: key value: result];
2290
+ }
2291
+ else
2292
+ {
2293
+ [self log: @"Failed to set Amazon result - unable to find %@", adFormat];
2294
+ }
2275
2295
  }
2276
2296
  }
2277
2297
 
@@ -7,10 +7,14 @@
7
7
 
8
8
  #import <React/RCTUIManager.h>
9
9
 
10
+ @class MAAdView;
11
+
10
12
  NS_ASSUME_NONNULL_BEGIN
11
13
 
12
14
  @interface AppLovinMAXAdView : UIView
13
15
 
16
+ + (MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
17
+
14
18
  @end
15
19
 
16
20
  NS_ASSUME_NONNULL_END
@@ -35,6 +35,19 @@
35
35
 
36
36
  @implementation AppLovinMAXAdView
37
37
 
38
+ static NSMutableDictionary<NSString *, MAAdView *> *adViewInstances;
39
+
40
+ + (void)initialize
41
+ {
42
+ [super initialize];
43
+ adViewInstances = [NSMutableDictionary dictionaryWithCapacity: 2];
44
+ }
45
+
46
+ + (MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier
47
+ {
48
+ return adViewInstances[adUnitIdentifier];
49
+ }
50
+
38
51
  - (void)setAdUnitId:(NSString *)adUnitId
39
52
  {
40
53
  // Ad Unit ID must be set prior to creating MAAdView
@@ -197,6 +210,8 @@
197
210
  [self.adView.heightAnchor constraintEqualToAnchor: self.heightAnchor],
198
211
  [self.adView.centerXAnchor constraintEqualToAnchor: self.centerXAnchor],
199
212
  [self.adView.centerYAnchor constraintEqualToAnchor: self.centerYAnchor]]];
213
+
214
+ adViewInstances[adUnitId] = self.adView;
200
215
  });
201
216
  }
202
217
 
@@ -211,6 +226,8 @@
211
226
  {
212
227
  [[AppLovinMAX shared] log: @"Unmounting MAAdView: %@", self.adView];
213
228
 
229
+ [adViewInstances removeObjectForKey: self.adUnitId];
230
+
214
231
  self.adView.delegate = nil;
215
232
  self.adView.revenueDelegate = nil;
216
233
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-applovin-max",
3
3
  "author": "AppLovin Corporation",
4
- "version": "6.2.0",
4
+ "version": "6.2.1",
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,7 +11,7 @@ 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_6_2_0" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_2_1" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
@@ -4,7 +4,7 @@ import type { Configuration } from './types/Configuration';
4
4
 
5
5
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
6
6
 
7
- const VERSION = '6.2.0';
7
+ const VERSION = '6.2.1';
8
8
 
9
9
  const initialize = async (sdkKey: string): Promise<Configuration> => {
10
10
  return NativeAppLovinMAX.initialize(VERSION, sdkKey);
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Bucket
3
- uuid = "8322C692-8067-489C-89A1-217F139F4039"
4
- type = "0"
5
- version = "2.0">
6
- <Breakpoints>
7
- <BreakpointProxy
8
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9
- <BreakpointContent
10
- uuid = "1DACA5BD-D4D2-4CD6-BEFD-D951963D77E1"
11
- shouldBeEnabled = "No"
12
- ignoreCount = "0"
13
- continueAfterRunningActions = "No"
14
- filePath = "AppLovinMAX.m"
15
- startingColumnNumber = "9223372036854775807"
16
- endingColumnNumber = "9223372036854775807"
17
- startingLineNumber = "1304"
18
- endingLineNumber = "1304"
19
- landmarkName = "-positionAdViewForAdUnitIdentifier:adFormat:"
20
- landmarkType = "7">
21
- </BreakpointContent>
22
- </BreakpointProxy>
23
- </Breakpoints>
24
- </Bucket>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/src.iml" filepath="$PROJECT_DIR$/.idea/src.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/src/.idea/src.iml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- </component>
8
- </module>
package/src/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>