react-native-applovin-max 6.0.2 → 6.1.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.
@@ -35,8 +35,8 @@ android {
35
35
  defaultConfig {
36
36
  minSdkVersion 16
37
37
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
38
- versionCode 6000200
39
- versionName "6.0.2"
38
+ versionCode 6010000
39
+ versionName "6.1.0"
40
40
  }
41
41
 
42
42
  flavorDimensions("default")
@@ -7,6 +7,7 @@ import android.content.pm.PackageManager;
7
7
  import android.graphics.Color;
8
8
  import android.graphics.Point;
9
9
  import android.graphics.Rect;
10
+ import android.net.Uri;
10
11
  import android.os.Bundle;
11
12
  import android.text.TextUtils;
12
13
  import android.util.Log;
@@ -41,6 +42,7 @@ import com.applovin.sdk.AppLovinMediationProvider;
41
42
  import com.applovin.sdk.AppLovinPrivacySettings;
42
43
  import com.applovin.sdk.AppLovinSdk;
43
44
  import com.applovin.sdk.AppLovinSdkConfiguration;
45
+ import com.applovin.sdk.AppLovinSdkConfiguration.ConsentFlowUserGeography;
44
46
  import com.applovin.sdk.AppLovinSdkSettings;
45
47
  import com.applovin.sdk.AppLovinSdkUtils;
46
48
  import com.facebook.react.bridge.Arguments;
@@ -79,6 +81,10 @@ public class AppLovinMAXModule
79
81
  private static final String SDK_TAG = "AppLovinSdk";
80
82
  private static final String TAG = "AppLovinMAXModule";
81
83
 
84
+ private static final String USER_GEOGRAPHY_GDPR = "G";
85
+ private static final String USER_GEOGRAPHY_OTHER = "O";
86
+ private static final String USER_GEOGRAPHY_UNKNOWN = "U";
87
+
82
88
  private static final String ON_BANNER_AD_LOADED_EVENT = "OnBannerAdLoadedEvent";
83
89
  private static final String ON_BANNER_AD_LOAD_FAILED_EVENT = "OnBannerAdLoadFailedEvent";
84
90
  private static final String ON_BANNER_AD_CLICKED_EVENT = "OnBannerAdClickedEvent";
@@ -143,6 +149,7 @@ public class AppLovinMAXModule
143
149
  private int lastRotation;
144
150
 
145
151
  // Store these values if pub attempts to set it before initializing
152
+ private List<String> initializationAdUnitIdsToSet;
146
153
  private String userIdToSet;
147
154
  private List<String> testDeviceAdvertisingIdsToSet;
148
155
  private Boolean verboseLoggingToSet;
@@ -150,6 +157,11 @@ public class AppLovinMAXModule
150
157
  private Boolean locationCollectionEnabledToSet;
151
158
  private final Map<String, String> extraParametersToSet = new HashMap<>( 8 );
152
159
 
160
+ private Boolean termsAndPrivacyPolicyFlowEnabledToSet;
161
+ private Uri privacyPolicyURLToSet;
162
+ private Uri termsOfServiceURLToSet;
163
+ private String debugUserGeographyToSet;
164
+
153
165
  private Integer targetingYearOfBirthToSet;
154
166
  private String targetingGenderToSet;
155
167
  private Integer targetingMaximumAdContentRatingToSet;
@@ -286,46 +298,81 @@ public class AppLovinMAXModule
286
298
  }
287
299
  }
288
300
 
289
- // Initialize SDK
290
- sdk = AppLovinSdk.getInstance( sdkKeyToUse, new AppLovinSdkSettings( getReactApplicationContext() ), context );
291
- sdk.setPluginVersion( "React-Native-" + pluginVersion );
292
- sdk.setMediationProvider( AppLovinMediationProvider.MAX );
301
+ AppLovinSdkSettings settings = new AppLovinSdkSettings( getReactApplicationContext() );
293
302
 
294
- // Set user id if needed
295
- if ( !TextUtils.isEmpty( userIdToSet ) )
303
+ // Selective init
304
+ if ( initializationAdUnitIdsToSet != null )
296
305
  {
297
- sdk.setUserIdentifier( userIdToSet );
298
- userIdToSet = null;
306
+ settings.setInitializationAdUnitIds( initializationAdUnitIdsToSet );
307
+ initializationAdUnitIdsToSet = null;
308
+ }
309
+
310
+ if ( termsAndPrivacyPolicyFlowEnabledToSet != null )
311
+ {
312
+ settings.getTermsAndPrivacyPolicyFlowSettings().setEnabled( termsAndPrivacyPolicyFlowEnabledToSet );
313
+ termsAndPrivacyPolicyFlowEnabledToSet = null;
314
+ }
315
+
316
+ if ( privacyPolicyURLToSet != null )
317
+ {
318
+ settings.getTermsAndPrivacyPolicyFlowSettings().setPrivacyPolicyUri( privacyPolicyURLToSet );
319
+ privacyPolicyURLToSet = null;
320
+ }
321
+
322
+ if ( termsOfServiceURLToSet != null )
323
+ {
324
+ settings.getTermsAndPrivacyPolicyFlowSettings().setTermsOfServiceUri( termsOfServiceURLToSet );
325
+ termsOfServiceURLToSet = null;
326
+ }
327
+
328
+ if ( AppLovinSdkUtils.isValidString( debugUserGeographyToSet ) )
329
+ {
330
+ settings.getTermsAndPrivacyPolicyFlowSettings().setDebugUserGeography( getAppLovinConsentFlowUserGeography( debugUserGeographyToSet ) );
331
+ debugUserGeographyToSet = null;
299
332
  }
300
333
 
301
334
  // Set test device ids if needed
302
335
  if ( testDeviceAdvertisingIdsToSet != null )
303
336
  {
304
- sdk.getSettings().setTestDeviceAdvertisingIds( testDeviceAdvertisingIdsToSet );
337
+ settings.setTestDeviceAdvertisingIds( testDeviceAdvertisingIdsToSet );
305
338
  testDeviceAdvertisingIdsToSet = null;
306
339
  }
307
340
 
308
341
  // Set verbose logging state if needed
309
342
  if ( verboseLoggingToSet != null )
310
343
  {
311
- sdk.getSettings().setVerboseLogging( verboseLoggingToSet );
344
+ settings.setVerboseLogging( verboseLoggingToSet );
312
345
  verboseLoggingToSet = null;
313
346
  }
314
347
 
315
348
  // Set creative debugger enabled if needed.
316
349
  if ( creativeDebuggerEnabledToSet != null )
317
350
  {
318
- sdk.getSettings().setCreativeDebuggerEnabled( creativeDebuggerEnabledToSet );
351
+ settings.setCreativeDebuggerEnabled( creativeDebuggerEnabledToSet );
319
352
  creativeDebuggerEnabledToSet = null;
320
353
  }
321
354
 
322
355
  // Set location collection enabled if needed
323
356
  if ( locationCollectionEnabledToSet != null )
324
357
  {
325
- sdk.getSettings().setLocationCollectionEnabled( locationCollectionEnabledToSet );
358
+ settings.setLocationCollectionEnabled( locationCollectionEnabledToSet );
326
359
  locationCollectionEnabledToSet = null;
327
360
  }
328
361
 
362
+ setPendingExtraParametersIfNeeded( settings );
363
+
364
+ // Initialize SDK
365
+ sdk = AppLovinSdk.getInstance( sdkKeyToUse, settings, context );
366
+ sdk.setPluginVersion( "React-Native-" + pluginVersion );
367
+ sdk.setMediationProvider( AppLovinMediationProvider.MAX );
368
+
369
+ // Set user id if needed
370
+ if ( AppLovinSdkUtils.isValidString( userIdToSet ) )
371
+ {
372
+ sdk.setUserIdentifier( userIdToSet );
373
+ userIdToSet = null;
374
+ }
375
+
329
376
  if ( targetingYearOfBirthToSet != null )
330
377
  {
331
378
  sdk.getTargetingData().setYearOfBirth( targetingYearOfBirthToSet <= 0 ? null : targetingYearOfBirthToSet );
@@ -368,8 +415,6 @@ public class AppLovinMAXModule
368
415
  targetingInterestsToSet = null;
369
416
  }
370
417
 
371
- setPendingExtraParametersIfNeeded( sdk.getSettings() );
372
-
373
418
  sdk.initializeSdk( new AppLovinSdk.SdkInitializationListener()
374
419
  {
375
420
  @Override
@@ -404,6 +449,8 @@ public class AppLovinMAXModule
404
449
 
405
450
  WritableMap sdkConfiguration = Arguments.createMap();
406
451
  sdkConfiguration.putString( "countryCode", configuration.getCountryCode() );
452
+ sdkConfiguration.putString( "consentFlowUserGeography", getRawAppLovinConsentFlowUserGeography( configuration.getConsentFlowUserGeography() ) );
453
+ sdkConfiguration.putBoolean( "isTestModeEnabled", configuration.isTestModeEnabled() );
407
454
  promise.resolve( sdkConfiguration );
408
455
  }
409
456
  } );
@@ -566,14 +613,46 @@ public class AppLovinMAXModule
566
613
  }
567
614
  }
568
615
 
616
+ @ReactMethod
617
+ public void setInitializationAdUnitIds(final ReadableArray rawAdUnitIds)
618
+ {
619
+ initializationAdUnitIdsToSet = new ArrayList<>( rawAdUnitIds.size() );
620
+
621
+ // Convert to String List
622
+ for ( Object adUnitId : rawAdUnitIds.toArrayList() )
623
+ {
624
+ initializationAdUnitIdsToSet.add( (String) adUnitId );
625
+ }
626
+ }
627
+
628
+ // MAX Terms and Privacy Policy Flow
629
+
569
630
  @ReactMethod
570
631
  public void setConsentFlowEnabled(final boolean enabled) { }
571
632
 
572
633
  @ReactMethod
573
- public void setPrivacyPolicyUrl(final String urlString) { }
634
+ public void setTermsAndPrivacyPolicyFlowEnabled(final boolean enabled)
635
+ {
636
+ termsAndPrivacyPolicyFlowEnabledToSet = enabled;
637
+ }
574
638
 
575
639
  @ReactMethod
576
- public void setTermsOfServiceUrl(final String urlString) { }
640
+ public void setPrivacyPolicyUrl(final String urlString)
641
+ {
642
+ privacyPolicyURLToSet = Uri.parse( urlString );
643
+ }
644
+
645
+ @ReactMethod
646
+ public void setTermsOfServiceUrl(final String urlString)
647
+ {
648
+ termsOfServiceURLToSet = Uri.parse( urlString );
649
+ }
650
+
651
+ @ReactMethod
652
+ public void setConsentFlowDebugUserGeography(final String userGeography)
653
+ {
654
+ debugUserGeographyToSet = userGeography;
655
+ }
577
656
 
578
657
  // Data Passing
579
658
 
@@ -1406,7 +1485,7 @@ public class AppLovinMAXModule
1406
1485
  name = ( MaxAdFormat.MREC == adFormat ) ? ON_MREC_AD_LOADED_EVENT : ON_BANNER_AD_LOADED_EVENT;
1407
1486
 
1408
1487
  String adViewPosition = mAdViewPositions.get( ad.getAdUnitId() );
1409
- if ( !TextUtils.isEmpty( adViewPosition ) )
1488
+ if ( AppLovinSdkUtils.isValidString( adViewPosition ) )
1410
1489
  {
1411
1490
  // Only position ad if not native UI component
1412
1491
  positionAdView( ad );
@@ -2421,18 +2500,46 @@ public class AppLovinMAXModule
2421
2500
  return AppLovinAdContentRating.NONE;
2422
2501
  }
2423
2502
 
2503
+ private static ConsentFlowUserGeography getAppLovinConsentFlowUserGeography(final String userGeography)
2504
+ {
2505
+ if ( USER_GEOGRAPHY_GDPR.equalsIgnoreCase( userGeography ) )
2506
+ {
2507
+ return ConsentFlowUserGeography.GDPR;
2508
+ }
2509
+ else if ( USER_GEOGRAPHY_OTHER.equalsIgnoreCase( userGeography ) )
2510
+ {
2511
+ return ConsentFlowUserGeography.OTHER;
2512
+ }
2513
+
2514
+ return ConsentFlowUserGeography.UNKNOWN;
2515
+ }
2516
+
2517
+ private static String getRawAppLovinConsentFlowUserGeography(final ConsentFlowUserGeography userGeography)
2518
+ {
2519
+ if ( ConsentFlowUserGeography.GDPR == userGeography )
2520
+ {
2521
+ return USER_GEOGRAPHY_GDPR;
2522
+ }
2523
+ else if ( ConsentFlowUserGeography.OTHER == userGeography )
2524
+ {
2525
+ return USER_GEOGRAPHY_OTHER;
2526
+ }
2527
+
2528
+ return USER_GEOGRAPHY_UNKNOWN;
2529
+ }
2530
+
2424
2531
  // AD INFO
2425
2532
 
2426
2533
  public WritableMap getAdInfo(final MaxAd ad)
2427
2534
  {
2428
2535
  WritableMap adInfo = Arguments.createMap();
2429
2536
  adInfo.putString( "adUnitId", ad.getAdUnitId() );
2430
- adInfo.putString( "creativeId", !TextUtils.isEmpty( ad.getCreativeId() ) ? ad.getCreativeId() : "" );
2537
+ adInfo.putString( "creativeId", AppLovinSdkUtils.isValidString( ad.getCreativeId() ) ? ad.getCreativeId() : "" );
2431
2538
  adInfo.putString( "networkName", ad.getNetworkName() );
2432
- adInfo.putString( "placement", !TextUtils.isEmpty( ad.getPlacement() ) ? ad.getPlacement() : "" );
2539
+ adInfo.putString( "placement", AppLovinSdkUtils.isValidString( ad.getPlacement() ) ? ad.getPlacement() : "" );
2433
2540
  adInfo.putDouble( "revenue", ad.getRevenue() );
2434
2541
  adInfo.putMap( "waterfall", createAdWaterfallInfo( ad.getWaterfall() ) );
2435
- adInfo.putString( "dspName", !TextUtils.isEmpty( ad.getDspName() ) ? ad.getDspName() : "" );
2542
+ adInfo.putString( "dspName", AppLovinSdkUtils.isValidString( ad.getDspName() ) ? ad.getDspName() : "" );
2436
2543
 
2437
2544
  return adInfo;
2438
2545
  }
package/ios/AppLovinMAX.m CHANGED
@@ -37,6 +37,7 @@
37
37
  @property (nonatomic, strong) ALSdkConfiguration *sdkConfiguration;
38
38
 
39
39
  // Store these values if pub attempts to set it before initializing
40
+ @property (nonatomic, strong, nullable) NSArray<NSString *> *initializationAdUnitIdentifiersToSet;
40
41
  @property (nonatomic, copy, nullable) NSString *userIdentifierToSet;
41
42
  @property (nonatomic, strong, nullable) NSArray<NSString *> *testDeviceIdentifiersToSet;
42
43
  @property (nonatomic, strong, nullable) NSNumber *verboseLoggingToSet;
@@ -45,8 +46,10 @@
45
46
  @property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> *extraParametersToSet;
46
47
 
47
48
  @property (nonatomic, strong, nullable) NSNumber *consentFlowEnabledToSet;
49
+ @property (nonatomic, strong, nullable) NSNumber *termsAndPrivacyPolicyFlowEnabledToSet;
48
50
  @property (nonatomic, strong, nullable) NSURL *privacyPolicyURLToSet;
49
51
  @property (nonatomic, strong, nullable) NSURL *termsOfServiceURLToSet;
52
+ @property (nonatomic, copy, nullable) NSString *debugUserGeographyToSet;
50
53
 
51
54
  @property (nonatomic, strong, nullable) NSNumber *targetingYearOfBirthToSet;
52
55
  @property (nonatomic, copy, nullable) NSString *targetingGenderToSet;
@@ -82,6 +85,16 @@
82
85
  static NSString *const SDK_TAG = @"AppLovinSdk";
83
86
  static NSString *const TAG = @"AppLovinMAX";
84
87
 
88
+ static NSString *const USER_GEOGRAPHY_GDPR = @"G";
89
+ static NSString *const USER_GEOGRAPHY_OTHER = @"O";
90
+ static NSString *const USER_GEOGRAPHY_UNKNOWN = @"U";
91
+
92
+ static NSString *const APP_TRACKING_STATUS_NOTDETERMINED = @"N";
93
+ static NSString *const APP_TRACKING_STATUS_RESTRICTED = @"R";
94
+ static NSString *const APP_TRACKING_STATUS_DENIED = @"D";
95
+ static NSString *const APP_TRACKING_STATUS_AUTHORIZED = @"A";
96
+ static NSString *const APP_TRACKING_STATUS_UNAVAILABLE = @"U";
97
+
85
98
  static NSString *const ON_BANNER_AD_LOADED_EVENT = @"OnBannerAdLoadedEvent";
86
99
  static NSString *const ON_BANNER_AD_LOAD_FAILED_EVENT = @"OnBannerAdLoadFailedEvent";
87
100
  static NSString *const ON_BANNER_AD_CLICKED_EVENT = @"OnBannerAdClickedEvent";
@@ -212,54 +225,100 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
212
225
  }
213
226
 
214
227
  ALSdkSettings *settings = [[ALSdkSettings alloc] init];
215
- settings.consentFlowSettings.enabled = self.consentFlowEnabledToSet.boolValue;
216
- settings.consentFlowSettings.privacyPolicyURL = self.privacyPolicyURLToSet;
217
- settings.consentFlowSettings.termsOfServiceURL = self.termsOfServiceURLToSet;
218
-
219
- self.consentFlowEnabledToSet = nil;
220
- self.privacyPolicyURLToSet = nil;
221
- self.termsOfServiceURLToSet = nil;
222
-
223
- // Initialize SDK
224
- self.sdk = [ALSdk sharedWithKey: sdkKey settings: settings];
225
- [self.sdk setPluginVersion: [@"React-Native-" stringByAppendingString: pluginVersion]];
226
- [self.sdk setMediationProvider: ALMediationProviderMAX];
227
-
228
- // Set user id if needed
229
- if ( [self.userIdentifierToSet al_isValidString] )
228
+
229
+ // Selective init
230
+ if ( self.initializationAdUnitIdentifiersToSet )
230
231
  {
231
- self.sdk.userIdentifier = self.userIdentifierToSet;
232
- self.userIdentifierToSet = nil;
232
+ settings.initializationAdUnitIdentifiers = self.initializationAdUnitIdentifiersToSet;
233
+ self.initializationAdUnitIdentifiersToSet = nil;
233
234
  }
234
-
235
+
236
+ // Deprecated consent flow which automatically moves to the new flow
237
+ if ( self.consentFlowEnabledToSet )
238
+ {
239
+ settings.consentFlowSettings.enabled = self.consentFlowEnabledToSet.boolValue;
240
+ self.consentFlowEnabledToSet = nil;
241
+
242
+ if ( self.privacyPolicyURLToSet )
243
+ {
244
+ settings.consentFlowSettings.privacyPolicyURL = self.privacyPolicyURLToSet;
245
+ self.privacyPolicyURLToSet = nil;
246
+ }
247
+
248
+ if (self.termsOfServiceURLToSet )
249
+ {
250
+ settings.consentFlowSettings.termsOfServiceURL = self.termsOfServiceURLToSet;
251
+ self.termsOfServiceURLToSet = nil;
252
+ }
253
+ }
254
+
255
+ // New terms and privacy policy flow
256
+ if ( self.termsAndPrivacyPolicyFlowEnabledToSet )
257
+ {
258
+ settings.termsAndPrivacyPolicyFlowSettings.enabled = self.termsAndPrivacyPolicyFlowEnabledToSet.boolValue;
259
+ self.termsAndPrivacyPolicyFlowEnabledToSet = nil;
260
+
261
+ if ( self.privacyPolicyURLToSet )
262
+ {
263
+ settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = self.privacyPolicyURLToSet;
264
+ self.privacyPolicyURLToSet = nil;
265
+ }
266
+
267
+ if ( self.termsOfServiceURLToSet )
268
+ {
269
+ settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = self.termsOfServiceURLToSet;
270
+ self.termsOfServiceURLToSet = nil;
271
+ }
272
+
273
+ if ( self.debugUserGeographyToSet )
274
+ {
275
+ settings.termsAndPrivacyPolicyFlowSettings.debugUserGeography = [self toAppLovinConsentFlowUserGeography: self.debugUserGeographyToSet];
276
+ self.debugUserGeographyToSet = nil;
277
+ }
278
+ }
279
+
235
280
  // Set test device ids if needed
236
281
  if ( self.testDeviceIdentifiersToSet )
237
282
  {
238
- self.sdk.settings.testDeviceAdvertisingIdentifiers = self.testDeviceIdentifiersToSet;
283
+ settings.testDeviceAdvertisingIdentifiers = self.testDeviceIdentifiersToSet;
239
284
  self.testDeviceIdentifiersToSet = nil;
240
285
  }
241
286
 
242
287
  // Set verbose logging state if needed
243
288
  if ( self.verboseLoggingToSet )
244
289
  {
245
- self.sdk.settings.verboseLoggingEnabled = self.verboseLoggingToSet.boolValue;
290
+ settings.verboseLoggingEnabled = self.verboseLoggingToSet.boolValue;
246
291
  self.verboseLoggingToSet = nil;
247
292
  }
248
293
 
249
294
  // Set creative debugger enabled if needed.
250
295
  if ( self.creativeDebuggerEnabledToSet )
251
296
  {
252
- self.sdk.settings.creativeDebuggerEnabled = self.creativeDebuggerEnabledToSet.boolValue;
297
+ settings.creativeDebuggerEnabled = self.creativeDebuggerEnabledToSet.boolValue;
253
298
  self.creativeDebuggerEnabledToSet = nil;
254
299
  }
255
300
 
256
301
  // Set location collection enabled if needed
257
302
  if ( self.locationCollectionEnabledToSet )
258
303
  {
259
- self.sdk.settings.locationCollectionEnabled = self.locationCollectionEnabledToSet.boolValue;
304
+ settings.locationCollectionEnabled = self.locationCollectionEnabledToSet.boolValue;
260
305
  self.locationCollectionEnabledToSet = nil;
261
306
  }
262
307
 
308
+ [self setPendingExtraParametersIfNeeded: settings];
309
+
310
+ // Initialize SDK
311
+ self.sdk = [ALSdk sharedWithKey: sdkKey settings: settings];
312
+ [self.sdk setPluginVersion: [@"React-Native-" stringByAppendingString: pluginVersion]];
313
+ [self.sdk setMediationProvider: ALMediationProviderMAX];
314
+
315
+ // Set user id if needed
316
+ if ( [self.userIdentifierToSet al_isValidString] )
317
+ {
318
+ self.sdk.userIdentifier = self.userIdentifierToSet;
319
+ self.userIdentifierToSet = nil;
320
+ }
321
+
263
322
  if ( self.targetingYearOfBirthToSet )
264
323
  {
265
324
  self.sdk.targetingData.yearOfBirth = self.targetingYearOfBirthToSet.intValue <= 0 ? nil : self.targetingYearOfBirthToSet;
@@ -302,8 +361,6 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
302
361
  self.targetingInterestsToSet = nil;
303
362
  }
304
363
 
305
- [self setPendingExtraParametersIfNeeded: self.sdk.settings];
306
-
307
364
  [self.sdk initializeSdkWithCompletionHandler:^(ALSdkConfiguration *configuration) {
308
365
 
309
366
  [self log: @"SDK initialized"];
@@ -311,7 +368,10 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
311
368
  self.sdkConfiguration = configuration;
312
369
  self.sdkInitialized = YES;
313
370
 
314
- resolve(@{@"countryCode" : self.sdk.configuration.countryCode});
371
+ resolve(@{@"countryCode" : self.sdk.configuration.countryCode,
372
+ @"appTrackingStatus" : [self fromAppLovinAppTrackingStatus: self.sdk.configuration.appTrackingTransparencyStatus],
373
+ @"consentFlowUserGeography" : [self fromAppLovinConsentFlowUserGeography: self.sdk.configuration.consentFlowUserGeography],
374
+ @"isTestModeEnabled" : @(self.sdk.configuration.isTestModeEnabled)});
315
375
  }];
316
376
  }
317
377
 
@@ -447,19 +507,38 @@ RCT_EXPORT_METHOD(setExtraParameter:(NSString *)key :(nullable NSString *)value)
447
507
  }
448
508
  }
449
509
 
510
+ RCT_EXPORT_METHOD(setInitializationAdUnitIds:(NSArray<NSString *> *)adUnitIds)
511
+ {
512
+ self.initializationAdUnitIdentifiersToSet = adUnitIds;
513
+ }
514
+
515
+ #pragma mark - MAX Terms and Privacy Policy Flow
516
+
450
517
  RCT_EXPORT_METHOD(setConsentFlowEnabled:(BOOL)enabled)
451
518
  {
452
519
  self.consentFlowEnabledToSet = @(enabled);
453
520
  }
521
+
522
+ RCT_EXPORT_METHOD(setTermsAndPrivacyPolicyFlowEnabled:(BOOL)enabled)
523
+ {
524
+ self.termsAndPrivacyPolicyFlowEnabledToSet = @(enabled);
525
+ }
526
+
454
527
  RCT_EXPORT_METHOD(setPrivacyPolicyUrl:(NSString *)urlString)
455
528
  {
456
529
  self.privacyPolicyURLToSet = [NSURL URLWithString: urlString];
457
530
  }
531
+
458
532
  RCT_EXPORT_METHOD(setTermsOfServiceUrl:(NSString *)urlString)
459
533
  {
460
534
  self.termsOfServiceURLToSet = [NSURL URLWithString: urlString];
461
535
  }
462
536
 
537
+ RCT_EXPORT_METHOD(setConsentFlowDebugUserGeography:(NSString *)userGeography)
538
+ {
539
+ self.debugUserGeographyToSet = userGeography;
540
+ }
541
+
463
542
  #pragma mark - Data Passing
464
543
 
465
544
  RCT_EXPORT_METHOD(setTargetingDataYearOfBirth:(nonnull NSNumber *)yearOfBirth)
@@ -1971,6 +2050,56 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
1971
2050
  return ALAdContentRatingNone;
1972
2051
  }
1973
2052
 
2053
+ - (ALConsentFlowUserGeography)toAppLovinConsentFlowUserGeography:(NSString *)userGeography
2054
+ {
2055
+ if ( [USER_GEOGRAPHY_GDPR al_isEqualToStringIgnoringCase: userGeography] )
2056
+ {
2057
+ return ALConsentFlowUserGeographyGDPR;
2058
+ }
2059
+ else if ( [USER_GEOGRAPHY_OTHER al_isEqualToStringIgnoringCase: userGeography] )
2060
+ {
2061
+ return ALConsentFlowUserGeographyOther;
2062
+ }
2063
+
2064
+ return ALConsentFlowUserGeographyUnknown;
2065
+ }
2066
+
2067
+ - (NSString *)fromAppLovinConsentFlowUserGeography:(ALConsentFlowUserGeography)userGeography
2068
+ {
2069
+ if ( ALConsentFlowUserGeographyGDPR == userGeography )
2070
+ {
2071
+ return USER_GEOGRAPHY_GDPR;
2072
+ }
2073
+ else if ( ALConsentFlowUserGeographyOther == userGeography )
2074
+ {
2075
+ return USER_GEOGRAPHY_OTHER;
2076
+ }
2077
+
2078
+ return USER_GEOGRAPHY_UNKNOWN;
2079
+ }
2080
+
2081
+ - (NSString *)fromAppLovinAppTrackingStatus:(ALAppTrackingTransparencyStatus)status
2082
+ {
2083
+ if ( ALAppTrackingTransparencyStatusNotDetermined == status )
2084
+ {
2085
+ return APP_TRACKING_STATUS_NOTDETERMINED;
2086
+ }
2087
+ else if ( ALAppTrackingTransparencyStatusRestricted == status )
2088
+ {
2089
+ return APP_TRACKING_STATUS_RESTRICTED;
2090
+ }
2091
+ else if ( ALAppTrackingTransparencyStatusDenied == status )
2092
+ {
2093
+ return APP_TRACKING_STATUS_DENIED;
2094
+ }
2095
+ else if ( ALAppTrackingTransparencyStatusAuthorized == status )
2096
+ {
2097
+ return APP_TRACKING_STATUS_AUTHORIZED;
2098
+ }
2099
+
2100
+ return APP_TRACKING_STATUS_UNAVAILABLE;
2101
+ }
2102
+
1974
2103
  #pragma mark - Ad Info
1975
2104
 
1976
2105
  - (NSDictionary<NSString *, id> *)adInfoForAd:(MAAd *)ad
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.0.2",
4
+ "version": "6.1.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,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 => "release_6_0_2" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_1_0" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
package/src/AdView.tsx CHANGED
@@ -1,4 +1,5 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import * as React from 'react';
2
+ import { useEffect, useState } from 'react';
2
3
  import { NativeModules, requireNativeComponent, StyleSheet } from 'react-native';
3
4
  import type { ViewProps, ViewStyle, StyleProp } from 'react-native';
4
5
  import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
@@ -78,8 +79,8 @@ const getOutlineViewSize = (style: StyleProp<ViewStyle>) => {
78
79
  const sizeAdViewDimensions = (
79
80
  adFormat: AdFormat,
80
81
  adaptiveBannerEnabled?: boolean,
81
- width?: number | string,
82
- height?: number | string
82
+ width?: number | string | null,
83
+ height?: number | string | null
83
84
  ): Promise<Record<string, number>> => {
84
85
  const sizeForBannerFormat = async () => {
85
86
  const isTablet = await AppLovinMAX.isTablet();
@@ -194,6 +195,8 @@ export const AdView = ({
194
195
  useEffect(() => {
195
196
  if (!isInitialized) return;
196
197
  const [width, height] = getOutlineViewSize(style);
198
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
199
+ // @ts-ignore: width and height should be of type DimensionValue in react-native 0.72.0 and above
197
200
  sizeAdViewDimensions(adFormat, adaptiveBannerEnabled, width, height).then((value: Record<string, number>) => {
198
201
  setDimensions(value);
199
202
  });
@@ -4,7 +4,7 @@ import type { Configuration } from './types/Configuration';
4
4
 
5
5
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
6
6
 
7
- const VERSION = '6.0.2';
7
+ const VERSION = '6.1.0';
8
8
 
9
9
  const initialize = async (sdkKey: string): Promise<Configuration> => {
10
10
  return NativeAppLovinMAX.initialize(VERSION, sdkKey);
package/src/Privacy.ts CHANGED
@@ -3,4 +3,60 @@ import type { PrivacyType } from './types/Privacy';
3
3
 
4
4
  const { AppLovinMAX } = NativeModules;
5
5
 
6
+ /**
7
+ * This enum represents the user's geography used to determine the type of consent flow shown to the
8
+ * user.
9
+ */
10
+ export enum ConsentFlowUserGeography {
11
+ /**
12
+ * User's geography is unknown.
13
+ */
14
+ UNKNOWN = 'U',
15
+
16
+ /**
17
+ * The user is in GDPR region.
18
+ */
19
+ GDPR = 'G',
20
+
21
+ /**
22
+ * The user is in a non-GDPR region.
23
+ */
24
+ OTHER = 'O',
25
+ }
26
+
27
+ /**
28
+ * AppLovin SDK-defined app tracking transparency status values (extended to include "unavailable"
29
+ * state on iOS before iOS14).
30
+ */
31
+ export enum AppTrackingStatus {
32
+ /**
33
+ * Device is on iOS before iOS14, AppTrackingTransparency.framework is not available.
34
+ */
35
+ UNAVAILABLE = 'U',
36
+
37
+ /**
38
+ * The user has not yet received an authorization request to authorize access to app-related
39
+ * data that can be used for tracking the user or the device.
40
+ */
41
+ NOT_DETERMINED = 'N',
42
+
43
+ /**
44
+ * Authorization to access app-related data that can be used for tracking the user or the device
45
+ * is restricted.
46
+ */
47
+ RESTRICTED = 'R',
48
+
49
+ /**
50
+ * The user denies authorization to access app-related data that can be used for tracking the
51
+ * user or the device.
52
+ */
53
+ DENIED = 'D',
54
+
55
+ /**
56
+ * The user authorizes access to app-related data that can be used for tracking the user or the
57
+ * device.
58
+ */
59
+ AUTHORIZED = 'A',
60
+ }
61
+
6
62
  export const Privacy: PrivacyType = AppLovinMAX;