react-native-applovin-max 5.0.2 → 5.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.
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +12 -13
- package/ios/AppLovinMAX.m +27 -1
- package/ios/AppLovinMAXNativeAdView.m +16 -17
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +1 -1
- package/src/NativeAdComponents.js +4 -2
- package/src/index.js +1 -1
package/android/build.gradle
CHANGED
|
@@ -386,6 +386,11 @@ public class AppLovinMAXNativeAdView
|
|
|
386
386
|
// 1. AdInfo for publisher to be notified via `onAdLoaded`
|
|
387
387
|
|
|
388
388
|
WritableMap nativeAdInfo = Arguments.createMap();
|
|
389
|
+
nativeAdInfo.putString( "title", ad.getTitle() );
|
|
390
|
+
nativeAdInfo.putString( "advertiser", ad.getAdvertiser() );
|
|
391
|
+
nativeAdInfo.putString( "body", ad.getBody() );
|
|
392
|
+
nativeAdInfo.putString( "callToAction", ad.getCallToAction() );
|
|
393
|
+
|
|
389
394
|
float aspectRatio = ad.getMediaContentAspectRatio();
|
|
390
395
|
if ( !Float.isNaN( aspectRatio ) )
|
|
391
396
|
{
|
|
@@ -404,26 +409,20 @@ public class AppLovinMAXNativeAdView
|
|
|
404
409
|
nativeAdInfo.putDouble( "mediaContentAspectRatio", 1.0 );
|
|
405
410
|
}
|
|
406
411
|
|
|
412
|
+
nativeAdInfo.putBoolean( "isIconImageAvailable", ( ad.getIcon() != null ) );
|
|
413
|
+
nativeAdInfo.putBoolean( "isOptionsViewAvailable", ( ad.getOptionsView() != null ) );
|
|
414
|
+
nativeAdInfo.putBoolean( "isMediaViewAvailable", ( ad.getMediaView() != null ) );
|
|
415
|
+
|
|
407
416
|
WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( nativeAd );
|
|
408
417
|
adInfo.putMap( "nativeAd", nativeAdInfo );
|
|
409
418
|
|
|
410
419
|
// 2. NativeAd for `AppLovinNativeAdView.js` to render the views
|
|
411
420
|
|
|
412
421
|
WritableMap jsNativeAd = Arguments.createMap();
|
|
413
|
-
|
|
414
422
|
jsNativeAd.putString( "title", ad.getTitle() );
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
if ( ad.getBody() != null )
|
|
420
|
-
{
|
|
421
|
-
jsNativeAd.putString( "body", ad.getBody() );
|
|
422
|
-
}
|
|
423
|
-
if ( ad.getCallToAction() != null )
|
|
424
|
-
{
|
|
425
|
-
jsNativeAd.putString( "callToAction", ad.getCallToAction() );
|
|
426
|
-
}
|
|
423
|
+
jsNativeAd.putString( "advertiser", ad.getAdvertiser() );
|
|
424
|
+
jsNativeAd.putString( "body", ad.getBody() );
|
|
425
|
+
jsNativeAd.putString( "callToAction", ad.getCallToAction() );
|
|
427
426
|
|
|
428
427
|
MaxNativeAdImage icon = ad.getIcon();
|
|
429
428
|
if ( icon != null )
|
package/ios/AppLovinMAX.m
CHANGED
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
@property (nonatomic, strong, nullable) NSNumber *locationCollectionEnabledToSet;
|
|
45
45
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> *extraParametersToSet;
|
|
46
46
|
|
|
47
|
+
@property (nonatomic, strong, nullable) NSNumber *consentFlowEnabledToSet;
|
|
48
|
+
@property (nonatomic, strong, nullable) NSURL *privacyPolicyURLToSet;
|
|
49
|
+
@property (nonatomic, strong, nullable) NSURL *termsOfServiceURLToSet;
|
|
50
|
+
|
|
47
51
|
@property (nonatomic, strong, nullable) NSNumber *targetingYearOfBirthToSet;
|
|
48
52
|
@property (nonatomic, copy, nullable) NSString *targetingGenderToSet;
|
|
49
53
|
@property (nonatomic, strong, nullable) NSNumber *targetingMaximumAdContentRatingToSet;
|
|
@@ -207,8 +211,17 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
|
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
213
|
|
|
214
|
+
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
|
+
|
|
210
223
|
// Initialize SDK
|
|
211
|
-
self.sdk = [ALSdk sharedWithKey: sdkKey];
|
|
224
|
+
self.sdk = [ALSdk sharedWithKey: sdkKey settings: settings];
|
|
212
225
|
[self.sdk setPluginVersion: [@"React-Native-" stringByAppendingString: pluginVersion]];
|
|
213
226
|
[self.sdk setMediationProvider: ALMediationProviderMAX];
|
|
214
227
|
|
|
@@ -434,6 +447,19 @@ RCT_EXPORT_METHOD(setExtraParameter:(NSString *)key :(nullable NSString *)value)
|
|
|
434
447
|
}
|
|
435
448
|
}
|
|
436
449
|
|
|
450
|
+
RCT_EXPORT_METHOD(setConsentFlowEnabled:(BOOL)enabled)
|
|
451
|
+
{
|
|
452
|
+
self.consentFlowEnabledToSet = @(enabled);
|
|
453
|
+
}
|
|
454
|
+
RCT_EXPORT_METHOD(setPrivacyPolicyUrl:(NSString *)urlString)
|
|
455
|
+
{
|
|
456
|
+
self.privacyPolicyURLToSet = [NSURL URLWithString: urlString];
|
|
457
|
+
}
|
|
458
|
+
RCT_EXPORT_METHOD(setTermsOfServiceUrl:(NSString *)urlString)
|
|
459
|
+
{
|
|
460
|
+
self.termsOfServiceURLToSet = [NSURL URLWithString: urlString];
|
|
461
|
+
}
|
|
462
|
+
|
|
437
463
|
#pragma mark - Data Passing
|
|
438
464
|
|
|
439
465
|
RCT_EXPORT_METHOD(setTargetingDataYearOfBirth:(nonnull NSNumber *)yearOfBirth)
|
|
@@ -279,7 +279,12 @@
|
|
|
279
279
|
{
|
|
280
280
|
// 1. AdInfo for publisher to be notified via `onAdLoaded`
|
|
281
281
|
|
|
282
|
-
NSMutableDictionary<NSString *, id> *nativeAdInfo = [NSMutableDictionary dictionaryWithCapacity:
|
|
282
|
+
NSMutableDictionary<NSString *, id> *nativeAdInfo = [NSMutableDictionary dictionaryWithCapacity: 5];
|
|
283
|
+
nativeAdInfo[@"title"] = ad.title;
|
|
284
|
+
nativeAdInfo[@"advertiser"] = ad.advertiser;
|
|
285
|
+
nativeAdInfo[@"body"] = ad.body;
|
|
286
|
+
nativeAdInfo[@"callToAction"] = ad.callToAction;
|
|
287
|
+
|
|
283
288
|
if ( !isnan(ad.mediaContentAspectRatio) )
|
|
284
289
|
{
|
|
285
290
|
// The aspect ratio can be 0.0f when it is not provided by the network.
|
|
@@ -297,28 +302,21 @@
|
|
|
297
302
|
nativeAdInfo[@"mediaContentAspectRatio"] = @(1.0);
|
|
298
303
|
}
|
|
299
304
|
|
|
305
|
+
nativeAdInfo[@"isIconImageAvailable"] = @(ad.icon != nil);
|
|
306
|
+
nativeAdInfo[@"isOptionsViewAvailable"] = @(ad.optionsView != nil);
|
|
307
|
+
nativeAdInfo[@"isMediaViewAvailable"] = @(ad.mediaView != nil);
|
|
308
|
+
|
|
300
309
|
NSMutableDictionary *adInfo = [[AppLovinMAX shared] adInfoForAd: self.nativeAd].mutableCopy;
|
|
301
310
|
adInfo[@"nativeAd"] = nativeAdInfo;
|
|
302
311
|
|
|
303
312
|
// 2. NativeAd for `AppLovinNativeAdView.js` to render the views
|
|
304
313
|
|
|
305
314
|
NSMutableDictionary<NSString *, id> *jsNativeAd = [NSMutableDictionary dictionaryWithCapacity: 5];
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
{
|
|
312
|
-
jsNativeAd[@"advertiser"] = ad.advertiser;
|
|
313
|
-
}
|
|
314
|
-
if ( ad.body )
|
|
315
|
-
{
|
|
316
|
-
jsNativeAd[@"body"] = ad.body;
|
|
317
|
-
}
|
|
318
|
-
if ( ad.callToAction )
|
|
319
|
-
{
|
|
320
|
-
jsNativeAd[@"callToAction"] = ad.callToAction;
|
|
321
|
-
}
|
|
315
|
+
jsNativeAd[@"title"] = ad.title;
|
|
316
|
+
jsNativeAd[@"advertiser"] = ad.advertiser;
|
|
317
|
+
jsNativeAd[@"body"] = ad.body;
|
|
318
|
+
jsNativeAd[@"callToAction"] = ad.callToAction;
|
|
319
|
+
|
|
322
320
|
if ( ad.icon )
|
|
323
321
|
{
|
|
324
322
|
if ( ad.icon.URL )
|
|
@@ -330,6 +328,7 @@
|
|
|
330
328
|
jsNativeAd[@"image"] = @(YES);
|
|
331
329
|
}
|
|
332
330
|
}
|
|
331
|
+
|
|
333
332
|
jsNativeAd[@"isOptionsViewAvailable"] = ad.optionsView ? @(YES) : @(NO);
|
|
334
333
|
jsNativeAd[@"isMediaViewAvailable"] = ad.mediaView ? @(YES) : @(NO);
|
|
335
334
|
|
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
|
|
4
|
+
"version": "5.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 => "
|
|
14
|
+
s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_5_1_0" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/AppLovinMAX*.{h,m}"
|
|
17
17
|
|
|
@@ -94,7 +94,7 @@ export const IconView = (props) => {
|
|
|
94
94
|
const {nativeAd, nativeAdView} = useContext(NativeAdViewContext);
|
|
95
95
|
|
|
96
96
|
useEffect(() => {
|
|
97
|
-
if (!nativeAdView || !
|
|
97
|
+
if (!nativeAdView || !nativeAd.image) return;
|
|
98
98
|
|
|
99
99
|
nativeAdView.setNativeProps({
|
|
100
100
|
iconView: findNodeHandle(imageRef.current),
|
|
@@ -104,7 +104,9 @@ export const IconView = (props) => {
|
|
|
104
104
|
if (!nativeAdView) return null;
|
|
105
105
|
|
|
106
106
|
return (
|
|
107
|
-
<Image {...props}
|
|
107
|
+
nativeAd.url ? <Image {...props} source={{uri: nativeAd.url}} /> :
|
|
108
|
+
nativeAd.image ? <Image {...props} ref={imageRef} /> :
|
|
109
|
+
<Image {...props} />
|
|
108
110
|
);
|
|
109
111
|
};
|
|
110
112
|
|