react-native-applovin-max 5.0.2 → 5.2.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 +3 -3
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +22 -13
- package/ios/AppLovinMAX.m +27 -1
- package/ios/AppLovinMAXNativeAdView.m +54 -34
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +4 -4
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/NativeAdComponents.js +63 -4
- package/src/NativeAdView.js +2 -1
- package/src/index.js +1 -1
package/android/build.gradle
CHANGED
|
@@ -35,8 +35,8 @@ android {
|
|
|
35
35
|
defaultConfig {
|
|
36
36
|
minSdkVersion 16
|
|
37
37
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
38
|
-
versionCode
|
|
39
|
-
versionName "5.0
|
|
38
|
+
versionCode 5020000
|
|
39
|
+
versionName "5.2.0"
|
|
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.
|
|
143
|
+
implementation 'com.applovin:applovin-sdk:11.9.0'
|
|
144
144
|
}
|
|
@@ -289,11 +289,11 @@ public class AppLovinMAXNativeAdView
|
|
|
289
289
|
@Override
|
|
290
290
|
public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom)
|
|
291
291
|
{
|
|
292
|
-
if ( view == mediaView.getParent() )
|
|
292
|
+
if ( mediaView != null && view == mediaView.getParent() )
|
|
293
293
|
{
|
|
294
294
|
sizeToFit( mediaView, view );
|
|
295
295
|
}
|
|
296
|
-
else if ( view == optionsView.getParent() )
|
|
296
|
+
else if ( optionsView != null && view == optionsView.getParent() )
|
|
297
297
|
{
|
|
298
298
|
sizeToFit( optionsView, view );
|
|
299
299
|
}
|
|
@@ -386,6 +386,16 @@ 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
|
+
|
|
394
|
+
if ( ad.getStarRating() != null )
|
|
395
|
+
{
|
|
396
|
+
nativeAdInfo.putDouble( "starRating", ad.getStarRating().doubleValue() );
|
|
397
|
+
}
|
|
398
|
+
|
|
389
399
|
float aspectRatio = ad.getMediaContentAspectRatio();
|
|
390
400
|
if ( !Float.isNaN( aspectRatio ) )
|
|
391
401
|
{
|
|
@@ -404,25 +414,24 @@ public class AppLovinMAXNativeAdView
|
|
|
404
414
|
nativeAdInfo.putDouble( "mediaContentAspectRatio", 1.0 );
|
|
405
415
|
}
|
|
406
416
|
|
|
417
|
+
nativeAdInfo.putBoolean( "isIconImageAvailable", ( ad.getIcon() != null ) );
|
|
418
|
+
nativeAdInfo.putBoolean( "isOptionsViewAvailable", ( ad.getOptionsView() != null ) );
|
|
419
|
+
nativeAdInfo.putBoolean( "isMediaViewAvailable", ( ad.getMediaView() != null ) );
|
|
420
|
+
|
|
407
421
|
WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( nativeAd );
|
|
408
422
|
adInfo.putMap( "nativeAd", nativeAdInfo );
|
|
409
423
|
|
|
410
424
|
// 2. NativeAd for `AppLovinNativeAdView.js` to render the views
|
|
411
425
|
|
|
412
426
|
WritableMap jsNativeAd = Arguments.createMap();
|
|
413
|
-
|
|
414
427
|
jsNativeAd.putString( "title", ad.getTitle() );
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if ( ad.
|
|
420
|
-
{
|
|
421
|
-
jsNativeAd.putString( "body", ad.getBody() );
|
|
422
|
-
}
|
|
423
|
-
if ( ad.getCallToAction() != null )
|
|
428
|
+
jsNativeAd.putString( "advertiser", ad.getAdvertiser() );
|
|
429
|
+
jsNativeAd.putString( "body", ad.getBody() );
|
|
430
|
+
jsNativeAd.putString( "callToAction", ad.getCallToAction() );
|
|
431
|
+
|
|
432
|
+
if ( ad.getStarRating() != null )
|
|
424
433
|
{
|
|
425
|
-
jsNativeAd.
|
|
434
|
+
jsNativeAd.putDouble( "starRating", ad.getStarRating().doubleValue() );
|
|
426
435
|
}
|
|
427
436
|
|
|
428
437
|
MaxNativeAdImage icon = ad.getIcon();
|
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)
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
#import "AppLovinMAX.h"
|
|
12
12
|
#import "AppLovinMAXNativeAdView.h"
|
|
13
13
|
|
|
14
|
+
#define TITLE_LABEL_TAG 1
|
|
15
|
+
#define MEDIA_VIEW_CONTAINER_TAG 2
|
|
16
|
+
#define ICON_VIEW_TAG 3
|
|
17
|
+
#define BODY_VIEW_TAG 4
|
|
18
|
+
#define CALL_TO_ACTION_VIEW_TAG 5
|
|
19
|
+
#define ADVERTISER_VIEW_TAG 8
|
|
20
|
+
|
|
14
21
|
@interface MANativeAdLoader()
|
|
15
22
|
- (void)registerClickableViews:(NSArray<UIView *> *)clickableViews
|
|
16
23
|
withContainer:(UIView *)container
|
|
@@ -85,7 +92,7 @@
|
|
|
85
92
|
- (void)setAdUnitId:(NSString *)adUnitId
|
|
86
93
|
{
|
|
87
94
|
if ( ![adUnitId al_isValidString] ) return;
|
|
88
|
-
|
|
95
|
+
|
|
89
96
|
_adUnitId = adUnitId;
|
|
90
97
|
|
|
91
98
|
// Explicitly invoke ad load now that Ad Unit ID is set, but do so after 0.25s to allow other props to set
|
|
@@ -102,7 +109,7 @@
|
|
|
102
109
|
[[AppLovinMAX shared] logUninitializedAccessError: @"AppLovinMAXNativeAdview.loadAd"];
|
|
103
110
|
return;
|
|
104
111
|
}
|
|
105
|
-
|
|
112
|
+
|
|
106
113
|
if ( [self.isLoading compareAndSet: NO update: YES] )
|
|
107
114
|
{
|
|
108
115
|
[[AppLovinMAX shared] log: @"Loading a native ad for Ad Unit ID: %@...", self.adUnitId];
|
|
@@ -133,7 +140,7 @@
|
|
|
133
140
|
- (void)setTitleView:(NSNumber *)tag
|
|
134
141
|
{
|
|
135
142
|
if ( !self.nativeAd.nativeAd.title ) return;
|
|
136
|
-
|
|
143
|
+
|
|
137
144
|
UIView *view = [self.bridge.uiManager viewForReactTag: tag];
|
|
138
145
|
if ( !view )
|
|
139
146
|
{
|
|
@@ -141,48 +148,56 @@
|
|
|
141
148
|
return;
|
|
142
149
|
}
|
|
143
150
|
|
|
151
|
+
view.tag = TITLE_LABEL_TAG;
|
|
152
|
+
|
|
144
153
|
[self.clickableViews addObject: view];
|
|
145
154
|
}
|
|
146
155
|
|
|
147
156
|
- (void)setAdvertiserView:(NSNumber *)tag
|
|
148
157
|
{
|
|
149
158
|
if ( !self.nativeAd.nativeAd.advertiser ) return;
|
|
150
|
-
|
|
159
|
+
|
|
151
160
|
UIView *view = [self.bridge.uiManager viewForReactTag: tag];
|
|
152
161
|
if ( !view )
|
|
153
162
|
{
|
|
154
163
|
[[AppLovinMAX shared] log: @"Cannot find an advertiser view with tag \"%@\" for %@", tag, self.adUnitId];
|
|
155
164
|
return;
|
|
156
165
|
}
|
|
157
|
-
|
|
166
|
+
|
|
167
|
+
view.tag = ADVERTISER_VIEW_TAG;
|
|
168
|
+
|
|
158
169
|
[self.clickableViews addObject: view];
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
- (void)setBodyView:(NSNumber *)tag
|
|
162
173
|
{
|
|
163
174
|
if ( !self.nativeAd.nativeAd.body ) return;
|
|
164
|
-
|
|
175
|
+
|
|
165
176
|
UIView *view = [self.bridge.uiManager viewForReactTag: tag];
|
|
166
177
|
if ( !view )
|
|
167
178
|
{
|
|
168
179
|
[[AppLovinMAX shared] log: @"Cannot find a body view with tag \"%@\" for %@", tag, self.adUnitId];
|
|
169
180
|
return;
|
|
170
181
|
}
|
|
171
|
-
|
|
182
|
+
|
|
183
|
+
view.tag = BODY_VIEW_TAG;
|
|
184
|
+
|
|
172
185
|
[self.clickableViews addObject: view];
|
|
173
186
|
}
|
|
174
187
|
|
|
175
188
|
- (void)setCallToActionView:(NSNumber *)tag
|
|
176
189
|
{
|
|
177
190
|
if ( !self.nativeAd.nativeAd.callToAction ) return;
|
|
178
|
-
|
|
191
|
+
|
|
179
192
|
UIView *view = [self.bridge.uiManager viewForReactTag: tag];
|
|
180
193
|
if ( !view )
|
|
181
194
|
{
|
|
182
195
|
[[AppLovinMAX shared] log: @"Cannot find a callToAction view with tag \"%@\" for %@", tag, self.adUnitId];
|
|
183
196
|
return;
|
|
184
197
|
}
|
|
185
|
-
|
|
198
|
+
|
|
199
|
+
view.tag = CALL_TO_ACTION_VIEW_TAG;
|
|
200
|
+
|
|
186
201
|
[self.clickableViews addObject: view];
|
|
187
202
|
}
|
|
188
203
|
|
|
@@ -195,6 +210,8 @@
|
|
|
195
210
|
return;
|
|
196
211
|
}
|
|
197
212
|
|
|
213
|
+
view.tag = ICON_VIEW_TAG;
|
|
214
|
+
|
|
198
215
|
[self.clickableViews addObject: view];
|
|
199
216
|
|
|
200
217
|
MANativeAdImage *icon = self.nativeAd.nativeAd.icon;
|
|
@@ -212,14 +229,14 @@
|
|
|
212
229
|
- (void)setOptionsView:(NSNumber *)tag
|
|
213
230
|
{
|
|
214
231
|
if ( !self.nativeAd.nativeAd.optionsView ) return;
|
|
215
|
-
|
|
232
|
+
|
|
216
233
|
UIView *view = [self.bridge.uiManager viewForReactTag: tag];
|
|
217
234
|
if ( !view )
|
|
218
235
|
{
|
|
219
236
|
[[AppLovinMAX shared] log: @"Cannot find an option view with tag \"%@\" for %@", tag, self.adUnitId];
|
|
220
237
|
return;
|
|
221
238
|
}
|
|
222
|
-
|
|
239
|
+
|
|
223
240
|
[view addSubview: self.nativeAd.nativeAd.optionsView];
|
|
224
241
|
[self.nativeAd.nativeAd.optionsView al_pinToSuperview];
|
|
225
242
|
}
|
|
@@ -234,9 +251,11 @@
|
|
|
234
251
|
[[AppLovinMAX shared] log: @"Cannot find a media view with tag \"%@\" for %@", tag, self.adUnitId];
|
|
235
252
|
return;
|
|
236
253
|
}
|
|
237
|
-
|
|
254
|
+
|
|
255
|
+
view.tag = MEDIA_VIEW_CONTAINER_TAG;
|
|
256
|
+
|
|
238
257
|
[self.clickableViews addObject: view];
|
|
239
|
-
|
|
258
|
+
|
|
240
259
|
[view addSubview: self.nativeAd.nativeAd.mediaView];
|
|
241
260
|
[self.nativeAd.nativeAd.mediaView al_pinToSuperview];
|
|
242
261
|
}
|
|
@@ -246,7 +265,7 @@
|
|
|
246
265
|
- (void)didLoadNativeAd:(nullable MANativeAdView *)nativeAdView forAd:(MAAd *)ad
|
|
247
266
|
{
|
|
248
267
|
[[AppLovinMAX shared] log: @"Native ad loaded: %@", ad];
|
|
249
|
-
|
|
268
|
+
|
|
250
269
|
// Log a warning if it is a template native ad returned - as our plugin will be responsible for re-rendering the native ad's assets
|
|
251
270
|
if ( nativeAdView )
|
|
252
271
|
{
|
|
@@ -270,7 +289,7 @@
|
|
|
270
289
|
|
|
271
290
|
[self.adLoader registerClickableViews: self.clickableViews withContainer: self forAd: ad];
|
|
272
291
|
[self.adLoader handleNativeAdViewRenderedForAd: ad];
|
|
273
|
-
|
|
292
|
+
|
|
274
293
|
[self.isLoading set: NO];
|
|
275
294
|
});
|
|
276
295
|
}
|
|
@@ -279,7 +298,13 @@
|
|
|
279
298
|
{
|
|
280
299
|
// 1. AdInfo for publisher to be notified via `onAdLoaded`
|
|
281
300
|
|
|
282
|
-
NSMutableDictionary<NSString *, id> *nativeAdInfo = [NSMutableDictionary dictionaryWithCapacity:
|
|
301
|
+
NSMutableDictionary<NSString *, id> *nativeAdInfo = [NSMutableDictionary dictionaryWithCapacity: 5];
|
|
302
|
+
nativeAdInfo[@"title"] = ad.title;
|
|
303
|
+
nativeAdInfo[@"advertiser"] = ad.advertiser;
|
|
304
|
+
nativeAdInfo[@"body"] = ad.body;
|
|
305
|
+
nativeAdInfo[@"callToAction"] = ad.callToAction;
|
|
306
|
+
nativeAdInfo[@"starRating"] = ad.starRating;
|
|
307
|
+
|
|
283
308
|
if ( !isnan(ad.mediaContentAspectRatio) )
|
|
284
309
|
{
|
|
285
310
|
// The aspect ratio can be 0.0f when it is not provided by the network.
|
|
@@ -296,29 +321,23 @@
|
|
|
296
321
|
{
|
|
297
322
|
nativeAdInfo[@"mediaContentAspectRatio"] = @(1.0);
|
|
298
323
|
}
|
|
299
|
-
|
|
324
|
+
|
|
325
|
+
nativeAdInfo[@"isIconImageAvailable"] = @(ad.icon != nil);
|
|
326
|
+
nativeAdInfo[@"isOptionsViewAvailable"] = @(ad.optionsView != nil);
|
|
327
|
+
nativeAdInfo[@"isMediaViewAvailable"] = @(ad.mediaView != nil);
|
|
328
|
+
|
|
300
329
|
NSMutableDictionary *adInfo = [[AppLovinMAX shared] adInfoForAd: self.nativeAd].mutableCopy;
|
|
301
330
|
adInfo[@"nativeAd"] = nativeAdInfo;
|
|
302
331
|
|
|
303
332
|
// 2. NativeAd for `AppLovinNativeAdView.js` to render the views
|
|
304
333
|
|
|
305
334
|
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
|
-
}
|
|
335
|
+
jsNativeAd[@"title"] = ad.title;
|
|
336
|
+
jsNativeAd[@"advertiser"] = ad.advertiser;
|
|
337
|
+
jsNativeAd[@"body"] = ad.body;
|
|
338
|
+
jsNativeAd[@"callToAction"] = ad.callToAction;
|
|
339
|
+
jsNativeAd[@"starRating"] = ad.starRating;
|
|
340
|
+
|
|
322
341
|
if ( ad.icon )
|
|
323
342
|
{
|
|
324
343
|
if ( ad.icon.URL )
|
|
@@ -330,6 +349,7 @@
|
|
|
330
349
|
jsNativeAd[@"image"] = @(YES);
|
|
331
350
|
}
|
|
332
351
|
}
|
|
352
|
+
|
|
333
353
|
jsNativeAd[@"isOptionsViewAvailable"] = ad.optionsView ? @(YES) : @(NO);
|
|
334
354
|
jsNativeAd[@"isMediaViewAvailable"] = ad.mediaView ? @(YES) : @(NO);
|
|
335
355
|
|
|
@@ -383,7 +403,7 @@
|
|
|
383
403
|
|
|
384
404
|
self.nativeAd = nil;
|
|
385
405
|
}
|
|
386
|
-
|
|
406
|
+
|
|
387
407
|
[self.clickableViews removeAllObjects];
|
|
388
408
|
}
|
|
389
409
|
|
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.
|
|
38
|
+
pod 'AppLovinSDK', '11.9.0'
|
|
39
39
|
|
|
40
40
|
end
|
package/ios/Podfile.lock
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
PODS:
|
|
2
|
-
- AppLovinSDK (11.
|
|
2
|
+
- AppLovinSDK (11.9.0)
|
|
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.
|
|
252
|
+
- AppLovinSDK (= 11.9.0)
|
|
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:
|
|
342
|
+
AppLovinSDK: 2022f21e5b713b2c04bb7c2f10bde0f2dea89f11
|
|
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:
|
|
371
|
+
PODFILE CHECKSUM: 13c464ab10da6fc8a379ce53d55c204e98215526
|
|
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
|
|
4
|
+
"version": "5.2.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,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 => "
|
|
14
|
+
s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_5_2_0" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/AppLovinMAX*.{h,m}"
|
|
17
17
|
|
|
18
18
|
s.dependency "React"
|
|
19
|
-
s.dependency "AppLovinSDK", "11.
|
|
19
|
+
s.dependency "AppLovinSDK", "11.9.0"
|
|
20
20
|
end
|
|
@@ -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
|
+
<View {...props} />
|
|
108
110
|
);
|
|
109
111
|
};
|
|
110
112
|
|
|
@@ -124,7 +126,7 @@ export const OptionsView = (props) => {
|
|
|
124
126
|
if (!nativeAdView) return null;
|
|
125
127
|
|
|
126
128
|
return (
|
|
127
|
-
<View {...props} ref={viewRef}/>
|
|
129
|
+
<View {...props} ref={viewRef} />
|
|
128
130
|
);
|
|
129
131
|
};
|
|
130
132
|
|
|
@@ -144,6 +146,63 @@ export const MediaView = (props) => {
|
|
|
144
146
|
if (!nativeAdView) return null;
|
|
145
147
|
|
|
146
148
|
return (
|
|
147
|
-
<View {...props} ref={viewRef}/>
|
|
149
|
+
<View {...props} ref={viewRef} />
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const StarRatingView = (props) => {
|
|
154
|
+
const {style, ...otherProps} = props;
|
|
155
|
+
|
|
156
|
+
const maxStarCount = 5;
|
|
157
|
+
const starColor = style.color ?? "#ffe234";
|
|
158
|
+
const starSize = style.fontSize ?? 10;
|
|
159
|
+
|
|
160
|
+
const {nativeAd, nativeAdView} = useContext(NativeAdViewContext);
|
|
161
|
+
|
|
162
|
+
const FilledStar = ({size,color}) => {
|
|
163
|
+
return (
|
|
164
|
+
// black star in unicode
|
|
165
|
+
<Text style={{fontSize: size, color: color}}>{String.fromCodePoint(0x2605)}</Text>
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const EmptyStar = ({size,color}) => {
|
|
170
|
+
return (
|
|
171
|
+
// white star in unicode
|
|
172
|
+
<Text style={{fontSize: size, color: color}}>{String.fromCodePoint(0x2606)}</Text>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const StarView = ({index, rating, size, color}) => {
|
|
177
|
+
const width = (rating - index) * size;
|
|
178
|
+
return (
|
|
179
|
+
<View>
|
|
180
|
+
<EmptyStar size={size} color={color} />
|
|
181
|
+
{
|
|
182
|
+
(rating > index) &&
|
|
183
|
+
<View style={{ width: width, overflow: 'hidden', position: 'absolute'}}>
|
|
184
|
+
<FilledStar style={{top:0, left:0}} size={size} color={color} />
|
|
185
|
+
</View>
|
|
186
|
+
}
|
|
187
|
+
</View>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
if (!nativeAdView) return null;
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<View style={[style, {flexDirection: 'row', alignItems: 'center'}]}>
|
|
195
|
+
{(() => {
|
|
196
|
+
let stars = [];
|
|
197
|
+
for (let index = 0; index < maxStarCount; index++) {
|
|
198
|
+
if (nativeAd.starRating) {
|
|
199
|
+
stars.push(<StarView key={index} index={index} rating={nativeAd.starRating} size={starSize} color={starColor} />);
|
|
200
|
+
} else {
|
|
201
|
+
stars.push(<Text key={index} style={{fontSize: starSize}}> </Text>);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return stars;
|
|
205
|
+
})()}
|
|
206
|
+
</View>
|
|
148
207
|
);
|
|
149
208
|
};
|
package/src/NativeAdView.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useContext, useImperativeHandle, useRef, useState, u
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { NativeModules, requireNativeComponent, UIManager, findNodeHandle } from "react-native";
|
|
4
4
|
import { NativeAdViewContext, NativeAdViewProvider } from "./NativeAdViewProvider";
|
|
5
|
-
import { TitleView, AdvertiserView, BodyView, CallToActionView, IconView, OptionsView, MediaView } from "./NativeAdComponents";
|
|
5
|
+
import { TitleView, AdvertiserView, BodyView, CallToActionView, IconView, OptionsView, MediaView, StarRatingView } from "./NativeAdComponents";
|
|
6
6
|
|
|
7
7
|
const { AppLovinMAX } = NativeModules;
|
|
8
8
|
|
|
@@ -159,5 +159,6 @@ NativeAdViewWrapper.CallToActionView = CallToActionView;
|
|
|
159
159
|
NativeAdViewWrapper.IconView = IconView;
|
|
160
160
|
NativeAdViewWrapper.OptionsView = OptionsView;
|
|
161
161
|
NativeAdViewWrapper.MediaView = MediaView;
|
|
162
|
+
NativeAdViewWrapper.StarRatingView = StarRatingView;
|
|
162
163
|
|
|
163
164
|
export default NativeAdViewWrapper;
|