react-native-applovin-max 2.4.0 → 2.5.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.
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +7 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +26 -4
- package/ios/AppLovinMAX.m +12 -5
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +1 -1
- package/src/.idea/modules.xml +8 -0
- package/src/.idea/src.iml +8 -0
- package/src/.idea/vcs.xml +6 -0
- package/src/index.js +1 -9
package/android/build.gradle
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
1516
|
+
@Override @Nullable
|
|
1517
|
+
public Map<String, Object> getConstants()
|
|
1496
1518
|
{
|
|
1497
1519
|
return super.getConstants();
|
|
1498
1520
|
}
|
package/ios/AppLovinMAX.m
CHANGED
|
@@ -135,9 +135,6 @@ 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
|
-
|
|
141
138
|
[self log: @"Initializing AppLovin MAX React Native v%@...", pluginVersion];
|
|
142
139
|
|
|
143
140
|
// If SDK key passed in is empty, check Info.plist
|
|
@@ -453,7 +450,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isInterstitialReady:(NSString *)adUnitIde
|
|
|
453
450
|
return @([interstitial isReady]);
|
|
454
451
|
}
|
|
455
452
|
|
|
456
|
-
RCT_EXPORT_METHOD(showInterstitial:(NSString *)adUnitIdentifier
|
|
453
|
+
RCT_EXPORT_METHOD(showInterstitial:(NSString *)adUnitIdentifier)
|
|
454
|
+
{
|
|
455
|
+
[self showInterstitialWithPlacement: adUnitIdentifier : nil];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
RCT_EXPORT_METHOD(showInterstitialWithPlacement:(NSString *)adUnitIdentifier :(NSString *)placement)
|
|
457
459
|
{
|
|
458
460
|
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
|
|
459
461
|
[interstitial showAdForPlacement: placement];
|
|
@@ -479,7 +481,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isRewardedAdReady:(NSString *)adUnitIdent
|
|
|
479
481
|
return @([rewardedAd isReady]);
|
|
480
482
|
}
|
|
481
483
|
|
|
482
|
-
RCT_EXPORT_METHOD(showRewardedAd:(NSString *)adUnitIdentifier
|
|
484
|
+
RCT_EXPORT_METHOD(showRewardedAd:(NSString *)adUnitIdentifier)
|
|
485
|
+
{
|
|
486
|
+
[self showRewardedAdWithPlacement: adUnitIdentifier : nil];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
RCT_EXPORT_METHOD(showRewardedAdWithPlacement:(NSString *)adUnitIdentifier :(NSString *)placement)
|
|
483
490
|
{
|
|
484
491
|
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
|
|
485
492
|
[rewardedAd showAdForPlacement: placement];
|
package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate
CHANGED
|
Binary file
|
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
|
+
"version": "2.5.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 => "
|
|
14
|
+
s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_2_5_1" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/AppLovinMAX*.{h,m}"
|
|
17
17
|
|
|
@@ -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>
|
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.
|
|
6
|
+
const VERSION = "2.5.1";
|
|
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 **/
|