react-native-applovin-max 6.1.1 → 6.2.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.
- package/android/.project +1 -7
- package/android/.settings/org.eclipse.buildship.core.prefs +3 -3
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +12 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +70 -0
- package/ios/AppLovinMAX.m +99 -21
- package/ios/AppLovinMAXAdView.h +4 -0
- package/ios/AppLovinMAXAdView.m +19 -1
- package/ios/AppLovinMAXNativeAdView.m +2 -1
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +1 -1
- package/src/AppLovinMAX.ts +1 -1
- package/android/src/main/java/com/applovin/mediation/adapters/GoogleAdManagerMediationAdapter.java.saved +0 -1616
- package/android/src/main/java/com/applovin/mediation/adapters/GoogleMediationAdapter.java.saved +0 -1788
- package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.old +0 -1481
- package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.saved +0 -1448
package/android/.project
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<projectDescription>
|
|
3
|
-
<name>
|
|
3
|
+
<name>android_</name>
|
|
4
4
|
<comment>Project android_ created by Buildship.</comment>
|
|
5
5
|
<projects>
|
|
6
6
|
</projects>
|
|
7
7
|
<buildSpec>
|
|
8
|
-
<buildCommand>
|
|
9
|
-
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
-
<arguments>
|
|
11
|
-
</arguments>
|
|
12
|
-
</buildCommand>
|
|
13
8
|
<buildCommand>
|
|
14
9
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
10
|
<arguments>
|
|
@@ -17,7 +12,6 @@
|
|
|
17
12
|
</buildCommand>
|
|
18
13
|
</buildSpec>
|
|
19
14
|
<natures>
|
|
20
|
-
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
15
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
16
|
</natures>
|
|
23
17
|
</projectDescription>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
arguments
|
|
1
|
+
arguments=
|
|
2
2
|
auto.sync=false
|
|
3
3
|
build.scans.enabled=false
|
|
4
|
-
connection.gradle.distribution=GRADLE_DISTRIBUTION(
|
|
4
|
+
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0))
|
|
5
5
|
connection.project.dir=
|
|
6
6
|
eclipse.preferences.version=1
|
|
7
7
|
gradle.user.home=
|
|
8
|
-
java.home=/
|
|
8
|
+
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
|
|
9
9
|
jvm.arguments=
|
|
10
10
|
offline.mode=false
|
|
11
11
|
override.workspace.settings=true
|
package/android/build.gradle
CHANGED
|
@@ -16,6 +16,7 @@ import com.facebook.react.uimanager.ThemedReactContext;
|
|
|
16
16
|
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
17
17
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
18
18
|
|
|
19
|
+
import java.util.HashMap;
|
|
19
20
|
import java.util.Map;
|
|
20
21
|
|
|
21
22
|
import androidx.annotation.Nullable;
|
|
@@ -27,6 +28,8 @@ class AppLovinMAXAdView
|
|
|
27
28
|
extends ReactViewGroup
|
|
28
29
|
implements MaxAdListener, MaxAdViewAdListener, MaxAdRevenueListener
|
|
29
30
|
{
|
|
31
|
+
private static final Map<String, MaxAdView> adViewInstances = new HashMap<>( 2 );
|
|
32
|
+
|
|
30
33
|
private final ThemedReactContext reactContext;
|
|
31
34
|
|
|
32
35
|
@Nullable
|
|
@@ -45,6 +48,11 @@ class AppLovinMAXAdView
|
|
|
45
48
|
@Nullable
|
|
46
49
|
private Map<String, Object> localExtraParameters;
|
|
47
50
|
|
|
51
|
+
public static MaxAdView getInstance(final String adUnitId)
|
|
52
|
+
{
|
|
53
|
+
return adViewInstances.get( adUnitId );
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
public AppLovinMAXAdView(final Context context)
|
|
49
57
|
{
|
|
50
58
|
super( context );
|
|
@@ -268,6 +276,8 @@ class AppLovinMAXAdView
|
|
|
268
276
|
adView.loadAd();
|
|
269
277
|
|
|
270
278
|
addView( adView );
|
|
279
|
+
|
|
280
|
+
adViewInstances.put( adUnitId, adView );
|
|
271
281
|
}, 250 );
|
|
272
282
|
}
|
|
273
283
|
|
|
@@ -277,6 +287,8 @@ class AppLovinMAXAdView
|
|
|
277
287
|
{
|
|
278
288
|
AppLovinMAXModule.d( "Unmounting MaxAdView: " + adView );
|
|
279
289
|
|
|
290
|
+
adViewInstances.remove( adView.getAdUnitId() );
|
|
291
|
+
|
|
280
292
|
removeView( adView );
|
|
281
293
|
|
|
282
294
|
adView.setListener( null );
|
|
@@ -2673,6 +2673,76 @@ public class AppLovinMAXModule
|
|
|
2673
2673
|
return networkResponseObject;
|
|
2674
2674
|
}
|
|
2675
2675
|
|
|
2676
|
+
// Amazon
|
|
2677
|
+
|
|
2678
|
+
public void setAmazonBannerResult(final Object result, final String adUnitId)
|
|
2679
|
+
{
|
|
2680
|
+
setAmazonResult( result, adUnitId, MaxAdFormat.BANNER );
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
public void setAmazonMRecResult(final Object result, final String adUnitId)
|
|
2684
|
+
{
|
|
2685
|
+
setAmazonResult( result, adUnitId, MaxAdFormat.MREC );
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
public void setAmazonInterstitialResult(final Object result, final String adUnitId)
|
|
2689
|
+
{
|
|
2690
|
+
setAmazonResult( result, adUnitId, MaxAdFormat.INTERSTITIAL );
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
private void setAmazonResult(final Object result, final String adUnitId, final MaxAdFormat adFormat)
|
|
2694
|
+
{
|
|
2695
|
+
if ( sdk == null )
|
|
2696
|
+
{
|
|
2697
|
+
logUninitializedAccessError( "Failed to set Amazon result - SDK not initialized: " + adUnitId );
|
|
2698
|
+
return;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
if ( result == null )
|
|
2702
|
+
{
|
|
2703
|
+
e( "Failed to set Amazon result - null value" );
|
|
2704
|
+
return;
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
String key = getLocalExtraParameterKeyForAmazonResult( result );
|
|
2708
|
+
|
|
2709
|
+
if ( adFormat == MaxAdFormat.INTERSTITIAL )
|
|
2710
|
+
{
|
|
2711
|
+
MaxInterstitialAd interstitial = retrieveInterstitial( adUnitId, "setAmazonResult" );
|
|
2712
|
+
if ( interstitial == null )
|
|
2713
|
+
{
|
|
2714
|
+
e( "Failed to set Amazon result - unable to retrieve interstitial" );
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
interstitial.setLocalExtraParameter( key, result );
|
|
2719
|
+
}
|
|
2720
|
+
else // MaxAdFormat.BANNER or MaxAdFormat.MREC
|
|
2721
|
+
{
|
|
2722
|
+
MaxAdView adView = AppLovinMAXAdView.getInstance( adUnitId );
|
|
2723
|
+
|
|
2724
|
+
if ( adView == null )
|
|
2725
|
+
{
|
|
2726
|
+
adView = retrieveAdView( adUnitId, adFormat );
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
if ( adView != null )
|
|
2730
|
+
{
|
|
2731
|
+
adView.setLocalExtraParameter( key, result );
|
|
2732
|
+
}
|
|
2733
|
+
else
|
|
2734
|
+
{
|
|
2735
|
+
e( "Failed to set Amazon result - unable to retrieve " + adFormat );
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
private String getLocalExtraParameterKeyForAmazonResult(final Object /* DTBAdResponse or AdError */ result)
|
|
2741
|
+
{
|
|
2742
|
+
String className = result.getClass().getSimpleName();
|
|
2743
|
+
return "DTBAdResponse".equalsIgnoreCase( className ) ? "amazon_ad_response" : "amazon_ad_error";
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2676
2746
|
// Lifecycle Events
|
|
2677
2747
|
|
|
2678
2748
|
@Override
|
package/ios/AppLovinMAX.m
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
#import "AppLovinMAX.h"
|
|
10
|
+
#import "AppLovinMAXAdView.h"
|
|
10
11
|
#import "AppLovinMAXNativeAdView.h"
|
|
11
12
|
|
|
12
13
|
#define ROOT_VIEW_CONTROLLER (UIApplication.sharedApplication.keyWindow.rootViewController)
|
|
@@ -226,65 +227,65 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
|
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
ALSdkSettings *settings = [[ALSdkSettings alloc] init];
|
|
229
|
-
|
|
230
|
+
|
|
230
231
|
// Selective init
|
|
231
232
|
if ( self.initializationAdUnitIdentifiersToSet )
|
|
232
233
|
{
|
|
233
234
|
settings.initializationAdUnitIdentifiers = self.initializationAdUnitIdentifiersToSet;
|
|
234
235
|
self.initializationAdUnitIdentifiersToSet = nil;
|
|
235
236
|
}
|
|
236
|
-
|
|
237
|
+
|
|
237
238
|
// Deprecated consent flow which automatically moves to the new flow
|
|
238
239
|
if ( self.consentFlowEnabledToSet )
|
|
239
240
|
{
|
|
240
241
|
settings.consentFlowSettings.enabled = self.consentFlowEnabledToSet.boolValue;
|
|
241
242
|
self.consentFlowEnabledToSet = nil;
|
|
242
|
-
|
|
243
|
+
|
|
243
244
|
if ( self.privacyPolicyURLToSet )
|
|
244
245
|
{
|
|
245
246
|
settings.consentFlowSettings.privacyPolicyURL = self.privacyPolicyURLToSet;
|
|
246
247
|
self.privacyPolicyURLToSet = nil;
|
|
247
248
|
}
|
|
248
|
-
|
|
249
|
+
|
|
249
250
|
if (self.termsOfServiceURLToSet )
|
|
250
251
|
{
|
|
251
252
|
settings.consentFlowSettings.termsOfServiceURL = self.termsOfServiceURLToSet;
|
|
252
253
|
self.termsOfServiceURLToSet = nil;
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
+
|
|
256
257
|
// New terms and privacy policy flow
|
|
257
258
|
if ( self.termsAndPrivacyPolicyFlowEnabledToSet )
|
|
258
259
|
{
|
|
259
260
|
settings.termsAndPrivacyPolicyFlowSettings.enabled = self.termsAndPrivacyPolicyFlowEnabledToSet.boolValue;
|
|
260
261
|
self.termsAndPrivacyPolicyFlowEnabledToSet = nil;
|
|
261
|
-
|
|
262
|
+
|
|
262
263
|
if ( self.privacyPolicyURLToSet )
|
|
263
264
|
{
|
|
264
265
|
settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = self.privacyPolicyURLToSet;
|
|
265
266
|
self.privacyPolicyURLToSet = nil;
|
|
266
267
|
}
|
|
267
|
-
|
|
268
|
+
|
|
268
269
|
if ( self.termsOfServiceURLToSet )
|
|
269
270
|
{
|
|
270
271
|
settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = self.termsOfServiceURLToSet;
|
|
271
272
|
self.termsOfServiceURLToSet = nil;
|
|
272
273
|
}
|
|
273
|
-
|
|
274
|
+
|
|
274
275
|
if ( self.debugUserGeographyToSet )
|
|
275
276
|
{
|
|
276
277
|
settings.termsAndPrivacyPolicyFlowSettings.debugUserGeography = [self toAppLovinConsentFlowUserGeography: self.debugUserGeographyToSet];
|
|
277
278
|
self.debugUserGeographyToSet = nil;
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
|
-
|
|
281
|
+
|
|
281
282
|
// Set muted if needed
|
|
282
283
|
if ( self.mutedToSet )
|
|
283
284
|
{
|
|
284
285
|
settings.muted = self.mutedToSet;
|
|
285
286
|
self.mutedToSet = nil;
|
|
286
287
|
}
|
|
287
|
-
|
|
288
|
+
|
|
288
289
|
// Set test device ids if needed
|
|
289
290
|
if ( self.testDeviceIdentifiersToSet )
|
|
290
291
|
{
|
|
@@ -314,7 +315,7 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
|
|
|
314
315
|
}
|
|
315
316
|
|
|
316
317
|
[self setPendingExtraParametersIfNeeded: settings];
|
|
317
|
-
|
|
318
|
+
|
|
318
319
|
// Initialize SDK
|
|
319
320
|
self.sdk = [ALSdk sharedWithKey: sdkKey settings: settings];
|
|
320
321
|
[self.sdk setPluginVersion: [@"React-Native-" stringByAppendingString: pluginVersion]];
|
|
@@ -848,10 +849,11 @@ RCT_EXPORT_METHOD(setBannerExtraParameter:(NSString *)adUnitIdentifier :(NSStrin
|
|
|
848
849
|
[self setAdViewExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: DEVICE_SPECIFIC_ADVIEW_AD_FORMAT key: key value: value];
|
|
849
850
|
}
|
|
850
851
|
|
|
852
|
+
// NOTE: Even though iOS is ok with `id` generic types, Android is not - so we wrap it via JSON/ReadableMap
|
|
851
853
|
RCT_EXPORT_METHOD(setBannerLocalExtraParameter:(NSString *)adUnitIdentifier :(NSDictionary<NSString *, id> *)parameterDict)
|
|
852
|
-
{
|
|
854
|
+
{
|
|
853
855
|
NSString *key = parameterDict.allKeys.firstObject;
|
|
854
|
-
id value = parameterDict.allValues.firstObject;
|
|
856
|
+
id value = parameterDict.allValues.firstObject != [NSNull null] ? parameterDict.allValues.firstObject : nil;
|
|
855
857
|
|
|
856
858
|
[self setAdViewLocalExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: DEVICE_SPECIFIC_ADVIEW_AD_FORMAT key: key value: value];
|
|
857
859
|
}
|
|
@@ -963,14 +965,15 @@ RCT_EXPORT_METHOD(updateMRecPosition:(NSString *)mrecPosition :(NSString *)adUni
|
|
|
963
965
|
}
|
|
964
966
|
|
|
965
967
|
RCT_EXPORT_METHOD(setMRecExtraParameter:(NSString *)adUnitIdentifier :(NSString *)key :(nullable NSString *)value)
|
|
966
|
-
{
|
|
968
|
+
{
|
|
967
969
|
[self setAdViewExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec key: key value: value];
|
|
968
970
|
}
|
|
969
971
|
|
|
972
|
+
// NOTE: Even though iOS is ok with `id` generic types, Android is not - so we wrap it via JSON/ReadableMap
|
|
970
973
|
RCT_EXPORT_METHOD(setMRecLocalExtraParameter:(NSString *)adUnitIdentifier :(NSDictionary<NSString *, id> *)parameterDict)
|
|
971
974
|
{
|
|
972
975
|
NSString *key = parameterDict.allKeys.firstObject;
|
|
973
|
-
id value = parameterDict.allValues.firstObject;
|
|
976
|
+
id value = parameterDict.allValues.firstObject != [NSNull null] ? parameterDict.allValues.firstObject : nil;
|
|
974
977
|
|
|
975
978
|
[self setAdViewLocalExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec key: key value: value];
|
|
976
979
|
}
|
|
@@ -1081,10 +1084,11 @@ RCT_EXPORT_METHOD(setInterstitialExtraParameter:(NSString *)adUnitIdentifier :(N
|
|
|
1081
1084
|
[interstitial setExtraParameterForKey: key value: value];
|
|
1082
1085
|
}
|
|
1083
1086
|
|
|
1087
|
+
// NOTE: Even though iOS is ok with `id` generic types, Android is not - so we wrap it via JSON/ReadableMap
|
|
1084
1088
|
RCT_EXPORT_METHOD(setInterstitialLocalExtraParameter:(NSString *)adUnitIdentifier :(NSDictionary<NSString *, id> *)parameterDict)
|
|
1085
1089
|
{
|
|
1086
1090
|
NSString *key = parameterDict.allKeys.firstObject;
|
|
1087
|
-
id value = parameterDict.allValues.firstObject;
|
|
1091
|
+
id value = parameterDict.allValues.firstObject != [NSNull null] ? parameterDict.allValues.firstObject : nil;
|
|
1088
1092
|
|
|
1089
1093
|
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
|
|
1090
1094
|
[interstitial setLocalExtraParameterForKey: key value: value];
|
|
@@ -1141,10 +1145,11 @@ RCT_EXPORT_METHOD(setRewardedAdExtraParameter:(NSString *)adUnitIdentifier :(NSS
|
|
|
1141
1145
|
[rewardedAd setExtraParameterForKey: key value: value];
|
|
1142
1146
|
}
|
|
1143
1147
|
|
|
1148
|
+
// NOTE: Even though iOS is ok with `id` generic types, Android is not - so we wrap it via JSON/ReadableMap
|
|
1144
1149
|
RCT_EXPORT_METHOD(setRewardedAdLocalExtraParameter:(NSString *)adUnitIdentifier :(NSDictionary<NSString *, id> *)parameterDict)
|
|
1145
1150
|
{
|
|
1146
1151
|
NSString *key = parameterDict.allKeys.firstObject;
|
|
1147
|
-
id value = parameterDict.allValues.firstObject;
|
|
1152
|
+
id value = parameterDict.allValues.firstObject != [NSNull null] ? parameterDict.allValues.firstObject : nil;
|
|
1148
1153
|
|
|
1149
1154
|
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
|
|
1150
1155
|
[rewardedAd setLocalExtraParameterForKey: key value: value];
|
|
@@ -1201,10 +1206,11 @@ RCT_EXPORT_METHOD(setAppOpenAdExtraParameter:(NSString *)adUnitIdentifier key:(N
|
|
|
1201
1206
|
[appOpenAd setExtraParameterForKey: key value: value];
|
|
1202
1207
|
}
|
|
1203
1208
|
|
|
1209
|
+
// NOTE: Even though iOS is ok with `id` generic types, Android is not - so we wrap it via JSON/ReadableMap
|
|
1204
1210
|
RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :(NSDictionary<NSString *, id> *)parameterDict)
|
|
1205
1211
|
{
|
|
1206
1212
|
NSString *key = parameterDict.allKeys.firstObject;
|
|
1207
|
-
id value = parameterDict.allValues.firstObject;
|
|
1213
|
+
id value = parameterDict.allValues.firstObject != [NSNull null] ? parameterDict.allValues.firstObject : nil;
|
|
1208
1214
|
|
|
1209
1215
|
MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier];
|
|
1210
1216
|
[appOpenAd setLocalExtraParameterForKey: key value: value];
|
|
@@ -2074,7 +2080,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
|
|
|
2074
2080
|
{
|
|
2075
2081
|
return ALConsentFlowUserGeographyOther;
|
|
2076
2082
|
}
|
|
2077
|
-
|
|
2083
|
+
|
|
2078
2084
|
return ALConsentFlowUserGeographyUnknown;
|
|
2079
2085
|
}
|
|
2080
2086
|
|
|
@@ -2088,7 +2094,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
|
|
|
2088
2094
|
{
|
|
2089
2095
|
return USER_GEOGRAPHY_OTHER;
|
|
2090
2096
|
}
|
|
2091
|
-
|
|
2097
|
+
|
|
2092
2098
|
return USER_GEOGRAPHY_UNKNOWN;
|
|
2093
2099
|
}
|
|
2094
2100
|
|
|
@@ -2110,7 +2116,7 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
|
|
|
2110
2116
|
{
|
|
2111
2117
|
return APP_TRACKING_STATUS_AUTHORIZED;
|
|
2112
2118
|
}
|
|
2113
|
-
|
|
2119
|
+
|
|
2114
2120
|
return APP_TRACKING_STATUS_UNAVAILABLE;
|
|
2115
2121
|
}
|
|
2116
2122
|
|
|
@@ -2223,6 +2229,78 @@ RCT_EXPORT_METHOD(setAppOpenAdLocalExtraParameter:(NSString *)adUnitIdentifier :
|
|
|
2223
2229
|
return networkResponseDict;
|
|
2224
2230
|
}
|
|
2225
2231
|
|
|
2232
|
+
#pragma mark - Amazon
|
|
2233
|
+
|
|
2234
|
+
- (void)setAmazonResult:(id)result forBannerAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
2235
|
+
{
|
|
2236
|
+
[self setAmazonResult: result forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.banner];
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
- (void)setAmazonResult:(id)result forMRecAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
2240
|
+
{
|
|
2241
|
+
[self setAmazonResult: result forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
- (void)setAmazonResult:(id)result forInterstitialAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
2245
|
+
{
|
|
2246
|
+
[self setAmazonResult: result forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.interstitial];
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
- (void)setAmazonResult:(id /* DTBAdResponse or DTBAdErrorInfo */)result forAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat
|
|
2250
|
+
{
|
|
2251
|
+
if ( !self.sdk )
|
|
2252
|
+
{
|
|
2253
|
+
NSString *errorMessage = [NSString stringWithFormat: @"Failed to set Amazon result - SDK not initialized: %@", adUnitIdentifier];
|
|
2254
|
+
[self logUninitializedAccessError: errorMessage];
|
|
2255
|
+
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
if ( !result )
|
|
2260
|
+
{
|
|
2261
|
+
[self log: @"Failed to set Amazon result - nil value"];
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
NSString *key = [self localExtraParameterKeyForAmazonResult: result];
|
|
2266
|
+
|
|
2267
|
+
if ( adFormat == MAAdFormat.interstitial )
|
|
2268
|
+
{
|
|
2269
|
+
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
|
|
2270
|
+
if ( !interstitial )
|
|
2271
|
+
{
|
|
2272
|
+
[self log: @"Failed to set Amazon result - unable to find interstitial"];
|
|
2273
|
+
return;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
[interstitial setLocalExtraParameterForKey: key value: result];
|
|
2277
|
+
}
|
|
2278
|
+
else // MAAdFormat.banner or MAAdFormat.mrec
|
|
2279
|
+
{
|
|
2280
|
+
MAAdView *adView = [AppLovinMAXAdView sharedWithAdUnitIdentifier: adUnitIdentifier];
|
|
2281
|
+
|
|
2282
|
+
if ( !adView )
|
|
2283
|
+
{
|
|
2284
|
+
adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
if ( adView )
|
|
2288
|
+
{
|
|
2289
|
+
[adView setLocalExtraParameterForKey: key value: result];
|
|
2290
|
+
}
|
|
2291
|
+
else
|
|
2292
|
+
{
|
|
2293
|
+
[self log: @"Failed to set Amazon result - unable to find %@", adFormat];
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
- (NSString *)localExtraParameterKeyForAmazonResult:(id /* DTBAdResponse or DTBAdErrorInfo */)result
|
|
2299
|
+
{
|
|
2300
|
+
NSString *className = NSStringFromClass([result class]);
|
|
2301
|
+
return [@"DTBAdResponse" isEqualToString: className] ? @"amazon_ad_response" : @"amazon_ad_error";
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2226
2304
|
#pragma mark - React Native Event Bridge
|
|
2227
2305
|
|
|
2228
2306
|
- (void)sendReactNativeEventWithName:(NSString *)name body:(NSDictionary<NSString *, id> *)body
|
package/ios/AppLovinMAXAdView.h
CHANGED
package/ios/AppLovinMAXAdView.m
CHANGED
|
@@ -35,6 +35,19 @@
|
|
|
35
35
|
|
|
36
36
|
@implementation AppLovinMAXAdView
|
|
37
37
|
|
|
38
|
+
static NSMutableDictionary<NSString *, MAAdView *> *adViewInstances;
|
|
39
|
+
|
|
40
|
+
+ (void)initialize
|
|
41
|
+
{
|
|
42
|
+
[super initialize];
|
|
43
|
+
adViewInstances = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
+ (MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier
|
|
47
|
+
{
|
|
48
|
+
return adViewInstances[adUnitIdentifier];
|
|
49
|
+
}
|
|
50
|
+
|
|
38
51
|
- (void)setAdUnitId:(NSString *)adUnitId
|
|
39
52
|
{
|
|
40
53
|
// Ad Unit ID must be set prior to creating MAAdView
|
|
@@ -176,7 +189,8 @@
|
|
|
176
189
|
|
|
177
190
|
for ( NSString *key in self.localExtraParameters )
|
|
178
191
|
{
|
|
179
|
-
|
|
192
|
+
id value = self.localExtraParameters[key];
|
|
193
|
+
[self.adView setLocalExtraParameterForKey: key value: (value != [NSNull null] ? value : nil)];
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
if ( [self isAutoRefresh] )
|
|
@@ -196,6 +210,8 @@
|
|
|
196
210
|
[self.adView.heightAnchor constraintEqualToAnchor: self.heightAnchor],
|
|
197
211
|
[self.adView.centerXAnchor constraintEqualToAnchor: self.centerXAnchor],
|
|
198
212
|
[self.adView.centerYAnchor constraintEqualToAnchor: self.centerYAnchor]]];
|
|
213
|
+
|
|
214
|
+
adViewInstances[adUnitId] = self.adView;
|
|
199
215
|
});
|
|
200
216
|
}
|
|
201
217
|
|
|
@@ -210,6 +226,8 @@
|
|
|
210
226
|
{
|
|
211
227
|
[[AppLovinMAX shared] log: @"Unmounting MAAdView: %@", self.adView];
|
|
212
228
|
|
|
229
|
+
[adViewInstances removeObjectForKey: self.adUnitId];
|
|
230
|
+
|
|
213
231
|
self.adView.delegate = nil;
|
|
214
232
|
self.adView.revenueDelegate = nil;
|
|
215
233
|
|
|
@@ -123,7 +123,8 @@
|
|
|
123
123
|
|
|
124
124
|
for ( NSString *key in self.localExtraParameters )
|
|
125
125
|
{
|
|
126
|
-
|
|
126
|
+
id value = self.localExtraParameters[key];
|
|
127
|
+
[self.adLoader setLocalExtraParameterForKey: key value: (value != [NSNull null] ? value : nil)];
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
[self.adLoader loadAd];
|
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.
|
|
4
|
+
"version": "6.2.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,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_6_2_1" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/AppLovinMAX*.{h,m}"
|
|
17
17
|
|
package/src/AppLovinMAX.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Configuration } from './types/Configuration';
|
|
|
4
4
|
|
|
5
5
|
const NativeAppLovinMAX = NativeModules.AppLovinMAX;
|
|
6
6
|
|
|
7
|
-
const VERSION = '6.
|
|
7
|
+
const VERSION = '6.2.1';
|
|
8
8
|
|
|
9
9
|
const initialize = async (sdkKey: string): Promise<Configuration> => {
|
|
10
10
|
return NativeAppLovinMAX.initialize(VERSION, sdkKey);
|