react-native-applovin-max 2.4.1 → 2.5.2

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 2040100
45
- versionName "2.4.1"
44
+ versionCode 2050200
45
+ versionName "2.5.2"
46
46
  }
47
47
 
48
48
  flavorDimensions("default")
@@ -151,5 +151,5 @@ dependencies {
151
151
 
152
152
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
153
153
 
154
- implementation 'com.applovin:applovin-sdk:+'
154
+ implementation 'com.applovin:applovin-sdk:10.3.5'
155
155
  }
@@ -152,6 +152,13 @@ class AppLovinMAXAdViewManager
152
152
  // NOTE: Android destroys the native MaxAdView and calls this method while iOS caches it when you remove it from screen
153
153
  adUnitIdRegistry.remove( view );
154
154
 
155
+ // HACK ALERT: Since current SDK does not respect auto-refresh APIs until _after_ `onAdLoaded()`, explicitly expose view validity to the main module
156
+ MaxAdView adView = view.getAdView();
157
+ if ( adView != null )
158
+ {
159
+ AppLovinMAXModule.sAdViewsToRemove.put( adView.getAdUnitId(), adView );
160
+ }
161
+
155
162
  super.onDropViewInstance( view );
156
163
  }
157
164
  }
@@ -45,6 +45,7 @@ import com.facebook.react.bridge.ReadableMap;
45
45
  import com.facebook.react.bridge.WritableMap;
46
46
 
47
47
  import java.util.ArrayList;
48
+ import java.util.Collections;
48
49
  import java.util.HashMap;
49
50
  import java.util.HashSet;
50
51
  import java.util.List;
@@ -98,6 +99,9 @@ public class AppLovinMAXModule
98
99
  private final List<String> mAdUnitIdsToShowAfterCreate = new ArrayList<>( 2 );
99
100
  private final Set<String> mDisabledAdaptiveBannerAdUnitIds = new HashSet<>( 2 );
100
101
 
102
+ // TODO: Remove when v11.0.0 SDKs are released
103
+ public final static Map<String, MaxAdView> sAdViewsToRemove = Collections.synchronizedMap( new HashMap<>() );
104
+
101
105
  public static AppLovinMAXModule getInstance()
102
106
  {
103
107
  return instance;
@@ -574,7 +578,13 @@ public class AppLovinMAXModule
574
578
  }
575
579
 
576
580
  @ReactMethod()
577
- public void showInterstitial(final String adUnitId, final String placement)
581
+ public void showInterstitial(final String adUnitId)
582
+ {
583
+ showInterstitialWithPlacement( adUnitId, null );
584
+ }
585
+
586
+ @ReactMethod()
587
+ public void showInterstitialWithPlacement(final String adUnitId, final String placement)
578
588
  {
579
589
  MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
580
590
  interstitial.showAd( placement );
@@ -610,7 +620,13 @@ public class AppLovinMAXModule
610
620
  }
611
621
 
612
622
  @ReactMethod()
613
- public void showRewardedAd(final String adUnitId, final String placement)
623
+ public void showRewardedAd(final String adUnitId)
624
+ {
625
+ showRewardedAdWithPlacement( adUnitId, null );
626
+ }
627
+
628
+ @ReactMethod()
629
+ public void showRewardedAdWithPlacement(final String adUnitId, final String placement)
614
630
  {
615
631
  MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
616
632
  rewardedAd.showAd( placement );
@@ -648,6 +664,12 @@ public class AppLovinMAXModule
648
664
  {
649
665
  adView.stopAutoRefresh();
650
666
  }
667
+
668
+ adView = sAdViewsToRemove.remove( ad.getAdUnitId() );
669
+ if ( adView != null )
670
+ {
671
+ adView.stopAutoRefresh();
672
+ }
651
673
  }
652
674
  else if ( MaxAdFormat.INTERSTITIAL == adFormat )
653
675
  {
@@ -1491,8 +1513,8 @@ public class AppLovinMAXModule
1491
1513
  .emit( name, params );
1492
1514
  }
1493
1515
 
1494
- @Override
1495
- @Nullable public Map<String, Object> getConstants()
1516
+ @Override @Nullable
1517
+ public Map<String, Object> getConstants()
1496
1518
  {
1497
1519
  return super.getConstants();
1498
1520
  }
package/ios/AppLovinMAX.m CHANGED
@@ -450,7 +450,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isInterstitialReady:(NSString *)adUnitIde
450
450
  return @([interstitial isReady]);
451
451
  }
452
452
 
453
- RCT_EXPORT_METHOD(showInterstitial:(NSString *)adUnitIdentifier :(NSString *)placement)
453
+ RCT_EXPORT_METHOD(showInterstitial:(NSString *)adUnitIdentifier)
454
+ {
455
+ [self showInterstitialWithPlacement: adUnitIdentifier : nil];
456
+ }
457
+
458
+ RCT_EXPORT_METHOD(showInterstitialWithPlacement:(NSString *)adUnitIdentifier :(NSString *)placement)
454
459
  {
455
460
  MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
456
461
  [interstitial showAdForPlacement: placement];
@@ -476,7 +481,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isRewardedAdReady:(NSString *)adUnitIdent
476
481
  return @([rewardedAd isReady]);
477
482
  }
478
483
 
479
- RCT_EXPORT_METHOD(showRewardedAd:(NSString *)adUnitIdentifier :(NSString *)placement)
484
+ RCT_EXPORT_METHOD(showRewardedAd:(NSString *)adUnitIdentifier)
485
+ {
486
+ [self showRewardedAdWithPlacement: adUnitIdentifier : nil];
487
+ }
488
+
489
+ RCT_EXPORT_METHOD(showRewardedAdWithPlacement:(NSString *)adUnitIdentifier :(NSString *)placement)
480
490
  {
481
491
  MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
482
492
  [rewardedAd showAdForPlacement: placement];
package/ios/Podfile CHANGED
@@ -35,5 +35,6 @@ 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'
38
+ pod 'AppLovinSDK', '10.3.7'
39
+
39
40
  end
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.4.1",
4
+ "version": "2.5.2",
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_4_1" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_2_5_2" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK"
19
+ s.dependency "AppLovinSDK", "10.3.7"
20
20
  end
@@ -0,0 +1,8 @@
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>
@@ -0,0 +1,8 @@
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>
@@ -0,0 +1,6 @@
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>
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.4.1";
6
+ const VERSION = "2.5.2";
7
7
 
8
8
  /**
9
9
  * This enum represents whether or not the consent dialog should be shown for this user.
@@ -76,14 +76,6 @@ export default {
76
76
  initialize(sdkKey, callback) {
77
77
  AppLovinMAX.initialize(VERSION, sdkKey, callback); // Inject VERSION into native code
78
78
  },
79
- // Support for showing ad without placement
80
- showInterstitial(adUnitId) {
81
- AppLovinMAX.showInterstitial(adUnitId, "");
82
- },
83
- // Support for showing ad without placement
84
- showRewardedAd(adUnitId) {
85
- AppLovinMAX.showRewardedAd(adUnitId, "");
86
- },
87
79
 
88
80
  /*----------------------*/
89
81
  /** AUTO-DECLARED APIs **/