react-native-applovin-max 6.4.1 → 6.5.0

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  AppLovin MAX React Native Module for Android and iOS.
4
4
 
5
5
  ## Documentation
6
- Check out our integration docs [here](https://dash.applovin.com/documentation/mediation/react-native/getting-started/integration).
6
+ Check out our integration docs [here](https://developers.applovin.com/en/react-native/overview/integration).
7
7
 
8
8
  ## Demo Apps
9
9
  The `/example` directory contains the demo app. Gradle and CocoaPods automatically pulls in the React Native module for easier debugging.
@@ -13,7 +13,7 @@ buildscript {
13
13
  }
14
14
 
15
15
  dependencies {
16
- classpath 'com.android.tools.build:gradle:3.5.4'
16
+ classpath 'com.android.tools.build:gradle:3.6.4'
17
17
 
18
18
  classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.0"
19
19
  }
@@ -35,8 +35,8 @@ android {
35
35
  defaultConfig {
36
36
  minSdkVersion 16
37
37
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
38
- versionCode 6040100
39
- versionName "6.4.1"
38
+ versionCode 6050000
39
+ versionName "6.5.0"
40
40
  }
41
41
 
42
42
  flavorDimensions("default")
@@ -140,5 +140,5 @@ dependencies {
140
140
  // noinspection GradleDynamicVersion
141
141
  api 'com.facebook.react:react-native:+'
142
142
 
143
- implementation 'com.applovin:applovin-sdk:12.4.2'
143
+ implementation 'com.applovin:applovin-sdk:12.5.0'
144
144
  }
@@ -64,11 +64,9 @@ import java.util.HashSet;
64
64
  import java.util.List;
65
65
  import java.util.Map;
66
66
  import java.util.Set;
67
- import java.util.concurrent.TimeUnit;
68
67
 
69
68
  import androidx.annotation.Nullable;
70
69
 
71
- import static com.applovin.sdk.AppLovinSdkUtils.runOnUiThreadDelayed;
72
70
  import static com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
73
71
 
74
72
  /**
@@ -138,6 +136,7 @@ public class AppLovinMAXModule
138
136
  private static final Point DEFAULT_AD_VIEW_OFFSET = new Point( 0, 0 );
139
137
 
140
138
  public static AppLovinMAXModule instance;
139
+ @Nullable
141
140
  private static Activity sCurrentActivity;
142
141
 
143
142
  // Parent Fields
@@ -237,36 +236,6 @@ public class AppLovinMAXModule
237
236
 
238
237
  @ReactMethod
239
238
  public void initialize(final String pluginVersion, final String sdkKey, final Promise promise)
240
- {
241
- // Check if Activity is available
242
- Activity currentActivity = maybeGetCurrentActivity();
243
- if ( currentActivity != null )
244
- {
245
- performInitialization( pluginVersion, sdkKey, currentActivity, promise );
246
- }
247
- else
248
- {
249
- w( "No current Activity found! Delaying initialization..." );
250
-
251
- runOnUiThreadDelayed( new Runnable()
252
- {
253
- @Override
254
- public void run()
255
- {
256
- Context contextToUse = maybeGetCurrentActivity();
257
- if ( contextToUse == null )
258
- {
259
- w( "Still unable to find current Activity - initializing SDK with application context" );
260
- contextToUse = getReactApplicationContext();
261
- }
262
-
263
- performInitialization( pluginVersion, sdkKey, contextToUse, promise );
264
- }
265
- }, TimeUnit.SECONDS.toMillis( 3 ) );
266
- }
267
- }
268
-
269
- private void performInitialization(final String pluginVersion, final String sdkKey, final Context context, final Promise promise)
270
239
  {
271
240
  // Guard against running init logic multiple times
272
241
  if ( isPluginInitialized )
@@ -375,7 +344,7 @@ public class AppLovinMAXModule
375
344
  setPendingExtraParametersIfNeeded( settings );
376
345
 
377
346
  // Initialize SDK
378
- sdk = AppLovinSdk.getInstance( sdkKeyToUse, settings, context );
347
+ sdk = AppLovinSdk.getInstance( sdkKeyToUse, settings, getReactApplicationContext() );
379
348
  sdk.setPluginVersion( "React-Native-" + pluginVersion );
380
349
  sdk.setMediationProvider( AppLovinMediationProvider.MAX );
381
350
 
@@ -428,40 +397,36 @@ public class AppLovinMAXModule
428
397
  targetingInterestsToSet = null;
429
398
  }
430
399
 
431
- sdk.initializeSdk( new AppLovinSdk.SdkInitializationListener()
432
- {
433
- @Override
434
- public void onSdkInitialized(final AppLovinSdkConfiguration configuration)
435
- {
436
- d( "SDK initialized" );
400
+ sdk.initializeSdk( configuration -> {
437
401
 
438
- sdkConfiguration = configuration;
439
- isSdkInitialized = true;
402
+ d( "SDK initialized" );
440
403
 
441
- windowManager = (WindowManager) context.getSystemService( Context.WINDOW_SERVICE );
404
+ sdkConfiguration = configuration;
405
+ isSdkInitialized = true;
442
406
 
443
- lastRotation = windowManager.getDefaultDisplay().getRotation();
407
+ windowManager = (WindowManager) getReactApplicationContext().getSystemService( Context.WINDOW_SERVICE );
444
408
 
445
- // Enable orientation change listener, so that the ad view positions can be updated when the device is rotated.
446
- new OrientationEventListener( context )
409
+ lastRotation = windowManager.getDefaultDisplay().getRotation();
410
+
411
+ // Enable orientation change listener, so that the ad view positions can be updated when the device is rotated.
412
+ new OrientationEventListener( getReactApplicationContext() )
413
+ {
414
+ @Override
415
+ public void onOrientationChanged(final int orientation)
447
416
  {
448
- @Override
449
- public void onOrientationChanged(final int orientation)
417
+ int newRotation = windowManager.getDefaultDisplay().getRotation();
418
+ if ( newRotation != lastRotation )
450
419
  {
451
- int newRotation = windowManager.getDefaultDisplay().getRotation();
452
- if ( newRotation != lastRotation )
420
+ lastRotation = newRotation;
421
+ for ( final Map.Entry<String, MaxAdFormat> adUnitFormats : mAdViewAdFormats.entrySet() )
453
422
  {
454
- lastRotation = newRotation;
455
- for ( final Map.Entry<String, MaxAdFormat> adUnitFormats : mAdViewAdFormats.entrySet() )
456
- {
457
- positionAdView( adUnitFormats.getKey(), adUnitFormats.getValue() );
458
- }
423
+ positionAdView( adUnitFormats.getKey(), adUnitFormats.getValue() );
459
424
  }
460
425
  }
461
- }.enable();
426
+ }
427
+ }.enable();
462
428
 
463
- promise.resolve( getInitializationMessage() );
464
- }
429
+ promise.resolve( getInitializationMessage() );
465
430
  } );
466
431
  }
467
432
 
@@ -1019,7 +984,7 @@ public class AppLovinMAXModule
1019
984
  return;
1020
985
  }
1021
986
 
1022
- createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, getOffsetPixels( x, y, getCurrentActivity() ) );
987
+ createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, getOffsetPixels( x, y, getReactApplicationContext() ) );
1023
988
  }
1024
989
 
1025
990
  @ReactMethod
@@ -1091,7 +1056,7 @@ public class AppLovinMAXModule
1091
1056
  return;
1092
1057
  }
1093
1058
 
1094
- updateAdViewPosition( adUnitId, mAdViewPositions.get( adUnitId ), getOffsetPixels( x, y, getCurrentActivity() ), getDeviceSpecificBannerAdViewAdFormat() );
1059
+ updateAdViewPosition( adUnitId, mAdViewPositions.get( adUnitId ), getOffsetPixels( x, y, getReactApplicationContext() ), getDeviceSpecificBannerAdViewAdFormat() );
1095
1060
  }
1096
1061
 
1097
1062
  @ReactMethod
@@ -1176,7 +1141,7 @@ public class AppLovinMAXModule
1176
1141
  @ReactMethod
1177
1142
  public void getAdaptiveBannerHeightForWidth(final float width, final Promise promise)
1178
1143
  {
1179
- promise.resolve( getDeviceSpecificBannerAdViewAdFormat().getAdaptiveSize( (int) width, getCurrentActivity() ).getHeight() );
1144
+ promise.resolve( getDeviceSpecificBannerAdViewAdFormat().getAdaptiveSize( (int) width, getReactApplicationContext() ).getHeight() );
1180
1145
  }
1181
1146
 
1182
1147
  // MRECS
@@ -2328,7 +2293,7 @@ public class AppLovinMAXModule
2328
2293
  else if ( TOP_CENTER.equalsIgnoreCase( adViewPosition ) || BOTTOM_CENTER.equalsIgnoreCase( adViewPosition ) )
2329
2294
  {
2330
2295
  int adViewWidthPx = windowRect.width();
2331
- adViewWidthDp = AppLovinSdkUtils.pxToDp( getCurrentActivity(), adViewWidthPx );
2296
+ adViewWidthDp = AppLovinSdkUtils.pxToDp( getReactApplicationContext(), adViewWidthPx );
2332
2297
  }
2333
2298
  // Else use standard widths of 320, 728, or 300
2334
2299
  else
@@ -2343,15 +2308,15 @@ public class AppLovinMAXModule
2343
2308
 
2344
2309
  if ( ( adFormat == MaxAdFormat.BANNER || adFormat == MaxAdFormat.LEADER ) && !isAdaptiveBannerDisabled )
2345
2310
  {
2346
- adViewHeightDp = adFormat.getAdaptiveSize( adViewWidthDp, getCurrentActivity() ).getHeight();
2311
+ adViewHeightDp = adFormat.getAdaptiveSize( adViewWidthDp, getReactApplicationContext() ).getHeight();
2347
2312
  }
2348
2313
  else
2349
2314
  {
2350
2315
  adViewHeightDp = adFormat.getSize().getHeight();
2351
2316
  }
2352
2317
 
2353
- final int widthPx = AppLovinSdkUtils.dpToPx( getCurrentActivity(), adViewWidthDp );
2354
- final int heightPx = AppLovinSdkUtils.dpToPx( getCurrentActivity(), adViewHeightDp );
2318
+ final int widthPx = AppLovinSdkUtils.dpToPx( getReactApplicationContext(), adViewWidthDp );
2319
+ final int heightPx = AppLovinSdkUtils.dpToPx( getReactApplicationContext(), adViewHeightDp );
2355
2320
 
2356
2321
  final RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) adView.getLayoutParams();
2357
2322
  params.height = heightPx;
package/ios/Podfile CHANGED
@@ -35,6 +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', '12.4.1'
38
+ pod 'AppLovinSDK', '12.5.0'
39
39
 
40
40
  end
package/ios/Podfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - AppLovinSDK (12.4.1)
2
+ - AppLovinSDK (12.5.0)
3
3
  - boost-for-react-native (1.63.0)
4
4
  - DoubleConversion (1.1.6)
5
5
  - FBLazyVector (0.63.5)
@@ -249,7 +249,7 @@ PODS:
249
249
  - Yoga (1.14.0)
250
250
 
251
251
  DEPENDENCIES:
252
- - AppLovinSDK (= 12.4.1)
252
+ - AppLovinSDK (= 12.5.0)
253
253
  - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
254
254
  - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
255
255
  - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
@@ -339,7 +339,7 @@ EXTERNAL SOURCES:
339
339
  :path: "../node_modules/react-native/ReactCommon/yoga"
340
340
 
341
341
  SPEC CHECKSUMS:
342
- AppLovinSDK: c57ad0d34625c971d2db127f8ef60570b28ff51a
342
+ AppLovinSDK: 626d2aea57ae1bf9280d2012e8e20c521c58ce28
343
343
  boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
344
344
  DoubleConversion: cde416483dac037923206447da6e1454df403714
345
345
  FBLazyVector: 352a8ca9bbc8e2f097d680747a8c97ecef12d469
@@ -368,6 +368,6 @@ SPEC CHECKSUMS:
368
368
  ReactCommon: b9ff54b6dd22ba4a776eda22d7f83ec27544ca35
369
369
  Yoga: 0276e9f20976c8568e107cfc1163a8629051adc0
370
370
 
371
- PODFILE CHECKSUM: 743d3a03166e4ff89e660e87d59561305c1e0a2e
371
+ PODFILE CHECKSUM: 4ec05f3623d0ffabb6875299ff6b6a3048d41059
372
372
 
373
373
  COCOAPODS: 1.15.2
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.4.1",
4
+ "version": "6.5.0",
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_6_4_1" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_5_0" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK", "12.4.1"
19
+ s.dependency "AppLovinSDK", "12.5.0"
20
20
  end
@@ -4,7 +4,7 @@ import type { Configuration } from './types/Configuration';
4
4
 
5
5
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
6
6
 
7
- const VERSION = '6.4.1';
7
+ const VERSION = '6.5.0';
8
8
 
9
9
  /**
10
10
  * This enum represents the user's geography used to determine the type of consent flow shown to the