react-native-applovin-max 6.4.0 → 6.4.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.
- package/android/build.gradle +4 -4
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +29 -64
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +4 -4
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AdView.tsx +3 -2
- package/src/AppLovinMAX.ts +1 -1
- package/src/nativeAd/NativeAdView.tsx +1 -0
package/android/build.gradle
CHANGED
|
@@ -13,7 +13,7 @@ buildscript {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
dependencies {
|
|
16
|
-
classpath 'com.android.tools.build:gradle:3.
|
|
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
|
|
39
|
-
versionName "6.4.
|
|
38
|
+
versionCode 6040200
|
|
39
|
+
versionName "6.4.2"
|
|
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.
|
|
143
|
+
implementation 'com.applovin:applovin-sdk:12.4.2'
|
|
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,
|
|
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(
|
|
432
|
-
{
|
|
433
|
-
@Override
|
|
434
|
-
public void onSdkInitialized(final AppLovinSdkConfiguration configuration)
|
|
435
|
-
{
|
|
436
|
-
d( "SDK initialized" );
|
|
400
|
+
sdk.initializeSdk( configuration -> {
|
|
437
401
|
|
|
438
|
-
|
|
439
|
-
isSdkInitialized = true;
|
|
402
|
+
d( "SDK initialized" );
|
|
440
403
|
|
|
441
|
-
|
|
404
|
+
sdkConfiguration = configuration;
|
|
405
|
+
isSdkInitialized = true;
|
|
442
406
|
|
|
443
|
-
|
|
407
|
+
windowManager = (WindowManager) getReactApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
|
444
408
|
|
|
445
|
-
|
|
446
|
-
|
|
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
|
-
|
|
449
|
-
|
|
417
|
+
int newRotation = windowManager.getDefaultDisplay().getRotation();
|
|
418
|
+
if ( newRotation != lastRotation )
|
|
450
419
|
{
|
|
451
|
-
|
|
452
|
-
|
|
420
|
+
lastRotation = newRotation;
|
|
421
|
+
for ( final Map.Entry<String, MaxAdFormat> adUnitFormats : mAdViewAdFormats.entrySet() )
|
|
453
422
|
{
|
|
454
|
-
|
|
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
|
-
}
|
|
426
|
+
}
|
|
427
|
+
}.enable();
|
|
462
428
|
|
|
463
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
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,
|
|
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(
|
|
2354
|
-
final int heightPx = AppLovinSdkUtils.dpToPx(
|
|
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.
|
|
38
|
+
pod 'AppLovinSDK', '12.4.1'
|
|
39
39
|
|
|
40
40
|
end
|
package/ios/Podfile.lock
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
PODS:
|
|
2
|
-
- AppLovinSDK (12.4.
|
|
2
|
+
- AppLovinSDK (12.4.1)
|
|
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.
|
|
252
|
+
- AppLovinSDK (= 12.4.1)
|
|
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:
|
|
342
|
+
AppLovinSDK: c57ad0d34625c971d2db127f8ef60570b28ff51a
|
|
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:
|
|
371
|
+
PODFILE CHECKSUM: 743d3a03166e4ff89e660e87d59561305c1e0a2e
|
|
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.
|
|
4
|
+
"version": "6.4.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 => "
|
|
14
|
+
s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_4_2" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/AppLovinMAX*.{h,m}"
|
|
17
17
|
|
|
18
18
|
s.dependency "React"
|
|
19
|
-
s.dependency "AppLovinSDK", "12.4.
|
|
19
|
+
s.dependency "AppLovinSDK", "12.4.1"
|
|
20
20
|
end
|
package/src/AdView.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
findNodeHandle,
|
|
9
9
|
useWindowDimensions,
|
|
10
10
|
} from 'react-native';
|
|
11
|
-
import type { ViewProps, ViewStyle, StyleProp, NativeMethods } from 'react-native';
|
|
11
|
+
import type { ViewProps, ViewStyle, StyleProp, NativeMethods, DimensionValue } from 'react-native';
|
|
12
12
|
import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
|
|
13
13
|
import type { AdNativeEvent } from './types/AdEvent';
|
|
14
14
|
import type { AdViewProps, AdViewHandler } from './types/AdViewProps';
|
|
@@ -75,7 +75,7 @@ const AdViewComponent = requireNativeComponent<AdViewProps & ViewProps & AdViewN
|
|
|
75
75
|
type AdViewType = React.Component<AdViewProps> & NativeMethods;
|
|
76
76
|
|
|
77
77
|
type SizeKey = 'width' | 'height';
|
|
78
|
-
type SizeRecord = Partial<Record<SizeKey,
|
|
78
|
+
type SizeRecord = Partial<Record<SizeKey, DimensionValue>>;
|
|
79
79
|
|
|
80
80
|
const ADVIEW_SIZE = {
|
|
81
81
|
banner: { width: 320, height: 50 },
|
|
@@ -173,6 +173,7 @@ export const AdView = forwardRef<AdViewHandler, AdViewProps & ViewProps>(functio
|
|
|
173
173
|
if (adViewRef.current) {
|
|
174
174
|
UIManager.dispatchViewManagerCommand(
|
|
175
175
|
findNodeHandle(adViewRef.current),
|
|
176
|
+
// @ts-ignore: Issue in RN ts defs
|
|
176
177
|
UIManager.getViewManagerConfig('AppLovinMAXAdView').Commands.loadAd,
|
|
177
178
|
undefined
|
|
178
179
|
);
|
package/src/AppLovinMAX.ts
CHANGED
|
@@ -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.
|
|
7
|
+
const VERSION = '6.4.2';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* This enum represents the user's geography used to determine the type of consent flow shown to the
|
|
@@ -116,6 +116,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
116
116
|
if (nativeAdViewRef) {
|
|
117
117
|
UIManager.dispatchViewManagerCommand(
|
|
118
118
|
findNodeHandle(nativeAdViewRef.current),
|
|
119
|
+
// @ts-ignore: Issue in RN ts defs
|
|
119
120
|
UIManager.getViewManagerConfig('AppLovinMAXNativeAdView').Commands.loadAd,
|
|
120
121
|
undefined
|
|
121
122
|
);
|