react-native-applovin-max 2.4.2 → 2.5.3

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.
@@ -12,7 +12,7 @@ buildscript {
12
12
 
13
13
  repositories {
14
14
  google()
15
- jcenter()
15
+ mavenCentral()
16
16
  }
17
17
 
18
18
  dependencies {
@@ -41,8 +41,8 @@ android {
41
41
  defaultConfig {
42
42
  minSdkVersion 16
43
43
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
44
- versionCode 2040200
45
- versionName "2.4.2"
44
+ versionCode 2050300
45
+ versionName "2.5.3"
46
46
  }
47
47
 
48
48
  flavorDimensions("default")
@@ -74,7 +74,6 @@ android {
74
74
 
75
75
  repositories {
76
76
  mavenCentral()
77
- jcenter()
78
77
  google()
79
78
 
80
79
  def found = false
@@ -151,5 +150,5 @@ dependencies {
151
150
 
152
151
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
153
152
 
154
- implementation 'com.applovin:applovin-sdk:+'
153
+ implementation 'com.applovin:applovin-sdk:10.3.5'
155
154
  }
@@ -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;
@@ -420,6 +424,9 @@ public class AppLovinMAXModule
420
424
  @ReactMethod()
421
425
  public void setPrivacyPolicyUrl(final String urlString) {}
422
426
 
427
+ @ReactMethod()
428
+ public void setTermsOfServiceUrl(final String urlString) {}
429
+
423
430
  // EVENT TRACKING
424
431
 
425
432
  @ReactMethod()
@@ -574,7 +581,13 @@ public class AppLovinMAXModule
574
581
  }
575
582
 
576
583
  @ReactMethod()
577
- public void showInterstitial(final String adUnitId, final String placement)
584
+ public void showInterstitial(final String adUnitId)
585
+ {
586
+ showInterstitialWithPlacement( adUnitId, null );
587
+ }
588
+
589
+ @ReactMethod()
590
+ public void showInterstitialWithPlacement(final String adUnitId, final String placement)
578
591
  {
579
592
  MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
580
593
  interstitial.showAd( placement );
@@ -610,7 +623,13 @@ public class AppLovinMAXModule
610
623
  }
611
624
 
612
625
  @ReactMethod()
613
- public void showRewardedAd(final String adUnitId, final String placement)
626
+ public void showRewardedAd(final String adUnitId)
627
+ {
628
+ showRewardedAdWithPlacement( adUnitId, null );
629
+ }
630
+
631
+ @ReactMethod()
632
+ public void showRewardedAdWithPlacement(final String adUnitId, final String placement)
614
633
  {
615
634
  MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
616
635
  rewardedAd.showAd( placement );
@@ -648,6 +667,12 @@ public class AppLovinMAXModule
648
667
  {
649
668
  adView.stopAutoRefresh();
650
669
  }
670
+
671
+ adView = sAdViewsToRemove.remove( ad.getAdUnitId() );
672
+ if ( adView != null )
673
+ {
674
+ adView.stopAutoRefresh();
675
+ }
651
676
  }
652
677
  else if ( MaxAdFormat.INTERSTITIAL == adFormat )
653
678
  {
@@ -1491,8 +1516,8 @@ public class AppLovinMAXModule
1491
1516
  .emit( name, params );
1492
1517
  }
1493
1518
 
1494
- @Override
1495
- @Nullable public Map<String, Object> getConstants()
1519
+ @Override @Nullable
1520
+ public Map<String, Object> getConstants()
1496
1521
  {
1497
1522
  return super.getConstants();
1498
1523
  }
package/ios/AppLovinMAX.m CHANGED
@@ -42,6 +42,7 @@
42
42
  @property (nonatomic, strong, nullable) NSNumber *creativeDebuggerEnabledToSet;
43
43
  @property (nonatomic, strong, nullable) NSNumber *consentFlowEnabledToSet;
44
44
  @property (nonatomic, strong, nullable) NSURL *privacyPolicyURLToSet;
45
+ @property (nonatomic, strong, nullable) NSURL *termsOfServiceURLToSet;
45
46
 
46
47
  // Fullscreen Ad Fields
47
48
  @property (nonatomic, strong) NSMutableDictionary<NSString *, MAInterstitialAd *> *interstitials;
@@ -154,9 +155,11 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
154
155
  ALSdkSettings *settings = [[ALSdkSettings alloc] init];
155
156
  settings.consentFlowSettings.enabled = self.consentFlowEnabledToSet.boolValue;
156
157
  settings.consentFlowSettings.privacyPolicyURL = self.privacyPolicyURLToSet;
158
+ settings.consentFlowSettings.termsOfServiceURL = self.termsOfServiceURLToSet;
157
159
 
158
160
  self.consentFlowEnabledToSet = nil;
159
161
  self.privacyPolicyURLToSet = nil;
162
+ self.termsOfServiceURLToSet = nil;
160
163
 
161
164
  // Initialize SDK
162
165
  self.sdk = [ALSdk sharedWithKey: sdkKey settings: settings];
@@ -334,6 +337,11 @@ RCT_EXPORT_METHOD(setPrivacyPolicyUrl:(NSString *)urlString)
334
337
  self.privacyPolicyURLToSet = [NSURL URLWithString: urlString];
335
338
  }
336
339
 
340
+ RCT_EXPORT_METHOD(setTermsOfServiceUrl:(NSString *)urlString)
341
+ {
342
+ self.termsOfServiceURLToSet = [NSURL URLWithString: urlString];
343
+ }
344
+
337
345
  #pragma mark - Event Tracking
338
346
 
339
347
  RCT_EXPORT_METHOD(trackEvent:(NSString *)event :(NSDictionary<NSString *, id> *)parameters)
@@ -450,7 +458,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isInterstitialReady:(NSString *)adUnitIde
450
458
  return @([interstitial isReady]);
451
459
  }
452
460
 
453
- RCT_EXPORT_METHOD(showInterstitial:(NSString *)adUnitIdentifier :(NSString *)placement)
461
+ RCT_EXPORT_METHOD(showInterstitial:(NSString *)adUnitIdentifier)
462
+ {
463
+ [self showInterstitialWithPlacement: adUnitIdentifier : nil];
464
+ }
465
+
466
+ RCT_EXPORT_METHOD(showInterstitialWithPlacement:(NSString *)adUnitIdentifier :(NSString *)placement)
454
467
  {
455
468
  MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
456
469
  [interstitial showAdForPlacement: placement];
@@ -476,7 +489,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isRewardedAdReady:(NSString *)adUnitIdent
476
489
  return @([rewardedAd isReady]);
477
490
  }
478
491
 
479
- RCT_EXPORT_METHOD(showRewardedAd:(NSString *)adUnitIdentifier :(NSString *)placement)
492
+ RCT_EXPORT_METHOD(showRewardedAd:(NSString *)adUnitIdentifier)
493
+ {
494
+ [self showRewardedAdWithPlacement: adUnitIdentifier : nil];
495
+ }
496
+
497
+ RCT_EXPORT_METHOD(showRewardedAdWithPlacement:(NSString *)adUnitIdentifier :(NSString *)placement)
480
498
  {
481
499
  MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
482
500
  [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.2",
4
+ "version": "2.5.3",
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_2" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_2_5_3" }
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
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.2";
6
+ const VERSION = "2.5.3";
7
7
 
8
8
  /**
9
9
  * This enum represents whether or not the consent dialog should be shown for this user.
@@ -111,6 +111,7 @@ export default {
111
111
  /* setCreativeDebuggerEnabled(enabled) */
112
112
  /* setConsentFlowEnabled(enabled) */
113
113
  /* setPrivacyPolicyUrl(urlString) */
114
+ /* setTermsOfServiceUrl(urlString) */
114
115
 
115
116
  /*----------------*/
116
117
  /* EVENT TRACKING */