react-native-applovin-max 5.2.1 → 5.2.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.
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +1 -9
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +27 -13
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +1 -1
- package/src/index.js +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package com.applovin.reactnative;
|
|
2
2
|
|
|
3
|
-
import android.app.Activity;
|
|
4
3
|
import android.content.Context;
|
|
5
4
|
import android.text.TextUtils;
|
|
6
5
|
|
|
@@ -199,13 +198,6 @@ class AppLovinMAXAdView
|
|
|
199
198
|
|
|
200
199
|
private void maybeAttachAdView()
|
|
201
200
|
{
|
|
202
|
-
final Activity currentActivity = reactContext.getCurrentActivity();
|
|
203
|
-
if ( currentActivity == null )
|
|
204
|
-
{
|
|
205
|
-
AppLovinMAXModule.e( "Unable to attach AdView - no current Activity found" );
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
201
|
// Re-assign in case of race condition
|
|
210
202
|
final String adUnitId = this.adUnitId;
|
|
211
203
|
final MaxAdFormat adFormat = this.adFormat;
|
|
@@ -239,7 +231,7 @@ class AppLovinMAXAdView
|
|
|
239
231
|
|
|
240
232
|
AppLovinMAXModule.d( "Attaching MaxAdView for " + adUnitId );
|
|
241
233
|
|
|
242
|
-
adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(),
|
|
234
|
+
adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), reactContext );
|
|
243
235
|
adView.setListener( this );
|
|
244
236
|
adView.setRevenueListener( this );
|
|
245
237
|
adView.setPlacement( placement );
|
|
@@ -434,37 +434,37 @@ public class AppLovinMAXModule
|
|
|
434
434
|
@ReactMethod
|
|
435
435
|
public void setHasUserConsent(final boolean hasUserConsent)
|
|
436
436
|
{
|
|
437
|
-
AppLovinPrivacySettings.setHasUserConsent( hasUserConsent,
|
|
437
|
+
AppLovinPrivacySettings.setHasUserConsent( hasUserConsent, getReactApplicationContext() );
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
@ReactMethod
|
|
441
441
|
public void hasUserConsent(final Promise promise)
|
|
442
442
|
{
|
|
443
|
-
promise.resolve( AppLovinPrivacySettings.hasUserConsent(
|
|
443
|
+
promise.resolve( AppLovinPrivacySettings.hasUserConsent( getReactApplicationContext() ) );
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
@ReactMethod
|
|
447
447
|
public void setIsAgeRestrictedUser(final boolean isAgeRestrictedUser)
|
|
448
448
|
{
|
|
449
|
-
AppLovinPrivacySettings.setIsAgeRestrictedUser( isAgeRestrictedUser,
|
|
449
|
+
AppLovinPrivacySettings.setIsAgeRestrictedUser( isAgeRestrictedUser, getReactApplicationContext() );
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
@ReactMethod
|
|
453
453
|
public void isAgeRestrictedUser(final Promise promise)
|
|
454
454
|
{
|
|
455
|
-
promise.resolve( AppLovinPrivacySettings.isAgeRestrictedUser(
|
|
455
|
+
promise.resolve( AppLovinPrivacySettings.isAgeRestrictedUser( getReactApplicationContext() ) );
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
@ReactMethod
|
|
459
459
|
public void setDoNotSell(final boolean doNotSell)
|
|
460
460
|
{
|
|
461
|
-
AppLovinPrivacySettings.setDoNotSell( doNotSell,
|
|
461
|
+
AppLovinPrivacySettings.setDoNotSell( doNotSell, getReactApplicationContext() );
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
@ReactMethod
|
|
465
465
|
public void isDoNotSell(final Promise promise)
|
|
466
466
|
{
|
|
467
|
-
promise.resolve( AppLovinPrivacySettings.isDoNotSell(
|
|
467
|
+
promise.resolve( AppLovinPrivacySettings.isDoNotSell( getReactApplicationContext() ) );
|
|
468
468
|
}
|
|
469
469
|
|
|
470
470
|
@ReactMethod
|
|
@@ -1274,7 +1274,7 @@ public class AppLovinMAXModule
|
|
|
1274
1274
|
promise.resolve( false );
|
|
1275
1275
|
return;
|
|
1276
1276
|
}
|
|
1277
|
-
|
|
1277
|
+
|
|
1278
1278
|
promise.resolve( rewardedAd.isReady() );
|
|
1279
1279
|
}
|
|
1280
1280
|
|
|
@@ -1697,11 +1697,7 @@ public class AppLovinMAXModule
|
|
|
1697
1697
|
|
|
1698
1698
|
if ( adView.getParent() == null )
|
|
1699
1699
|
{
|
|
1700
|
-
|
|
1701
|
-
final RelativeLayout relativeLayout = new RelativeLayout( currentActivity );
|
|
1702
|
-
currentActivity.addContentView( relativeLayout, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT,
|
|
1703
|
-
LinearLayout.LayoutParams.MATCH_PARENT ) );
|
|
1704
|
-
relativeLayout.addView( adView );
|
|
1700
|
+
maybeAttachToCurrentActivity( adView );
|
|
1705
1701
|
|
|
1706
1702
|
// Position ad view immediately so if publisher sets color before ad loads, it will not be the size of the screen
|
|
1707
1703
|
mAdViewAdFormats.put( adUnitId, adFormat );
|
|
@@ -1826,6 +1822,8 @@ public class AppLovinMAXModule
|
|
|
1826
1822
|
return;
|
|
1827
1823
|
}
|
|
1828
1824
|
|
|
1825
|
+
maybeAttachToCurrentActivity( adView );
|
|
1826
|
+
|
|
1829
1827
|
adView.setVisibility( View.VISIBLE );
|
|
1830
1828
|
adView.startAutoRefresh();
|
|
1831
1829
|
}
|
|
@@ -2030,6 +2028,22 @@ public class AppLovinMAXModule
|
|
|
2030
2028
|
} );
|
|
2031
2029
|
}
|
|
2032
2030
|
|
|
2031
|
+
private void maybeAttachToCurrentActivity(final MaxAdView adView)
|
|
2032
|
+
{
|
|
2033
|
+
if ( adView.getParent() == null )
|
|
2034
|
+
{
|
|
2035
|
+
final Activity currentActivity = maybeGetCurrentActivity();
|
|
2036
|
+
if ( currentActivity != null )
|
|
2037
|
+
{
|
|
2038
|
+
final RelativeLayout relativeLayout = new RelativeLayout( getReactApplicationContext() );
|
|
2039
|
+
relativeLayout.addView( adView );
|
|
2040
|
+
|
|
2041
|
+
currentActivity.addContentView( relativeLayout, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT,
|
|
2042
|
+
LinearLayout.LayoutParams.MATCH_PARENT ) );
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2033
2047
|
@Nullable
|
|
2034
2048
|
private MaxInterstitialAd retrieveInterstitial(final String adUnitId, final String callingMethod)
|
|
2035
2049
|
{
|
|
@@ -2101,7 +2115,7 @@ public class AppLovinMAXModule
|
|
|
2101
2115
|
MaxAdView result = mAdViews.get( adUnitId );
|
|
2102
2116
|
if ( result == null && adViewPosition != null && adViewOffsetPixels != null )
|
|
2103
2117
|
{
|
|
2104
|
-
result = new MaxAdView( adUnitId, adFormat, sdk,
|
|
2118
|
+
result = new MaxAdView( adUnitId, adFormat, sdk, getReactApplicationContext() );
|
|
2105
2119
|
result.setListener( this );
|
|
2106
2120
|
result.setRevenueListener( this );
|
|
2107
2121
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-applovin-max",
|
|
3
3
|
"author": "AppLovin Corporation",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.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,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_5_2_3" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/AppLovinMAX*.{h,m}"
|
|
17
17
|
|