react-native-applovin-max 6.2.3 → 6.3.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.
@@ -35,8 +35,8 @@ android {
35
35
  defaultConfig {
36
36
  minSdkVersion 16
37
37
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
38
- versionCode 6020300
39
- versionName "6.2.3"
38
+ versionCode 6030100
39
+ versionName "6.3.1"
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.1.0'
143
+ implementation 'com.applovin:applovin-sdk:12.3.1'
144
144
  }
@@ -270,7 +270,11 @@ public class AppLovinMAXModule
270
270
  private void performInitialization(final String pluginVersion, final String sdkKey, final Context context, final Promise promise)
271
271
  {
272
272
  // Guard against running init logic multiple times
273
- if ( isPluginInitialized ) return;
273
+ if ( isPluginInitialized )
274
+ {
275
+ promise.resolve( getInitializationMessage() );
276
+ return;
277
+ }
274
278
 
275
279
  isPluginInitialized = true;
276
280
 
@@ -457,15 +461,25 @@ public class AppLovinMAXModule
457
461
  }
458
462
  }.enable();
459
463
 
460
- WritableMap sdkConfiguration = Arguments.createMap();
461
- sdkConfiguration.putString( "countryCode", configuration.getCountryCode() );
462
- sdkConfiguration.putString( "consentFlowUserGeography", getRawAppLovinConsentFlowUserGeography( configuration.getConsentFlowUserGeography() ) );
463
- sdkConfiguration.putBoolean( "isTestModeEnabled", configuration.isTestModeEnabled() );
464
- promise.resolve( sdkConfiguration );
464
+ promise.resolve( getInitializationMessage() );
465
465
  }
466
466
  } );
467
467
  }
468
468
 
469
+ private WritableMap getInitializationMessage()
470
+ {
471
+ WritableMap message = Arguments.createMap();
472
+
473
+ if ( sdkConfiguration != null )
474
+ {
475
+ message.putString( "countryCode", sdkConfiguration.getCountryCode() );
476
+ message.putString( "consentFlowUserGeography", getRawAppLovinConsentFlowUserGeography( sdkConfiguration.getConsentFlowUserGeography() ) );
477
+ message.putBoolean( "isTestModeEnabled", sdkConfiguration.isTestModeEnabled() );
478
+ }
479
+
480
+ return message;
481
+ }
482
+
469
483
  // General Public API
470
484
 
471
485
  @ReactMethod
@@ -673,7 +687,7 @@ public class AppLovinMAXModule
673
687
  @ReactMethod
674
688
  public void showCmpForExistingUser(final Promise promise)
675
689
  {
676
- if ( sdk == null )
690
+ if ( !isPluginInitialized )
677
691
  {
678
692
  logUninitializedAccessError( "showCmpForExistingUser", promise );
679
693
  return;
@@ -686,8 +700,7 @@ public class AppLovinMAXModule
686
700
  return;
687
701
  }
688
702
 
689
- AppLovinCmpService cmpService = sdk.getCmpService();
690
- cmpService.showCmpForExistingUser( currentActivity, (@Nullable final AppLovinCmpError error) -> {
703
+ sdk.getCmpService().showCmpForExistingUser( currentActivity, (@Nullable final AppLovinCmpError error) -> {
691
704
 
692
705
  if ( error == null )
693
706
  {
@@ -695,21 +708,25 @@ public class AppLovinMAXModule
695
708
  return;
696
709
  }
697
710
 
698
- promise.resolve( error.getCmpCode() );
711
+ WritableMap params = Arguments.createMap();
712
+ params.putInt( "code", error.getCode().getValue() );
713
+ params.putString( "message", error.getMessage() );
714
+ params.putInt( "cmpCode", error.getCmpCode() );
715
+ params.putString( "cmpMessage", error.getCmpMessage() );
716
+ promise.resolve( params );
699
717
  } );
700
718
  }
701
719
 
702
720
  @ReactMethod
703
721
  public void hasSupportedCmp(final Promise promise)
704
722
  {
705
- if ( sdk == null )
723
+ if ( !isPluginInitialized )
706
724
  {
707
725
  logUninitializedAccessError( "showCmpForExistingUser", promise );
708
726
  return;
709
727
  }
710
728
 
711
- AppLovinCmpService cmpService = sdk.getCmpService();
712
- promise.resolve( cmpService.hasSupportedCmp() );
729
+ promise.resolve( sdk.getCmpService().hasSupportedCmp() );
713
730
  }
714
731
 
715
732
  // Data Passing
@@ -1538,7 +1555,7 @@ public class AppLovinMAXModule
1538
1555
  {
1539
1556
  String name;
1540
1557
  MaxAdFormat adFormat = ad.getFormat();
1541
- if ( MaxAdFormat.BANNER == adFormat || MaxAdFormat.LEADER == adFormat || MaxAdFormat.MREC == adFormat )
1558
+ if ( adFormat.isAdViewAd() )
1542
1559
  {
1543
1560
  name = ( MaxAdFormat.MREC == adFormat ) ? ON_MREC_AD_LOADED_EVENT : ON_BANNER_AD_LOADED_EVENT;
1544
1561
 
@@ -1728,7 +1745,7 @@ public class AppLovinMAXModule
1728
1745
  public void onAdExpanded(final MaxAd ad)
1729
1746
  {
1730
1747
  final MaxAdFormat adFormat = ad.getFormat();
1731
- if ( adFormat != MaxAdFormat.BANNER && adFormat != MaxAdFormat.LEADER && adFormat != MaxAdFormat.MREC )
1748
+ if ( !adFormat.isAdViewAd() )
1732
1749
  {
1733
1750
  logInvalidAdFormat( adFormat );
1734
1751
  return;
@@ -1741,7 +1758,7 @@ public class AppLovinMAXModule
1741
1758
  public void onAdCollapsed(final MaxAd ad)
1742
1759
  {
1743
1760
  final MaxAdFormat adFormat = ad.getFormat();
1744
- if ( adFormat != MaxAdFormat.BANNER && adFormat != MaxAdFormat.LEADER && adFormat != MaxAdFormat.MREC )
1761
+ if ( !adFormat.isAdViewAd() )
1745
1762
  {
1746
1763
  logInvalidAdFormat( adFormat );
1747
1764
  return;
package/ios/AppLovinMAX.m CHANGED
@@ -206,7 +206,11 @@ RCT_EXPORT_METHOD(isInitialized:(RCTPromiseResolveBlock)resolve :(RCTPromiseReje
206
206
  RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject)
207
207
  {
208
208
  // Guard against running init logic multiple times
209
- if ( [self isPluginInitialized] ) return;
209
+ if ( [self isPluginInitialized] )
210
+ {
211
+ resolve([self initializationMessage]);
212
+ return;
213
+ }
210
214
 
211
215
  self.pluginInitialized = YES;
212
216
 
@@ -377,13 +381,25 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
377
381
  self.sdkConfiguration = configuration;
378
382
  self.sdkInitialized = YES;
379
383
 
380
- resolve(@{@"countryCode" : self.sdk.configuration.countryCode,
381
- @"appTrackingStatus" : [self fromAppLovinAppTrackingStatus: self.sdk.configuration.appTrackingTransparencyStatus],
382
- @"consentFlowUserGeography" : [self fromAppLovinConsentFlowUserGeography: self.sdk.configuration.consentFlowUserGeography],
383
- @"isTestModeEnabled" : @(self.sdk.configuration.isTestModeEnabled)});
384
+ resolve([self initializationMessage]);
384
385
  }];
385
386
  }
386
387
 
388
+ - (NSDictionary<NSString *, id> *)initializationMessage
389
+ {
390
+ NSMutableDictionary<NSString *, id> *message = [NSMutableDictionary dictionaryWithCapacity: 4];
391
+
392
+ if ( self.sdkConfiguration )
393
+ {
394
+ message[@"countryCode"] = self.sdkConfiguration.countryCode;
395
+ message[@"appTrackingStatus"] = [self fromAppLovinAppTrackingStatus: self.sdk.configuration.appTrackingTransparencyStatus];
396
+ message[@"consentFlowUserGeography"] = [self fromAppLovinConsentFlowUserGeography: self.sdk.configuration.consentFlowUserGeography];
397
+ message[@"isTestModeEnabled"] = @(self.sdkConfiguration.isTestModeEnabled);
398
+ }
399
+
400
+ return message;
401
+ }
402
+
387
403
  #pragma mark - General Public API
388
404
 
389
405
  RCT_EXPORT_METHOD(isTablet:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject)
@@ -556,14 +572,13 @@ RCT_EXPORT_METHOD(setConsentFlowDebugUserGeography:(NSString *)userGeography)
556
572
 
557
573
  RCT_EXPORT_METHOD(showCmpForExistingUser:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject)
558
574
  {
559
- if ( !self.sdk )
575
+ if ( ![self isPluginInitialized] )
560
576
  {
561
577
  [self logUninitializedAccessError: @"showCmpForExistingUser" withPromiseReject: reject];
562
578
  return;
563
579
  }
564
580
 
565
- ALCMPService *cmpService = self.sdk.cmpService;
566
- [cmpService showCMPForExistingUserWithCompletion:^(ALCMPError * _Nullable error) {
581
+ [self.sdk.cmpService showCMPForExistingUserWithCompletion:^(ALCMPError * _Nullable error) {
567
582
 
568
583
  if ( !error )
569
584
  {
@@ -571,20 +586,22 @@ RCT_EXPORT_METHOD(showCmpForExistingUser:(RCTPromiseResolveBlock)resolve :(RCTPr
571
586
  return;
572
587
  }
573
588
 
574
- resolve(@(error.code));
589
+ resolve(@{@"code" : @(error.code),
590
+ @"message" : error.message ?: @"",
591
+ @"cmpCode" : @(error.cmpCode),
592
+ @"cmpMessage" : error.cmpMessage ?: @""});
575
593
  }];
576
594
  }
577
595
 
578
596
  RCT_EXPORT_METHOD(hasSupportedCmp:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject)
579
597
  {
580
- if ( !self.sdk )
598
+ if ( ![self isPluginInitialized] )
581
599
  {
582
600
  [self logUninitializedAccessError: @"hasSupportedCmp" withPromiseReject: reject];
583
601
  return;
584
602
  }
585
603
 
586
- ALCMPService *cmpService = self.sdk.cmpService;
587
- resolve(@([cmpService hasSupportedCMP]));
604
+ resolve(@([self.sdk.cmpService hasSupportedCMP]));
588
605
  }
589
606
 
590
607
  #pragma mark - Data Passing
@@ -1255,7 +1272,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
1255
1272
  {
1256
1273
  NSString *name;
1257
1274
  MAAdFormat *adFormat = ad.format;
1258
- if ( MAAdFormat.banner == adFormat || MAAdFormat.leader == adFormat || MAAdFormat.mrec == adFormat )
1275
+ if ( [adFormat isAdViewAd] )
1259
1276
  {
1260
1277
  MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: ad.adUnitIdentifier adFormat: adFormat];
1261
1278
  // An ad is now being shown, enable user interaction.
@@ -1431,7 +1448,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
1431
1448
  - (void)didExpandAd:(MAAd *)ad
1432
1449
  {
1433
1450
  MAAdFormat *adFormat = ad.format;
1434
- if ( adFormat != MAAdFormat.banner && adFormat != MAAdFormat.leader && adFormat != MAAdFormat.mrec )
1451
+ if ( ![adFormat isAdViewAd] )
1435
1452
  {
1436
1453
  [self logInvalidAdFormat: adFormat];
1437
1454
  return;
@@ -1444,7 +1461,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
1444
1461
  - (void)didCollapseAd:(MAAd *)ad
1445
1462
  {
1446
1463
  MAAdFormat *adFormat = ad.format;
1447
- if ( adFormat != MAAdFormat.banner && adFormat != MAAdFormat.leader && adFormat != MAAdFormat.mrec )
1464
+ if ( ![adFormat isAdViewAd] )
1448
1465
  {
1449
1466
  [self logInvalidAdFormat: adFormat];
1450
1467
  return;
@@ -1867,7 +1884,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
1867
1884
 
1868
1885
  // Deactivate any previous constraints and reset visibility state so that the safe area background can be positioned again.
1869
1886
  [NSLayoutConstraint deactivateConstraints: self.safeAreaBackground.constraints];
1870
- self.safeAreaBackground.hidden = NO;
1887
+ self.safeAreaBackground.hidden = adView.hidden;
1871
1888
 
1872
1889
  //
1873
1890
  // Determine ad width
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.1.0'
38
+ pod 'AppLovinSDK', '12.3.1'
39
39
 
40
40
  end
package/ios/Podfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - AppLovinSDK (12.1.0)
2
+ - AppLovinSDK (12.3.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.1.0)
252
+ - AppLovinSDK (= 12.3.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: 179d509c258e01a3a77eb8416f0ba843a12ed322
342
+ AppLovinSDK: d99a5a32b00e844932f4583f863780e1af835722
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: d7248805481768209533def6ca165110984d9914
371
+ PODFILE CHECKSUM: 9ca7e6154d8697161b5d7f65806d35634fe4a6f5
372
372
 
373
- COCOAPODS: 1.11.3
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.2.3",
4
+ "version": "6.3.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,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_2_3" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_3_1" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK", "12.1.0"
19
+ s.dependency "AppLovinSDK", "12.3.1"
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.2.3';
7
+ const VERSION = '6.3.1';
8
8
 
9
9
  /**
10
10
  * This enum represents the user's geography used to determine the type of consent flow shown to the
@@ -65,7 +65,7 @@ export enum AppTrackingStatus {
65
65
  /**
66
66
  * Represents errors for CMP flow.
67
67
  */
68
- export enum CmpError {
68
+ export enum CMPErrorCode {
69
69
  /**
70
70
  * Indicates that an unspecified error has occurred.
71
71
  */
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default, AppLovinMAX, ConsentFlowUserGeography, AppTrackingStatus, CmpError } from './AppLovinMAX';
1
+ export { default, AppLovinMAX, ConsentFlowUserGeography, AppTrackingStatus, CMPErrorCode } from './AppLovinMAX';
2
2
  export { Privacy } from './Privacy';
3
3
  export { TargetingData, AdContentRating, UserGender } from './TargetingData';
4
4
  export { InterstitialAd } from './InterstitialAd';
@@ -1,5 +1,6 @@
1
1
  import type { Configuration } from './Configuration';
2
- import type { ConsentFlowUserGeography, CmpError } from '../AppLovinMAX';
2
+ import type { CMPError } from './CMPError';
3
+ import type { ConsentFlowUserGeography } from '../AppLovinMAX';
3
4
 
4
5
  /**
5
6
  * Represents the AppLovinMAX module.
@@ -63,8 +64,8 @@ export type AppLovinMAXType = {
63
64
  setVerboseLogging(verboseLoggingEnabled: boolean): void;
64
65
 
65
66
  /**
66
- * Enables devices to receive test ads by passing in the advertising identifier (IDFA) of each
67
- * test device. Refer to AppLovin logs for the IDFA of your current device.
67
+ * Enables devices to receive test ads by passing in the advertising identifier (IDFA or IDFV) of
68
+ * each test device. Refer to AppLovin logs for the IDFA or IDFV of your current device.
68
69
  *
69
70
  * @param advertisingIds A list of the advertising ids.
70
71
  */
@@ -136,11 +137,11 @@ export type AppLovinMAXType = {
136
137
  * Note that this resets the user’s existing consent information.
137
138
  *
138
139
  * The function returns when the flow finishes showing. On success, returns null. On failure,
139
- * returns one of the {@link CmpError} codes.
140
+ * returns one of the {@link CMPError} codes.
140
141
  *
141
- * @return {Promise<CmpError|null>}
142
+ * @return {Promise<CMPError|null>}
142
143
  */
143
- showCmpForExistingUser(): Promise<CmpError | null>;
144
+ showCmpForExistingUser(): Promise<CMPError | null>;
144
145
 
145
146
  /**
146
147
  * Returns true if a supported CMP SDK is detected.
@@ -0,0 +1,23 @@
1
+ import type { CMPErrorCode } from '../AppLovinMAX';
2
+
3
+ export type CMPError = {
4
+ /**
5
+ * The error code for this error.
6
+ */
7
+ code: CMPErrorCode;
8
+
9
+ /**
10
+ * The error message for this error.
11
+ */
12
+ message: string;
13
+
14
+ /**
15
+ * The error code returned by the CMP.
16
+ */
17
+ cmpCode: number;
18
+
19
+ /**
20
+ * The error message returned by the CMP.
21
+ */
22
+ cmpMessage: string;
23
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './Configuration';
2
+ export * from './CMPError';
2
3
  export * from './AdInfo';
3
4
  export * from './AdViewProps';
4
5
  export * from './NativeAdViewProps';