react-native-applovin-max 8.0.5 → 8.1.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/build.gradle +3 -3
- package/android/gradle.properties +1 -3
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +66 -42
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +7 -1
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +28 -5
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +5 -5
- package/ios/AppLovinMAX.h +3 -0
- package/ios/AppLovinMAX.m +8 -8
- package/ios/AppLovinMAXAdView.h +4 -2
- package/ios/AppLovinMAXAdView.m +67 -37
- package/ios/AppLovinMAXAdViewManager.m +1 -0
- package/ios/AppLovinMAXAdViewUIComponent.h +2 -1
- package/ios/AppLovinMAXAdViewUIComponent.m +42 -14
- package/lib/commonjs/AdView.js +29 -27
- package/lib/commonjs/AdView.js.map +1 -1
- package/lib/commonjs/AppLovinMAX.js +11 -6
- package/lib/commonjs/AppLovinMAX.js.map +1 -1
- package/lib/commonjs/ErrorCode.js +0 -4
- package/lib/commonjs/ErrorCode.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdView.js +6 -4
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/types/AdInfo.js.map +1 -1
- package/lib/module/AdView.js +29 -27
- package/lib/module/AdView.js.map +1 -1
- package/lib/module/AppLovinMAX.js +11 -6
- package/lib/module/AppLovinMAX.js.map +1 -1
- package/lib/module/ErrorCode.js +0 -4
- package/lib/module/ErrorCode.js.map +1 -1
- package/lib/module/nativeAd/NativeAdView.js +6 -4
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/types/AdInfo.js.map +1 -1
- package/lib/typescript/src/AdView.d.ts +29 -28
- package/lib/typescript/src/AdView.d.ts.map +1 -1
- package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
- package/lib/typescript/src/ErrorCode.d.ts +0 -10
- package/lib/typescript/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/src/types/AdInfo.d.ts +9 -0
- package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/src/types/AdViewProps.d.ts +24 -8
- package/lib/typescript/src/types/AdViewProps.d.ts.map +1 -1
- package/package.json +5 -4
- package/react-native-applovin-max.podspec +4 -3
- package/src/AdView.tsx +31 -29
- package/src/AppLovinMAX.ts +11 -6
- package/src/ErrorCode.ts +0 -14
- package/src/nativeAd/NativeAdView.tsx +6 -7
- package/src/types/AdInfo.ts +11 -0
- package/src/types/AdViewProps.ts +26 -8
package/android/build.gradle
CHANGED
|
@@ -53,8 +53,8 @@ android {
|
|
|
53
53
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
54
54
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
55
55
|
|
|
56
|
-
buildConfigField("int", "VERSION_CODE", "
|
|
57
|
-
buildConfigField("String", "VERSION_NAME", "\"8.
|
|
56
|
+
buildConfigField("int", "VERSION_CODE", "8010100")
|
|
57
|
+
buildConfigField("String", "VERSION_NAME", "\"8.1.1\"")
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
buildTypes {
|
|
@@ -83,7 +83,7 @@ dependencies {
|
|
|
83
83
|
// For < 0.71, this will be from the local maven repo
|
|
84
84
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
85
85
|
//noinspection GradleDynamicVersion
|
|
86
|
-
implementation "com.facebook.react:react-native:0.
|
|
86
|
+
implementation "com.facebook.react:react-native:0.75.4"
|
|
87
87
|
|
|
88
88
|
implementation "com.applovin:applovin-sdk:13.0.1"
|
|
89
89
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
ApplovinMax_minSdkVersion=
|
|
1
|
+
ApplovinMax_minSdkVersion=23
|
|
2
2
|
ApplovinMax_targetSdkVersion=34
|
|
3
3
|
ApplovinMax_compileSdkVersion=34
|
|
4
4
|
|
|
5
|
-
# To bypass an error from the `io.codearte.nexus-staging` plugin requiring it to be applied to base build.gradle
|
|
6
|
-
gnsp.disableApplyOnlyOnRootProjectEnforcement=true
|
|
@@ -18,11 +18,11 @@ import androidx.annotation.Nullable;
|
|
|
18
18
|
/**
|
|
19
19
|
* Created by Thomas So on September 27 2020
|
|
20
20
|
*/
|
|
21
|
-
class AppLovinMAXAdView
|
|
21
|
+
public class AppLovinMAXAdView
|
|
22
22
|
extends ReactViewGroup
|
|
23
23
|
{
|
|
24
|
-
private static final Map<
|
|
25
|
-
private static final Map<
|
|
24
|
+
private static final Map<Integer, AppLovinMAXAdViewUiComponent> uiComponentInstances = new HashMap<>( 2 );
|
|
25
|
+
private static final Map<Integer, AppLovinMAXAdViewUiComponent> preloadedUiComponentInstances = new HashMap<>( 2 );
|
|
26
26
|
|
|
27
27
|
private final ReactContext reactContext;
|
|
28
28
|
|
|
@@ -31,23 +31,47 @@ class AppLovinMAXAdView
|
|
|
31
31
|
|
|
32
32
|
private String adUnitId;
|
|
33
33
|
private MaxAdFormat adFormat;
|
|
34
|
+
private int adViewId;
|
|
34
35
|
@Nullable
|
|
35
36
|
private String placement;
|
|
36
37
|
@Nullable
|
|
37
38
|
private String customData;
|
|
38
39
|
private boolean adaptiveBannerEnabled;
|
|
39
|
-
private boolean
|
|
40
|
+
private boolean autoRefreshEnabled;
|
|
40
41
|
private boolean loadOnMount;
|
|
41
42
|
@Nullable
|
|
42
43
|
private Map<String, Object> extraParameters;
|
|
43
44
|
@Nullable
|
|
44
45
|
private Map<String, Object> localExtraParameters;
|
|
45
46
|
|
|
47
|
+
// Returns an MaxAdView to support Amazon integrations. This method returns the first instance
|
|
48
|
+
// that matches the Ad Unit ID, consistent with the behavior introduced when this feature was
|
|
49
|
+
// first implemented.
|
|
50
|
+
@Nullable
|
|
46
51
|
public static MaxAdView getInstance(final String adUnitId)
|
|
47
52
|
{
|
|
48
|
-
AppLovinMAXAdViewUiComponent
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
for ( Map.Entry<Integer, AppLovinMAXAdViewUiComponent> entry : preloadedUiComponentInstances.entrySet() )
|
|
54
|
+
{
|
|
55
|
+
if ( entry.getValue().getAdUnitId().equals ( adUnitId ) )
|
|
56
|
+
{
|
|
57
|
+
return entry.getValue().getAdView();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
for ( Map.Entry<Integer, AppLovinMAXAdViewUiComponent> entry : uiComponentInstances.entrySet() )
|
|
62
|
+
{
|
|
63
|
+
if ( entry.getValue().getAdUnitId().equals( adUnitId ) )
|
|
64
|
+
{
|
|
65
|
+
return entry.getValue().getAdView();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public static boolean hasPreloadedAdView(final int adViewId)
|
|
73
|
+
{
|
|
74
|
+
return preloadedUiComponentInstances.get( adViewId ) != null;
|
|
51
75
|
}
|
|
52
76
|
|
|
53
77
|
public static void preloadNativeUIComponentAdView(final String adUnitId,
|
|
@@ -59,15 +83,8 @@ class AppLovinMAXAdView
|
|
|
59
83
|
final Promise promise,
|
|
60
84
|
final ReactContext context)
|
|
61
85
|
{
|
|
62
|
-
AppLovinMAXAdViewUiComponent preloadedUiComponent =
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
promise.reject( new IllegalStateException( "Cannot preload more than one for a single Ad Unit ID" ) );
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
preloadedUiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, context );
|
|
70
|
-
preloadedUiComponentInstances.put( adUnitId, preloadedUiComponent );
|
|
86
|
+
AppLovinMAXAdViewUiComponent preloadedUiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, context );
|
|
87
|
+
preloadedUiComponentInstances.put( preloadedUiComponent.hashCode(), preloadedUiComponent );
|
|
71
88
|
|
|
72
89
|
preloadedUiComponent.setPlacement( placement );
|
|
73
90
|
preloadedUiComponent.setCustomData( customData );
|
|
@@ -76,25 +93,26 @@ class AppLovinMAXAdView
|
|
|
76
93
|
|
|
77
94
|
preloadedUiComponent.loadAd();
|
|
78
95
|
|
|
79
|
-
promise.resolve(
|
|
96
|
+
promise.resolve( preloadedUiComponent.hashCode() );
|
|
80
97
|
}
|
|
81
98
|
|
|
82
|
-
public static void destroyNativeUIComponentAdView(final
|
|
99
|
+
public static void destroyNativeUIComponentAdView(final int adViewId, final Promise promise)
|
|
83
100
|
{
|
|
84
|
-
AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get(
|
|
101
|
+
AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adViewId );
|
|
102
|
+
|
|
85
103
|
if ( preloadedUiComponent == null )
|
|
86
104
|
{
|
|
87
|
-
promise.reject( new IllegalStateException( "No
|
|
105
|
+
promise.reject( new IllegalStateException( "No preloaded AdView found to destroy" ) );
|
|
88
106
|
return;
|
|
89
107
|
}
|
|
90
108
|
|
|
91
109
|
if ( preloadedUiComponent.hasContainerView() )
|
|
92
110
|
{
|
|
93
|
-
promise.reject( new IllegalStateException( "Cannot destroy - currently in use" ) );
|
|
111
|
+
promise.reject( new IllegalStateException( "Cannot destroy - the preloaded AdView is currently in use" ) );
|
|
94
112
|
return;
|
|
95
113
|
}
|
|
96
114
|
|
|
97
|
-
preloadedUiComponentInstances.remove(
|
|
115
|
+
preloadedUiComponentInstances.remove( adViewId );
|
|
98
116
|
|
|
99
117
|
preloadedUiComponent.detachAdView();
|
|
100
118
|
preloadedUiComponent.destroy();
|
|
@@ -143,6 +161,11 @@ class AppLovinMAXAdView
|
|
|
143
161
|
}
|
|
144
162
|
}
|
|
145
163
|
|
|
164
|
+
public void setAdViewId(final int value)
|
|
165
|
+
{
|
|
166
|
+
adViewId = value;
|
|
167
|
+
}
|
|
168
|
+
|
|
146
169
|
public void setPlacement(@Nullable final String value)
|
|
147
170
|
{
|
|
148
171
|
placement = value;
|
|
@@ -173,13 +196,13 @@ class AppLovinMAXAdView
|
|
|
173
196
|
}
|
|
174
197
|
}
|
|
175
198
|
|
|
176
|
-
public void
|
|
199
|
+
public void setAutoRefreshEnabled(final boolean enabled)
|
|
177
200
|
{
|
|
178
|
-
|
|
201
|
+
autoRefreshEnabled = enabled;
|
|
179
202
|
|
|
180
203
|
if ( uiComponent != null )
|
|
181
204
|
{
|
|
182
|
-
uiComponent.
|
|
205
|
+
uiComponent.setAutoRefreshEnabled( enabled );
|
|
183
206
|
}
|
|
184
207
|
}
|
|
185
208
|
|
|
@@ -222,7 +245,7 @@ class AppLovinMAXAdView
|
|
|
222
245
|
|
|
223
246
|
if ( uiComponent != null )
|
|
224
247
|
{
|
|
225
|
-
uiComponent.
|
|
248
|
+
uiComponent.setAutoRefreshEnabled( false );
|
|
226
249
|
}
|
|
227
250
|
}
|
|
228
251
|
|
|
@@ -233,7 +256,7 @@ class AppLovinMAXAdView
|
|
|
233
256
|
|
|
234
257
|
if ( uiComponent != null )
|
|
235
258
|
{
|
|
236
|
-
uiComponent.
|
|
259
|
+
uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
|
|
237
260
|
}
|
|
238
261
|
}
|
|
239
262
|
|
|
@@ -272,36 +295,37 @@ class AppLovinMAXAdView
|
|
|
272
295
|
|
|
273
296
|
if ( uiComponent != null )
|
|
274
297
|
{
|
|
275
|
-
AppLovinMAXModule.e( "Attempting to re-attach with existing
|
|
298
|
+
AppLovinMAXModule.e( "Attempting to re-attach with existing AdView (" + uiComponent.hashCode() + ") for Ad Unit ID " + adUnitId );
|
|
276
299
|
return;
|
|
277
300
|
}
|
|
278
301
|
|
|
279
|
-
uiComponent = preloadedUiComponentInstances.get(
|
|
302
|
+
uiComponent = preloadedUiComponentInstances.get( adViewId );
|
|
280
303
|
if ( uiComponent != null )
|
|
281
304
|
{
|
|
282
|
-
// Attach the preloaded uiComponent if possible, otherwise create a new one for the
|
|
283
|
-
// same adUnitId
|
|
305
|
+
// Attach the preloaded uiComponent if possible, otherwise create a new one for the same adUnitId
|
|
284
306
|
if ( !( uiComponent.hasContainerView() || uiComponent.isAdViewAttached() ) )
|
|
285
307
|
{
|
|
286
|
-
AppLovinMAXModule.d( "Mounting the preloaded
|
|
308
|
+
AppLovinMAXModule.d( "Mounting the preloaded AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
|
|
287
309
|
|
|
288
|
-
uiComponent.
|
|
310
|
+
uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
|
|
311
|
+
uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
|
|
289
312
|
uiComponent.attachAdView( AppLovinMAXAdView.this );
|
|
290
313
|
return;
|
|
291
314
|
}
|
|
292
315
|
}
|
|
293
316
|
|
|
294
|
-
AppLovinMAXModule.d( "Mounting a new native UI component for " + adUnitId );
|
|
295
|
-
|
|
296
317
|
uiComponent = new AppLovinMAXAdViewUiComponent( adUnitId, adFormat, reactContext );
|
|
297
|
-
|
|
318
|
+
adViewId = uiComponent.hashCode();
|
|
319
|
+
uiComponentInstances.put( adViewId, uiComponent );
|
|
320
|
+
|
|
321
|
+
AppLovinMAXModule.d( "Mounting a new AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
|
|
298
322
|
|
|
299
323
|
uiComponent.setPlacement( placement );
|
|
300
324
|
uiComponent.setCustomData( customData );
|
|
301
325
|
uiComponent.setExtraParameters( extraParameters );
|
|
302
326
|
uiComponent.setLocalExtraParameters( localExtraParameters );
|
|
303
327
|
uiComponent.setAdaptiveBannerEnabled( adaptiveBannerEnabled );
|
|
304
|
-
uiComponent.
|
|
328
|
+
uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
|
|
305
329
|
|
|
306
330
|
uiComponent.attachAdView( AppLovinMAXAdView.this );
|
|
307
331
|
|
|
@@ -329,19 +353,19 @@ class AppLovinMAXAdView
|
|
|
329
353
|
{
|
|
330
354
|
uiComponent.detachAdView();
|
|
331
355
|
|
|
332
|
-
AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get(
|
|
356
|
+
AppLovinMAXAdViewUiComponent preloadedUiComponent = preloadedUiComponentInstances.get( adViewId );
|
|
333
357
|
|
|
334
358
|
if ( uiComponent == preloadedUiComponent )
|
|
335
359
|
{
|
|
336
|
-
AppLovinMAXModule.d( "Unmounting the preloaded
|
|
360
|
+
AppLovinMAXModule.d( "Unmounting the preloaded AdView (" + adViewId + ") for Ad Unit ID " + adUnitId );
|
|
337
361
|
|
|
338
|
-
uiComponent.
|
|
362
|
+
uiComponent.setAutoRefreshEnabled( false );
|
|
339
363
|
}
|
|
340
364
|
else
|
|
341
365
|
{
|
|
342
|
-
AppLovinMAXModule.d( "Unmounting the
|
|
366
|
+
AppLovinMAXModule.d( "Unmounting the AdView (" + adViewId + ") to destroy for Ad Unit ID " + adUnitId );
|
|
343
367
|
|
|
344
|
-
uiComponentInstances.remove(
|
|
368
|
+
uiComponentInstances.remove( adViewId );
|
|
345
369
|
uiComponent.destroy();
|
|
346
370
|
}
|
|
347
371
|
}
|
|
@@ -83,6 +83,12 @@ class AppLovinMAXAdViewManager
|
|
|
83
83
|
view.setAdFormat( adFormatStr );
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
@ReactProp(name = "adViewId")
|
|
87
|
+
public void setAdFormat(final AppLovinMAXAdView view, final int adViewId)
|
|
88
|
+
{
|
|
89
|
+
view.setAdViewId( adViewId );
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
@ReactProp(name = "placement")
|
|
87
93
|
public void setPlacement(final AppLovinMAXAdView view, @Nullable final String placement)
|
|
88
94
|
{
|
|
@@ -104,7 +110,7 @@ class AppLovinMAXAdViewManager
|
|
|
104
110
|
@ReactProp(name = "autoRefresh")
|
|
105
111
|
public void setAutoRefresh(final AppLovinMAXAdView view, final boolean enabled)
|
|
106
112
|
{
|
|
107
|
-
view.
|
|
113
|
+
view.setAutoRefreshEnabled( enabled );
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
@ReactProp(name = "loadOnMount")
|
|
@@ -47,6 +47,11 @@ class AppLovinMAXAdViewUiComponent
|
|
|
47
47
|
return adView;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
public String getAdUnitId()
|
|
51
|
+
{
|
|
52
|
+
return adView.getAdUnitId();
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
public void setPlacement(@Nullable final String value)
|
|
51
56
|
{
|
|
52
57
|
adView.setPlacement( value );
|
|
@@ -62,7 +67,7 @@ class AppLovinMAXAdViewUiComponent
|
|
|
62
67
|
adView.setExtraParameter( "adaptive_banner", Boolean.toString( enabled ) );
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
public void
|
|
70
|
+
public void setAutoRefreshEnabled(final boolean enabled)
|
|
66
71
|
{
|
|
67
72
|
if ( enabled )
|
|
68
73
|
{
|
|
@@ -160,9 +165,13 @@ class AppLovinMAXAdViewUiComponent
|
|
|
160
165
|
public void onAdLoaded(@NonNull final MaxAd ad)
|
|
161
166
|
{
|
|
162
167
|
WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
|
|
168
|
+
adInfo.putInt( "adViewId", hashCode() );
|
|
163
169
|
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
if ( AppLovinMAXAdView.hasPreloadedAdView( hashCode() ) )
|
|
171
|
+
{
|
|
172
|
+
// 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`
|
|
173
|
+
AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT, adInfo.copy() );
|
|
174
|
+
}
|
|
166
175
|
|
|
167
176
|
if ( containerView != null )
|
|
168
177
|
{
|
|
@@ -174,9 +183,13 @@ class AppLovinMAXAdViewUiComponent
|
|
|
174
183
|
public void onAdLoadFailed(@NonNull final String adUnitId, @NonNull final MaxError error)
|
|
175
184
|
{
|
|
176
185
|
WritableMap adLoadFailedInfo = AppLovinMAXModule.getInstance().getAdLoadFailedInfo( adUnitId, error );
|
|
186
|
+
adLoadFailedInfo.putInt( "adViewId", hashCode() );
|
|
177
187
|
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
if ( AppLovinMAXAdView.hasPreloadedAdView( hashCode() ) )
|
|
189
|
+
{
|
|
190
|
+
// 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`
|
|
191
|
+
AppLovinMAXModule.getInstance().sendReactNativeEvent( AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT, adLoadFailedInfo.copy() );
|
|
192
|
+
}
|
|
180
193
|
|
|
181
194
|
if ( containerView != null )
|
|
182
195
|
{
|
|
@@ -190,6 +203,8 @@ class AppLovinMAXAdViewUiComponent
|
|
|
190
203
|
if ( containerView != null )
|
|
191
204
|
{
|
|
192
205
|
WritableMap adDisplayFailedInfo = AppLovinMAXModule.getInstance().getAdDisplayFailedInfo( ad, error );
|
|
206
|
+
adDisplayFailedInfo.putInt( "adViewId", hashCode() );
|
|
207
|
+
|
|
193
208
|
sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT, adDisplayFailedInfo );
|
|
194
209
|
}
|
|
195
210
|
}
|
|
@@ -200,6 +215,8 @@ class AppLovinMAXAdViewUiComponent
|
|
|
200
215
|
if ( containerView != null )
|
|
201
216
|
{
|
|
202
217
|
WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
|
|
218
|
+
adInfo.putInt( "adViewId", hashCode() );
|
|
219
|
+
|
|
203
220
|
sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, adInfo );
|
|
204
221
|
}
|
|
205
222
|
}
|
|
@@ -210,6 +227,8 @@ class AppLovinMAXAdViewUiComponent
|
|
|
210
227
|
if ( containerView != null )
|
|
211
228
|
{
|
|
212
229
|
WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
|
|
230
|
+
adInfo.putInt( "adViewId", hashCode() );
|
|
231
|
+
|
|
213
232
|
sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT, adInfo );
|
|
214
233
|
}
|
|
215
234
|
}
|
|
@@ -220,6 +239,8 @@ class AppLovinMAXAdViewUiComponent
|
|
|
220
239
|
if ( containerView != null )
|
|
221
240
|
{
|
|
222
241
|
WritableMap adInfo = AppLovinMAXModule.getInstance().getAdInfo( ad );
|
|
242
|
+
adInfo.putInt( "adViewId", hashCode() );
|
|
243
|
+
|
|
223
244
|
sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT, adInfo );
|
|
224
245
|
}
|
|
225
246
|
}
|
|
@@ -230,6 +251,8 @@ class AppLovinMAXAdViewUiComponent
|
|
|
230
251
|
if ( containerView != null )
|
|
231
252
|
{
|
|
232
253
|
WritableMap adRevenueInfo = AppLovinMAXModule.getInstance().getAdRevenueInfo( ad );
|
|
254
|
+
adRevenueInfo.putInt( "adViewId", hashCode() );
|
|
255
|
+
|
|
233
256
|
sendReactNativeCallbackEvent( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, adRevenueInfo );
|
|
234
257
|
}
|
|
235
258
|
}
|
|
@@ -78,7 +78,7 @@ public class AppLovinMAXModule
|
|
|
78
78
|
{
|
|
79
79
|
private static final String SDK_TAG = "AppLovinSdk";
|
|
80
80
|
private static final String TAG = "AppLovinMAXModule";
|
|
81
|
-
private static final String PLUGIN_VERSION = "8.
|
|
81
|
+
private static final String PLUGIN_VERSION = "8.1.1";
|
|
82
82
|
|
|
83
83
|
private static final String USER_GEOGRAPHY_GDPR = "G";
|
|
84
84
|
private static final String USER_GEOGRAPHY_OTHER = "O";
|
|
@@ -100,6 +100,8 @@ public class AppLovinMAXModule
|
|
|
100
100
|
|
|
101
101
|
static
|
|
102
102
|
{
|
|
103
|
+
ALCompatibleNativeSdkVersions.put( "8.1.1", "13.0.1" );
|
|
104
|
+
ALCompatibleNativeSdkVersions.put( "8.1.0", "13.0.1" );
|
|
103
105
|
ALCompatibleNativeSdkVersions.put( "8.0.5", "13.0.1" );
|
|
104
106
|
ALCompatibleNativeSdkVersions.put( "8.0.4", "13.0.0" );
|
|
105
107
|
ALCompatibleNativeSdkVersions.put( "8.0.3", "13.0.0" );
|
|
@@ -1134,9 +1136,9 @@ public class AppLovinMAXModule
|
|
|
1134
1136
|
}
|
|
1135
1137
|
|
|
1136
1138
|
@ReactMethod
|
|
1137
|
-
public void destroyNativeUIComponentAdView(final
|
|
1139
|
+
public void destroyNativeUIComponentAdView(final int adViewId, final Promise promise)
|
|
1138
1140
|
{
|
|
1139
|
-
getReactApplicationContext().runOnUiQueueThread( () -> AppLovinMAXAdView.destroyNativeUIComponentAdView(
|
|
1141
|
+
getReactApplicationContext().runOnUiQueueThread( () -> AppLovinMAXAdView.destroyNativeUIComponentAdView( adViewId, promise ) );
|
|
1140
1142
|
}
|
|
1141
1143
|
|
|
1142
1144
|
// AD CALLBACKS
|
|
@@ -2393,8 +2395,6 @@ public class AppLovinMAXModule
|
|
|
2393
2395
|
constants.put( "MAX_ERROR_CODE_NO_NETWORK", MaxErrorCode.NO_NETWORK );
|
|
2394
2396
|
constants.put( "MAX_ERROR_CODE_FULLSCREEN_AD_ALREADY_SHOWING", MaxErrorCode.FULLSCREEN_AD_ALREADY_SHOWING );
|
|
2395
2397
|
constants.put( "MAX_ERROR_CODE_FULLSCREEN_AD_NOT_READY", MaxErrorCode.FULLSCREEN_AD_NOT_READY );
|
|
2396
|
-
constants.put( "MAX_ERROR_CODE_FULLSCREEN_AD_ALREADY_LOADING", MaxErrorCode.FULLSCREEN_AD_ALREADY_LOADING );
|
|
2397
|
-
constants.put( "MAX_ERROR_CODE_FULLSCREEN_AD_LOAD_WHILE_SHOWING", MaxErrorCode.FULLSCREEN_AD_LOAD_WHILE_SHOWING );
|
|
2398
2398
|
constants.put( "MAX_ERROR_CODE_DONT_KEEP_ACTIVITIES_ENABLED", MaxErrorCode.DONT_KEEP_ACTIVITIES_ENABLED );
|
|
2399
2399
|
constants.put( "MAX_ERROR_CODE_INVALID_AD_UNIT_ID", MaxErrorCode.INVALID_AD_UNIT_ID );
|
|
2400
2400
|
// iOS only
|
package/ios/AppLovinMAX.h
CHANGED
|
@@ -21,6 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
21
21
|
*/
|
|
22
22
|
@interface AppLovinMAX : RCTEventEmitter<RCTBridgeModule, MAAdDelegate, MARewardedAdDelegate, MAAdViewAdDelegate, MAAdRevenueDelegate>
|
|
23
23
|
|
|
24
|
+
extern NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT;
|
|
25
|
+
extern NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT;
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* Shared instance of this bridge module.
|
|
26
29
|
*/
|
package/ios/AppLovinMAX.m
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
@implementation AppLovinMAX
|
|
74
74
|
static NSString *const SDK_TAG = @"AppLovinSdk";
|
|
75
75
|
static NSString *const TAG = @"AppLovinMAX";
|
|
76
|
-
static NSString *const PLUGIN_VERSION = @"8.
|
|
76
|
+
static NSString *const PLUGIN_VERSION = @"8.1.1";
|
|
77
77
|
|
|
78
78
|
static NSString *const USER_GEOGRAPHY_GDPR = @"G";
|
|
79
79
|
static NSString *const USER_GEOGRAPHY_OTHER = @"O";
|
|
@@ -124,9 +124,6 @@ static NSString *const ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT = @"OnAppOpenAdFail
|
|
|
124
124
|
static NSString *const ON_APPOPEN_AD_HIDDEN_EVENT = @"OnAppOpenAdHiddenEvent";
|
|
125
125
|
static NSString *const ON_APPOPEN_AD_REVENUE_PAID = @"OnAppOpenAdRevenuePaid";
|
|
126
126
|
|
|
127
|
-
static NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT = @"OnNativeUIComponentAdViewAdLoadedEvent";
|
|
128
|
-
static NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT = @"OnNativeUIComponentAdViewAdLoadFailedEvent";
|
|
129
|
-
|
|
130
127
|
static NSString *const TOP_CENTER = @"top_center";
|
|
131
128
|
static NSString *const TOP_LEFT = @"top_left";
|
|
132
129
|
static NSString *const TOP_RIGHT = @"top_right";
|
|
@@ -141,6 +138,9 @@ static AppLovinMAX *AppLovinMAXShared; // Shared instance of this bridge module.
|
|
|
141
138
|
|
|
142
139
|
static NSDictionary<NSString *, NSString *> *ALCompatibleNativeSDKVersions;
|
|
143
140
|
|
|
141
|
+
NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT = @"OnNativeUIComponentAdViewAdLoadedEvent";
|
|
142
|
+
NSString *const ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT = @"OnNativeUIComponentAdViewAdLoadFailedEvent";
|
|
143
|
+
|
|
144
144
|
// To export a module named AppLovinMAX ("RCT" automatically removed)
|
|
145
145
|
RCT_EXPORT_MODULE()
|
|
146
146
|
|
|
@@ -149,6 +149,8 @@ RCT_EXPORT_MODULE()
|
|
|
149
149
|
[super initialize];
|
|
150
150
|
|
|
151
151
|
ALCompatibleNativeSDKVersions = @{
|
|
152
|
+
@"8.1.1" : @"13.0.1",
|
|
153
|
+
@"8.1.0" : @"13.0.1",
|
|
152
154
|
@"8.0.5" : @"13.0.1",
|
|
153
155
|
@"8.0.4" : @"13.0.0",
|
|
154
156
|
@"8.0.3" : @"13.0.0",
|
|
@@ -984,11 +986,11 @@ RCT_EXPORT_METHOD(preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
|
984
986
|
withPromiseRejecter: reject];
|
|
985
987
|
}
|
|
986
988
|
|
|
987
|
-
RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(
|
|
989
|
+
RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(nonnull NSNumber *)adViewId
|
|
988
990
|
:(RCTPromiseResolveBlock)resolve
|
|
989
991
|
:(RCTPromiseRejectBlock)reject)
|
|
990
992
|
{
|
|
991
|
-
[AppLovinMAXAdView destroyNativeUIComponentAdView:
|
|
993
|
+
[AppLovinMAXAdView destroyNativeUIComponentAdView: adViewId
|
|
992
994
|
withPromiseResolver: resolve
|
|
993
995
|
withPromiseRejecter: reject];
|
|
994
996
|
}
|
|
@@ -2169,8 +2171,6 @@ RCT_EXPORT_METHOD(destroyNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
|
2169
2171
|
@"MAX_ERROR_CODE_FULLSCREEN_AD_ALREADY_SHOWING" : @(MAErrorCodeFullscreenAdAlreadyShowing),
|
|
2170
2172
|
@"MAX_ERROR_CODE_FULLSCREEN_AD_NOT_READY" : @(MAErrorCodeFullscreenAdNotReady),
|
|
2171
2173
|
@"MAX_ERROR_CODE_FULLSCREEN_AD_INVALID_VIEW_CONTROLLER" : @(MAErrorCodeFullscreenAdInvalidViewController),
|
|
2172
|
-
@"MAX_ERROR_CODE_FULLSCREEN_AD_ALREADY_LOADING" : @(MAErrorCodeFullscreenAdAlreadyLoading),
|
|
2173
|
-
@"MAX_ERROR_CODE_FULLSCREEN_AD_LOAD_WHILE_SHOWING" : @(MAErrorCodeFullscreenAdLoadWhileShowing),
|
|
2174
2174
|
@"MAX_ERROR_CODE_INVALID_AD_UNIT_ID" : @(MAErrorCodeInvalidAdUnitIdentifier),
|
|
2175
2175
|
// Android only
|
|
2176
2176
|
@"MAX_ERROR_CODE_DONT_KEEP_ACTIVITIES_ENABLED" : @(-5602)};
|
package/ios/AppLovinMAXAdView.h
CHANGED
|
@@ -21,7 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
21
21
|
@property (nonatomic, copy) RCTDirectEventBlock onAdCollapsedEvent;
|
|
22
22
|
@property (nonatomic, copy) RCTDirectEventBlock onAdRevenuePaidEvent;
|
|
23
23
|
|
|
24
|
-
+ (MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
|
|
24
|
+
+ (nullable MAAdView *)sharedWithAdUnitIdentifier:(NSString *)adUnitIdentifier;
|
|
25
|
+
|
|
26
|
+
+ (BOOL)hasPreloadedAdViewForIdentifier:(NSNumber *)adViewId;
|
|
25
27
|
|
|
26
28
|
+ (void)preloadNativeUIComponentAdView:(NSString *)adUnitIdentifier
|
|
27
29
|
adFormat:(MAAdFormat *)adFormat
|
|
@@ -32,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
32
34
|
withPromiseResolver:(RCTPromiseResolveBlock)resolve
|
|
33
35
|
withPromiseRejecter:(RCTPromiseRejectBlock)reject;
|
|
34
36
|
|
|
35
|
-
+ (void)destroyNativeUIComponentAdView:(
|
|
37
|
+
+ (void)destroyNativeUIComponentAdView:(NSNumber *)adViewId
|
|
36
38
|
withPromiseResolver:(RCTPromiseResolveBlock)resolve
|
|
37
39
|
withPromiseRejecter:(RCTPromiseRejectBlock)reject;
|
|
38
40
|
|