react-native-applovin-max 5.0.0 → 5.0.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.
@@ -35,8 +35,8 @@ android {
35
35
  defaultConfig {
36
36
  minSdkVersion 16
37
37
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
38
- versionCode 5000000
39
- versionName "5.0.0"
38
+ versionCode 5000200
39
+ versionName "5.0.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:11.8.0'
143
+ implementation 'com.applovin:applovin-sdk:11.8.2'
144
144
  }
@@ -414,7 +414,8 @@ public class AppLovinMAXModule
414
414
  @ReactMethod
415
415
  public void isTablet(final Promise promise)
416
416
  {
417
- Context contextToUse = ( maybeGetCurrentActivity() != null ) ? maybeGetCurrentActivity() : getReactApplicationContext();
417
+ Activity currentActivity = maybeGetCurrentActivity();
418
+ Context contextToUse = ( currentActivity != null ) ? currentActivity : getReactApplicationContext();
418
419
  promise.resolve( AppLovinSdkUtils.isTablet( contextToUse ) );
419
420
  }
420
421
 
@@ -467,7 +468,7 @@ public class AppLovinMAXModule
467
468
  }
468
469
 
469
470
  @ReactMethod
470
- public void setUserId(String userId)
471
+ public void setUserId(final String userId)
471
472
  {
472
473
  if ( isPluginInitialized )
473
474
  {
@@ -491,7 +492,7 @@ public class AppLovinMAXModule
491
492
  @ReactMethod
492
493
  public void isMuted(final Promise promise)
493
494
  {
494
- promise.resolve( isPluginInitialized ? sdk.getSettings().isMuted() : false );
495
+ promise.resolve( isPluginInitialized && sdk.getSettings().isMuted() );
495
496
  }
496
497
 
497
498
  @ReactMethod
@@ -1157,7 +1158,7 @@ public class AppLovinMAXModule
1157
1158
  return;
1158
1159
  }
1159
1160
 
1160
- MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
1161
+ MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "loadInterstitial" );
1161
1162
  if ( interstitial == null )
1162
1163
  {
1163
1164
  sendReactNativeEventForAdLoadFailed( ON_INTERSTITIAL_LOAD_FAILED_EVENT, adUnitId, null );
@@ -1177,7 +1178,13 @@ public class AppLovinMAXModule
1177
1178
  return;
1178
1179
  }
1179
1180
 
1180
- MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
1181
+ MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "isInterstitialReady" );
1182
+ if ( interstitial == null )
1183
+ {
1184
+ promise.resolve( false );
1185
+ return;
1186
+ }
1187
+
1181
1188
  promise.resolve( interstitial.isReady() );
1182
1189
  }
1183
1190
 
@@ -1190,7 +1197,13 @@ public class AppLovinMAXModule
1190
1197
  return;
1191
1198
  }
1192
1199
 
1193
- MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
1200
+ MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "showInterstitial" );
1201
+ if ( interstitial == null )
1202
+ {
1203
+ sendReactNativeEvent( ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT, getAdUnitInfo( adUnitId ) );
1204
+ return;
1205
+ }
1206
+
1194
1207
  interstitial.showAd( placement, customData );
1195
1208
  }
1196
1209
 
@@ -1203,14 +1216,24 @@ public class AppLovinMAXModule
1203
1216
  return;
1204
1217
  }
1205
1218
 
1206
- MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
1219
+ MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "setInterstitialExtraParameter" );
1220
+ if ( interstitial == null ) return;
1221
+
1207
1222
  interstitial.setExtraParameter( key, value );
1208
1223
  }
1209
1224
 
1210
1225
  @ReactMethod
1211
1226
  public void setInterstitialLocalExtraParameter(final String adUnitId, final String key, final String value)
1212
1227
  {
1213
- MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId );
1228
+ if ( sdk == null )
1229
+ {
1230
+ logUninitializedAccessError( "setInterstitialLocalExtraParameter" );
1231
+ return;
1232
+ }
1233
+
1234
+ MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "setInterstitialLocalExtraParameter" );
1235
+ if ( interstitial == null ) return;
1236
+
1214
1237
  interstitial.setLocalExtraParameter( key, value );
1215
1238
  }
1216
1239
 
@@ -1225,7 +1248,7 @@ public class AppLovinMAXModule
1225
1248
  return;
1226
1249
  }
1227
1250
 
1228
- MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
1251
+ MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId, "loadRewardedAd" );
1229
1252
  if ( rewardedAd == null )
1230
1253
  {
1231
1254
  sendReactNativeEventForAdLoadFailed( ON_REWARDED_AD_LOAD_FAILED_EVENT, adUnitId, null );
@@ -1245,7 +1268,13 @@ public class AppLovinMAXModule
1245
1268
  return;
1246
1269
  }
1247
1270
 
1248
- MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
1271
+ MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId, "isRewardedAdReady" );
1272
+ if ( rewardedAd == null )
1273
+ {
1274
+ promise.resolve( false );
1275
+ return;
1276
+ }
1277
+
1249
1278
  promise.resolve( rewardedAd.isReady() );
1250
1279
  }
1251
1280
 
@@ -1258,7 +1287,13 @@ public class AppLovinMAXModule
1258
1287
  return;
1259
1288
  }
1260
1289
 
1261
- MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
1290
+ MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId, "showRewardedAd" );
1291
+ if ( rewardedAd == null )
1292
+ {
1293
+ sendReactNativeEvent( ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT, getAdUnitInfo( adUnitId ) );
1294
+ return;
1295
+ }
1296
+
1262
1297
  rewardedAd.showAd( placement, customData );
1263
1298
  }
1264
1299
 
@@ -1271,14 +1306,24 @@ public class AppLovinMAXModule
1271
1306
  return;
1272
1307
  }
1273
1308
 
1274
- MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
1309
+ MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId, "setRewardedAdExtraParameter" );
1310
+ if ( rewardedAd == null ) return;
1311
+
1275
1312
  rewardedAd.setExtraParameter( key, value );
1276
1313
  }
1277
1314
 
1278
1315
  @ReactMethod
1279
1316
  public void setRewardedAdLocalExtraParameter(final String adUnitId, final String key, final String value)
1280
1317
  {
1281
- MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId );
1318
+ if ( sdk == null )
1319
+ {
1320
+ logUninitializedAccessError( "setRewardedAdLocalExtraParameter" );
1321
+ return;
1322
+ }
1323
+
1324
+ MaxRewardedAd rewardedAd = retrieveRewardedAd( adUnitId, "setRewardedAdLocalExtraParameter" );
1325
+ if ( rewardedAd == null ) return;
1326
+
1282
1327
  rewardedAd.setLocalExtraParameter( key, value );
1283
1328
  }
1284
1329
 
@@ -1426,7 +1471,7 @@ public class AppLovinMAXModule
1426
1471
  sendReactNativeEventForAdLoadFailed( name, adUnitId, error );
1427
1472
  }
1428
1473
 
1429
- void sendReactNativeEventForAdLoadFailed(final String name, final String adUnitId, @Nullable final MaxError error)
1474
+ private void sendReactNativeEventForAdLoadFailed(final String name, final String adUnitId, @Nullable final MaxError error)
1430
1475
  {
1431
1476
  sendReactNativeEvent( name, getAdLoadFailedInfo( adUnitId, error ) );
1432
1477
  }
@@ -1986,10 +2031,14 @@ public class AppLovinMAXModule
1986
2031
  }
1987
2032
 
1988
2033
  @Nullable
1989
- private MaxInterstitialAd retrieveInterstitial(String adUnitId)
2034
+ private MaxInterstitialAd retrieveInterstitial(final String adUnitId, final String callingMethod)
1990
2035
  {
1991
2036
  Activity currentActivity = maybeGetCurrentActivity();
1992
- if ( currentActivity == null ) return null;
2037
+ if ( currentActivity == null )
2038
+ {
2039
+ e( "Unable to get current Activity, returning null interstitial for " + callingMethod + "()" );
2040
+ return null;
2041
+ }
1993
2042
 
1994
2043
  MaxInterstitialAd result = mInterstitials.get( adUnitId );
1995
2044
  if ( result == null )
@@ -2005,10 +2054,14 @@ public class AppLovinMAXModule
2005
2054
  }
2006
2055
 
2007
2056
  @Nullable
2008
- private MaxRewardedAd retrieveRewardedAd(String adUnitId)
2057
+ private MaxRewardedAd retrieveRewardedAd(final String adUnitId, final String callingMethod)
2009
2058
  {
2010
2059
  Activity currentActivity = maybeGetCurrentActivity();
2011
- if ( currentActivity == null ) return null;
2060
+ if ( currentActivity == null )
2061
+ {
2062
+ e( "Unable to get current Activity, returning null rewarded ad for " + callingMethod + "()" );
2063
+ return null;
2064
+ }
2012
2065
 
2013
2066
  MaxRewardedAd result = mRewardedAds.get( adUnitId );
2014
2067
  if ( result == null )
@@ -2023,7 +2076,7 @@ public class AppLovinMAXModule
2023
2076
  return result;
2024
2077
  }
2025
2078
 
2026
- private MaxAppOpenAd retrieveAppOpenAd(String adUnitId)
2079
+ private MaxAppOpenAd retrieveAppOpenAd(final String adUnitId)
2027
2080
  {
2028
2081
  MaxAppOpenAd result = mAppOpenAds.get( adUnitId );
2029
2082
  if ( result == null )
@@ -2387,10 +2440,10 @@ public class AppLovinMAXModule
2387
2440
 
2388
2441
  public WritableMap getAdDisplayFailedInfo(final MaxAd ad, final MaxError error)
2389
2442
  {
2390
- WritableMap params = getAdInfo( ad );
2391
- params.putInt( "code", error.getCode() );
2392
- params.putString( "message", error.getMessage() );
2393
- return params;
2443
+ WritableMap info = getAdInfo( ad );
2444
+ info.putInt( "code", error.getCode() );
2445
+ info.putString( "message", error.getMessage() );
2446
+ return info;
2394
2447
  }
2395
2448
 
2396
2449
  public WritableMap getAdRevenueInfo(final MaxAd ad)
@@ -2402,6 +2455,13 @@ public class AppLovinMAXModule
2402
2455
  return adInfo;
2403
2456
  }
2404
2457
 
2458
+ private WritableMap getAdUnitInfo(final String adUnitId)
2459
+ {
2460
+ WritableMap info = Arguments.createMap();
2461
+ info.putString( "adUnitId", adUnitId );
2462
+ return info;
2463
+ }
2464
+
2405
2465
  // AD WATERFALL INFO
2406
2466
 
2407
2467
  private WritableMap createAdWaterfallInfo(final MaxAdWaterfallInfo waterfallInfo)
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', '11.8.0'
38
+ pod 'AppLovinSDK', '11.8.2'
39
39
 
40
40
  end
package/ios/Podfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - AppLovinSDK (11.8.0)
2
+ - AppLovinSDK (11.8.2)
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 (= 11.8.0)
252
+ - AppLovinSDK (= 11.8.2)
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: 80818d048a0d46701b878927a1e1a064d32b747d
342
+ AppLovinSDK: cfcf1972d25febb4c0f23837763e3809f0fba159
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: 6e9aa2145f566a91f3e26d928707679adc7b3cf8
371
+ PODFILE CHECKSUM: 8638b3ebfa25029aca293faa9d5f2513a076845c
372
372
 
373
373
  COCOAPODS: 1.11.3
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.0.0",
4
+ "version": "5.0.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 => "release_5_0_0" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_5_0_2" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK", "11.8.0"
19
+ s.dependency "AppLovinSDK", "11.8.2"
20
20
  end
package/src/index.js CHANGED
@@ -6,7 +6,7 @@ import EventListeners from "./AppLovinMAXEventListeners";
6
6
 
7
7
  const { AppLovinMAX } = NativeModules;
8
8
 
9
- const VERSION = "5.0.0";
9
+ const VERSION = "5.0.2";
10
10
 
11
11
  /*---------*/
12
12
  /* BANNERS */