react-native-applovin-max 5.0.1 → 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/AppLovinMAXModule.java +83 -23
- 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
|
@@ -414,7 +414,8 @@ public class AppLovinMAXModule
|
|
|
414
414
|
@ReactMethod
|
|
415
415
|
public void isTablet(final Promise promise)
|
|
416
416
|
{
|
|
417
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 )
|
|
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 )
|
|
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
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
return
|
|
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)
|
|
@@ -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
|
|