react-native-applovin-max 7.1.0 → 8.0.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.
Files changed (44) hide show
  1. package/android/build.gradle +3 -3
  2. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdEvents.java +67 -0
  3. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +10 -6
  4. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +7 -7
  5. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +9 -13
  6. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +103 -145
  7. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +6 -6
  8. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +4 -4
  9. package/ios/AppLovinMAX.m +46 -22
  10. package/ios/AppLovinMAXAdView.h +12 -3
  11. package/ios/AppLovinMAXAdView.m +17 -13
  12. package/ios/AppLovinMAXAdViewManager.m +1 -1
  13. package/ios/AppLovinMAXAdViewUIComponent.h +7 -6
  14. package/ios/AppLovinMAXAdViewUIComponent.m +10 -15
  15. package/ios/AppLovinMAXNativeAdView.m +2 -2
  16. package/lib/commonjs/AppLovinMAX.js +1 -1
  17. package/lib/commonjs/ErrorCode.js +49 -0
  18. package/lib/commonjs/ErrorCode.js.map +1 -0
  19. package/lib/commonjs/index.js +8 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/types/AdInfo.js.map +1 -1
  22. package/lib/module/AppLovinMAX.js +1 -1
  23. package/lib/module/ErrorCode.js +43 -0
  24. package/lib/module/ErrorCode.js.map +1 -0
  25. package/lib/module/index.js +1 -0
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/types/AdInfo.js.map +1 -1
  28. package/lib/typescript/src/ErrorCode.d.ts +83 -0
  29. package/lib/typescript/src/ErrorCode.d.ts.map +1 -0
  30. package/lib/typescript/src/index.d.ts +1 -0
  31. package/lib/typescript/src/index.d.ts.map +1 -1
  32. package/lib/typescript/src/types/AdInfo.d.ts +4 -3
  33. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  34. package/lib/typescript/src/types/AdProps.d.ts +6 -6
  35. package/lib/typescript/src/types/Privacy.d.ts +0 -10
  36. package/lib/typescript/src/types/Privacy.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/react-native-applovin-max.podspec +2 -2
  39. package/src/AppLovinMAX.ts +1 -1
  40. package/src/ErrorCode.ts +116 -0
  41. package/src/index.ts +1 -0
  42. package/src/types/AdInfo.ts +5 -3
  43. package/src/types/AdProps.ts +6 -6
  44. package/src/types/Privacy.ts +0 -12
@@ -53,8 +53,8 @@ android {
53
53
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
54
54
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
55
55
 
56
- buildConfigField("int", "VERSION_CODE", "7010000")
57
- buildConfigField("String", "VERSION_NAME", "\"7.1.0\"")
56
+ buildConfigField("int", "VERSION_CODE", "8000000")
57
+ buildConfigField("String", "VERSION_NAME", "\"8.0.0\"")
58
58
  }
59
59
 
60
60
  buildTypes {
@@ -85,6 +85,6 @@ dependencies {
85
85
  //noinspection GradleDynamicVersion
86
86
  implementation "com.facebook.react:react-native:0.73.6"
87
87
 
88
- implementation "com.applovin:applovin-sdk:12.6.0"
88
+ implementation "com.applovin:applovin-sdk:13.0.0"
89
89
  }
90
90
 
@@ -0,0 +1,67 @@
1
+ package com.applovin.reactnative;
2
+
3
+ public class AppLovinMAXAdEvents
4
+ {
5
+ // Banner Events
6
+ public static final String ON_BANNER_AD_LOADED_EVENT = "OnBannerAdLoadedEvent";
7
+ public static final String ON_BANNER_AD_LOAD_FAILED_EVENT = "OnBannerAdLoadFailedEvent";
8
+ public static final String ON_BANNER_AD_CLICKED_EVENT = "OnBannerAdClickedEvent";
9
+ public static final String ON_BANNER_AD_EXPANDED_EVENT = "OnBannerAdExpandedEvent";
10
+ public static final String ON_BANNER_AD_COLLAPSED_EVENT = "OnBannerAdCollapsedEvent";
11
+ public static final String ON_BANNER_AD_REVENUE_PAID = "OnBannerAdRevenuePaid";
12
+
13
+ // MREC Events
14
+ public static final String ON_MREC_AD_LOADED_EVENT = "OnMRecAdLoadedEvent";
15
+ public static final String ON_MREC_AD_LOAD_FAILED_EVENT = "OnMRecAdLoadFailedEvent";
16
+ public static final String ON_MREC_AD_CLICKED_EVENT = "OnMRecAdClickedEvent";
17
+ public static final String ON_MREC_AD_EXPANDED_EVENT = "OnMRecAdExpandedEvent";
18
+ public static final String ON_MREC_AD_COLLAPSED_EVENT = "OnMRecAdCollapsedEvent";
19
+ public static final String ON_MREC_AD_REVENUE_PAID = "OnMRecAdRevenuePaid";
20
+
21
+ // Interstitial Events
22
+ public static final String ON_INTERSTITIAL_LOADED_EVENT = "OnInterstitialLoadedEvent";
23
+ public static final String ON_INTERSTITIAL_LOAD_FAILED_EVENT = "OnInterstitialLoadFailedEvent";
24
+ public static final String ON_INTERSTITIAL_CLICKED_EVENT = "OnInterstitialClickedEvent";
25
+ public static final String ON_INTERSTITIAL_DISPLAYED_EVENT = "OnInterstitialDisplayedEvent";
26
+ public static final String ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT = "OnInterstitialAdFailedToDisplayEvent";
27
+ public static final String ON_INTERSTITIAL_HIDDEN_EVENT = "OnInterstitialHiddenEvent";
28
+ public static final String ON_INTERSTITIAL_AD_REVENUE_PAID = "OnInterstitialAdRevenuePaid";
29
+
30
+ // Rewarded Events
31
+ public static final String ON_REWARDED_AD_LOADED_EVENT = "OnRewardedAdLoadedEvent";
32
+ public static final String ON_REWARDED_AD_LOAD_FAILED_EVENT = "OnRewardedAdLoadFailedEvent";
33
+ public static final String ON_REWARDED_AD_CLICKED_EVENT = "OnRewardedAdClickedEvent";
34
+ public static final String ON_REWARDED_AD_DISPLAYED_EVENT = "OnRewardedAdDisplayedEvent";
35
+ public static final String ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT = "OnRewardedAdFailedToDisplayEvent";
36
+ public static final String ON_REWARDED_AD_HIDDEN_EVENT = "OnRewardedAdHiddenEvent";
37
+ public static final String ON_REWARDED_AD_RECEIVED_REWARD_EVENT = "OnRewardedAdReceivedRewardEvent";
38
+ public static final String ON_REWARDED_AD_REVENUE_PAID = "OnRewardedAdRevenuePaid";
39
+
40
+ // AppOpen Events
41
+ public static final String ON_APPOPEN_AD_LOADED_EVENT = "OnAppOpenAdLoadedEvent";
42
+ public static final String ON_APPOPEN_AD_LOAD_FAILED_EVENT = "OnAppOpenAdLoadFailedEvent";
43
+ public static final String ON_APPOPEN_AD_CLICKED_EVENT = "OnAppOpenAdClickedEvent";
44
+ public static final String ON_APPOPEN_AD_DISPLAYED_EVENT = "OnAppOpenAdDisplayedEvent";
45
+ public static final String ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT = "OnAppOpenAdFailedToDisplayEvent";
46
+ public static final String ON_APPOPEN_AD_HIDDEN_EVENT = "OnAppOpenAdHiddenEvent";
47
+ public static final String ON_APPOPEN_AD_REVENUE_PAID = "OnAppOpenAdRevenuePaid";
48
+
49
+ // Native UI Component Events
50
+ public static final String ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT = "OnNativeUIComponentAdViewAdLoadedEvent";
51
+ public static final String ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT = "OnNativeUIComponentAdViewAdLoadFailedEvent";
52
+
53
+ // MaxAdListener
54
+ public static final String ON_AD_LOADED_EVENT = "onAdLoadedEvent";
55
+ public static final String ON_AD_DISPLAYED_EVENT = "onAdDisplayedEvent";
56
+ public static final String ON_AD_HIDDEN_EVENT = "onAdHiddenEvent";
57
+ public static final String ON_AD_CLICKED_EVENT = "onAdClickedEvent";
58
+ public static final String ON_AD_LOAD_FAILED_EVENT = "onAdLoadFailedEvent";
59
+ public static final String ON_AD_DISPLAY_FAILED_EVENT = "onAdDisplayFailedEvent";
60
+
61
+ // MaxAdViewAdListener
62
+ public static final String ON_AD_EXPANDED_EVENT = "onAdExpandedEvent";
63
+ public static final String ON_AD_COLLAPSED_EVENT = "onAdCollapsedEvent";
64
+
65
+ // MaxAdRevenueListener
66
+ public static final String ON_AD_REVENUE_PAID_EVENT = "onAdRevenuePaidEvent";
67
+ }
@@ -50,7 +50,14 @@ class AppLovinMAXAdView
50
50
  return ( uiComponent != null ) ? uiComponent.getAdView() : null;
51
51
  }
52
52
 
53
- public static void preloadNativeUIComponentAdView(final String adUnitId, final MaxAdFormat adFormat, final String placement, final String customData, final Map<String, Object> extraParameters, final Map<String, Object> localExtraParameters, final Promise promise, final ReactContext context)
53
+ public static void preloadNativeUIComponentAdView(final String adUnitId,
54
+ final MaxAdFormat adFormat,
55
+ @Nullable final String placement,
56
+ @Nullable final String customData,
57
+ @Nullable final Map<String, Object> extraParameters,
58
+ @Nullable final Map<String, Object> localExtraParameters,
59
+ final Promise promise,
60
+ final ReactContext context)
54
61
  {
55
62
  AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adUnitId );
56
63
  if ( preloadedUiComponent != null )
@@ -278,6 +285,7 @@ class AppLovinMAXAdView
278
285
  // same adUnitId
279
286
  if ( !uiComponent.hasContainerView() )
280
287
  {
288
+ uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
281
289
  uiComponent.setAutoRefresh( autoRefresh );
282
290
  uiComponent.attachAdView( AppLovinMAXAdView.this );
283
291
  return;
@@ -324,11 +332,7 @@ class AppLovinMAXAdView
324
332
 
325
333
  AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adUnitId );
326
334
 
327
- if ( uiComponent == preloadedUiComponent )
328
- {
329
- uiComponent.setAutoRefresh( false );
330
- }
331
- else
335
+ if ( uiComponent != preloadedUiComponent )
332
336
  {
333
337
  uiComponentInstances.remove( adUnitId );
334
338
  uiComponent.destroy();
@@ -35,13 +35,13 @@ class AppLovinMAXAdViewManager
35
35
  {
36
36
  // mapping Android events to JavaScript events
37
37
  return MapBuilder.<String, Object>builder()
38
- .put( "onAdLoadedEvent", MapBuilder.of( "registrationName", "onAdLoadedEvent" ) )
39
- .put( "onAdLoadFailedEvent", MapBuilder.of( "registrationName", "onAdLoadFailedEvent" ) )
40
- .put( "onAdDisplayFailedEvent", MapBuilder.of( "registrationName", "onAdDisplayFailedEvent" ) )
41
- .put( "onAdClickedEvent", MapBuilder.of( "registrationName", "onAdClickedEvent" ) )
42
- .put( "onAdExpandedEvent", MapBuilder.of( "registrationName", "onAdExpandedEvent" ) )
43
- .put( "onAdCollapsedEvent", MapBuilder.of( "registrationName", "onAdCollapsedEvent" ) )
44
- .put( "onAdRevenuePaidEvent", MapBuilder.of( "registrationName", "onAdRevenuePaidEvent" ) )
38
+ .put( AppLovinMAXAdEvents.ON_AD_LOADED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOADED_EVENT ) )
39
+ .put( AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT ) )
40
+ .put( AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT ) )
41
+ .put( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT ) )
42
+ .put( AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT ) )
43
+ .put( AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT ) )
44
+ .put( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT ) )
45
45
  .build();
46
46
  }
47
47
 
@@ -146,15 +146,11 @@ class AppLovinMAXAdViewUiComponent
146
146
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
147
147
 
148
148
  // Copy the `adInfo` since sending the same map through the RN bridge more than once will result in `com.facebook.react.bridge.ObjectAlreadyConsumedException: Map already consumed`
149
- AppLovinMAXModule.getInstance().sendReactNativeEvent( "OnNativeUIComponentAdViewAdLoadedEvent", adInfo.copy() );
149
+ AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT, adInfo.copy() );
150
150
 
151
151
  if ( containerView != null )
152
152
  {
153
- sendReactNativeCallbackEvent( "onAdLoadedEvent", adInfo );
154
- }
155
- else
156
- {
157
- setAutoRefresh( false );
153
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_LOADED_EVENT, adInfo );
158
154
  }
159
155
  }
160
156
 
@@ -164,11 +160,11 @@ class AppLovinMAXAdViewUiComponent
164
160
  WritableMap adLoadFailedInfo = AppLovinMAXModule.getInstance().getAdLoadFailedInfo( adUnitId, error );
165
161
 
166
162
  // Copy the `adLoadFailedInfo` since sending the same map through the RN bridge more than once will result in `com.facebook.react.bridge.ObjectAlreadyConsumedException: Map already consumed`
167
- AppLovinMAXModule.getInstance().sendReactNativeEvent( "OnNativeUIComponentAdViewAdLoadFailedEvent", adLoadFailedInfo.copy() );
163
+ AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT, adLoadFailedInfo.copy() );
168
164
 
169
165
  if ( containerView != null )
170
166
  {
171
- sendReactNativeCallbackEvent( "onAdLoadFailedEvent", adLoadFailedInfo );
167
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT, adLoadFailedInfo );
172
168
  }
173
169
  }
174
170
 
@@ -178,7 +174,7 @@ class AppLovinMAXAdViewUiComponent
178
174
  if ( containerView != null )
179
175
  {
180
176
  WritableMap adDisplayFailedInfo = AppLovinMAXModule.getInstance().getAdDisplayFailedInfo( ad, error );
181
- sendReactNativeCallbackEvent( "onAdDisplayFailedEvent", adDisplayFailedInfo );
177
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT, adDisplayFailedInfo );
182
178
  }
183
179
  }
184
180
 
@@ -188,7 +184,7 @@ class AppLovinMAXAdViewUiComponent
188
184
  if ( containerView != null )
189
185
  {
190
186
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
191
- sendReactNativeCallbackEvent( "onAdClickedEvent", adInfo );
187
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, adInfo );
192
188
  }
193
189
  }
194
190
 
@@ -198,7 +194,7 @@ class AppLovinMAXAdViewUiComponent
198
194
  if ( containerView != null )
199
195
  {
200
196
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
201
- sendReactNativeCallbackEvent( "onAdExpandedEvent", adInfo );
197
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT, adInfo );
202
198
  }
203
199
  }
204
200
 
@@ -208,7 +204,7 @@ class AppLovinMAXAdViewUiComponent
208
204
  if ( containerView != null )
209
205
  {
210
206
  WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
211
- sendReactNativeCallbackEvent( "onAdCollapsedEvent", adInfo );
207
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT, adInfo );
212
208
  }
213
209
  }
214
210
 
@@ -218,7 +214,7 @@ class AppLovinMAXAdViewUiComponent
218
214
  if ( containerView != null )
219
215
  {
220
216
  WritableMap adRevenueInfo = AppLovinMAXModule.getInstance().getAdRevenueInfo( ad );
221
- sendReactNativeCallbackEvent( "onAdRevenuePaidEvent", adRevenueInfo );
217
+ sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, adRevenueInfo );
222
218
  }
223
219
  }
224
220