react-native-applovin-max 8.2.0 → 9.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.
- package/android/build.gradle +13 -2
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +33 -26
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManagerImpl.java +110 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +15 -13
- package/android/src/main/java/com/applovin/reactnative/{AppLovinMAXModule.java → AppLovinMAXModuleImpl.java} +107 -168
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +84 -56
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManagerImpl.java +101 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXPackage.java +44 -11
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXUtils.java +56 -0
- package/android/src/newarch/com/applovin/reactnative/AppLovinMAXAdViewManager.java +151 -0
- package/android/src/newarch/com/applovin/reactnative/AppLovinMAXModule.java +453 -0
- package/android/src/newarch/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +130 -0
- package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXAdViewManager.java +128 -0
- package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXModule.java +453 -0
- package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +93 -0
- package/ios/AppLovinMAX.h +8 -3
- package/ios/{AppLovinMAX.m → AppLovinMAX.mm} +66 -53
- package/ios/AppLovinMAXAdView.h +7 -2
- package/ios/AppLovinMAXAdView.mm +747 -0
- package/ios/{AppLovinMAXAdViewManager.m → AppLovinMAXAdViewManager.mm} +3 -2
- package/ios/{AppLovinMAXAdViewUIComponent.m → AppLovinMAXAdViewUIComponent.mm} +2 -1
- package/ios/AppLovinMAXNativeAdView.h +15 -4
- package/ios/AppLovinMAXNativeAdView.mm +745 -0
- package/ios/AppLovinMAXNativeAdViewManager.mm +116 -0
- package/lib/commonjs/AdView.js +61 -85
- package/lib/commonjs/AdView.js.map +1 -1
- package/lib/commonjs/AppLovinMAX.js +11 -10
- package/lib/commonjs/AppLovinMAX.js.map +1 -1
- package/lib/commonjs/AppOpenAd.js +8 -10
- package/lib/commonjs/AppOpenAd.js.map +1 -1
- package/lib/commonjs/BannerAd.js +19 -21
- package/lib/commonjs/BannerAd.js.map +1 -1
- package/lib/commonjs/ErrorCode.js +3 -5
- package/lib/commonjs/ErrorCode.js.map +1 -1
- package/lib/commonjs/EventEmitter.js +3 -5
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/InterstitialAd.js +8 -10
- package/lib/commonjs/InterstitialAd.js.map +1 -1
- package/lib/commonjs/MRecAd.js +14 -16
- package/lib/commonjs/MRecAd.js.map +1 -1
- package/lib/commonjs/Privacy.js +3 -5
- package/lib/commonjs/Privacy.js.map +1 -1
- package/lib/commonjs/RewardedAd.js +8 -10
- package/lib/commonjs/RewardedAd.js.map +1 -1
- package/lib/commonjs/Utils.js +25 -0
- package/lib/commonjs/Utils.js.map +1 -0
- package/lib/commonjs/nativeAd/NativeAdView.js +65 -42
- package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js +51 -47
- package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js +38 -8
- package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/commonjs/nativeAd/img/blank_icon.png +0 -0
- package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js +14 -0
- package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js +14 -0
- package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeAppLovinMAXModule.js +9 -0
- package/lib/commonjs/specs/NativeAppLovinMAXModule.js.map +1 -0
- package/lib/module/AdView.js +56 -81
- package/lib/module/AdView.js.map +1 -1
- package/lib/module/AppLovinMAX.js +7 -7
- package/lib/module/AppLovinMAX.js.map +1 -1
- package/lib/module/AppOpenAd.js +1 -4
- package/lib/module/AppOpenAd.js.map +1 -1
- package/lib/module/BannerAd.js +1 -4
- package/lib/module/BannerAd.js.map +1 -1
- package/lib/module/ErrorCode.js +1 -4
- package/lib/module/ErrorCode.js.map +1 -1
- package/lib/module/EventEmitter.js +2 -4
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/InterstitialAd.js +2 -5
- package/lib/module/InterstitialAd.js.map +1 -1
- package/lib/module/MRecAd.js +1 -4
- package/lib/module/MRecAd.js.map +1 -1
- package/lib/module/Privacy.js +1 -4
- package/lib/module/Privacy.js.map +1 -1
- package/lib/module/RewardedAd.js +2 -5
- package/lib/module/RewardedAd.js.map +1 -1
- package/lib/module/Utils.js +17 -0
- package/lib/module/Utils.js.map +1 -0
- package/lib/module/nativeAd/NativeAdView.js +63 -40
- package/lib/module/nativeAd/NativeAdView.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewComponents.js +53 -49
- package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
- package/lib/module/nativeAd/NativeAdViewProvider.js +39 -9
- package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
- package/lib/module/nativeAd/img/blank_icon.png +0 -0
- package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js +7 -0
- package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -0
- package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js +7 -0
- package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeAppLovinMAXModule.js +3 -0
- package/lib/module/specs/NativeAppLovinMAXModule.js.map +1 -0
- package/lib/typescript/src/AdView.d.ts +11 -11
- package/lib/typescript/src/AdView.d.ts.map +1 -1
- package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
- package/lib/typescript/src/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/src/BannerAd.d.ts.map +1 -1
- package/lib/typescript/src/ErrorCode.d.ts.map +1 -1
- package/lib/typescript/src/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/src/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/src/MRecAd.d.ts.map +1 -1
- package/lib/typescript/src/Privacy.d.ts.map +1 -1
- package/lib/typescript/src/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/src/Utils.d.ts +16 -0
- package/lib/typescript/src/Utils.d.ts.map +1 -0
- package/lib/typescript/src/nativeAd/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
- package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts +14 -5
- package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
- package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts +86 -0
- package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts +80 -0
- package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts +132 -0
- package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts.map +1 -0
- package/lib/typescript/src/types/AdInfo.d.ts +1 -1
- package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/src/types/AdProps.d.ts +2 -2
- package/lib/typescript/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/src/types/NativeAd.d.ts +4 -0
- package/lib/typescript/src/types/NativeAd.d.ts.map +1 -1
- package/package.json +9 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AdView.tsx +56 -121
- package/src/AppLovinMAX.ts +7 -8
- package/src/AppOpenAd.ts +1 -3
- package/src/BannerAd.ts +1 -3
- package/src/ErrorCode.ts +1 -3
- package/src/EventEmitter.ts +2 -3
- package/src/InterstitialAd.ts +2 -4
- package/src/MRecAd.ts +1 -3
- package/src/Privacy.ts +1 -3
- package/src/RewardedAd.ts +2 -4
- package/src/Utils.ts +26 -0
- package/src/nativeAd/NativeAdView.tsx +65 -65
- package/src/nativeAd/NativeAdViewComponents.tsx +32 -60
- package/src/nativeAd/NativeAdViewProvider.tsx +37 -12
- package/src/nativeAd/img/blank_icon.png +0 -0
- package/src/specs/AppLovinMAXAdViewNativeComponent.ts +96 -0
- package/src/specs/AppLovinMAXNativeAdViewNativeComponent.ts +89 -0
- package/src/specs/NativeAppLovinMAXModule.ts +208 -0
- package/src/types/AdInfo.ts +1 -1
- package/src/types/AdProps.ts +2 -2
- package/src/types/NativeAd.ts +5 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +0 -149
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +0 -163
- package/ios/AppLovinMAXAdView.m +0 -325
- package/ios/AppLovinMAXNativeAdView.m +0 -432
- package/ios/AppLovinMAXNativeAdViewManager.m +0 -64
|
@@ -49,12 +49,13 @@ import com.facebook.react.bridge.Arguments;
|
|
|
49
49
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
50
50
|
import com.facebook.react.bridge.Promise;
|
|
51
51
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
52
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
53
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
54
52
|
import com.facebook.react.bridge.ReadableArray;
|
|
55
53
|
import com.facebook.react.bridge.ReadableMap;
|
|
56
54
|
import com.facebook.react.bridge.WritableArray;
|
|
57
55
|
import com.facebook.react.bridge.WritableMap;
|
|
56
|
+
import com.facebook.react.uimanager.UIManagerHelper;
|
|
57
|
+
import com.facebook.react.uimanager.events.Event;
|
|
58
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
58
59
|
|
|
59
60
|
import java.util.ArrayList;
|
|
60
61
|
import java.util.HashMap;
|
|
@@ -71,14 +72,13 @@ import static com.facebook.react.modules.core.DeviceEventManagerModule.RCTDevice
|
|
|
71
72
|
/**
|
|
72
73
|
* Created by Thomas So on July 11 2020
|
|
73
74
|
*/
|
|
74
|
-
public class
|
|
75
|
-
extends ReactContextBaseJavaModule
|
|
75
|
+
public class AppLovinMAXModuleImpl
|
|
76
76
|
implements LifecycleEventListener,
|
|
77
77
|
MaxAdListener, MaxAdViewAdListener, MaxRewardedAdListener, MaxAdRevenueListener
|
|
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 = "
|
|
81
|
+
private static final String PLUGIN_VERSION = "9.0.0";
|
|
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,7 @@ public class AppLovinMAXModule
|
|
|
100
100
|
|
|
101
101
|
static
|
|
102
102
|
{
|
|
103
|
+
ALCompatibleNativeSdkVersions.put( "9.0.0", "13.0.1" );
|
|
103
104
|
ALCompatibleNativeSdkVersions.put( "8.2.0", "13.0.1" );
|
|
104
105
|
ALCompatibleNativeSdkVersions.put( "8.1.1", "13.0.1" );
|
|
105
106
|
ALCompatibleNativeSdkVersions.put( "8.1.0", "13.0.1" );
|
|
@@ -111,12 +112,15 @@ public class AppLovinMAXModule
|
|
|
111
112
|
ALCompatibleNativeSdkVersions.put( "8.0.0", "13.0.0" );
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
public static
|
|
115
|
+
public static final String NAME = "AppLovinMAX";
|
|
116
|
+
|
|
117
|
+
public static AppLovinMAXModuleImpl instance;
|
|
115
118
|
@Nullable
|
|
116
|
-
private static Activity
|
|
119
|
+
private static Activity currentActivity;
|
|
117
120
|
|
|
118
121
|
// Parent Fields
|
|
119
122
|
private final AppLovinSdk sdk;
|
|
123
|
+
private final ReactApplicationContext reactContext;
|
|
120
124
|
private boolean isPluginInitialized;
|
|
121
125
|
private boolean isSdkInitialized;
|
|
122
126
|
private AppLovinSdkConfiguration sdkConfiguration;
|
|
@@ -143,7 +147,7 @@ public class AppLovinMAXModule
|
|
|
143
147
|
private final List<String> adUnitIdsToShowAfterCreate = new ArrayList<>( 2 );
|
|
144
148
|
private final Set<String> disabledAdaptiveBannerAdUnitIds = new HashSet<>( 2 );
|
|
145
149
|
|
|
146
|
-
public static
|
|
150
|
+
public static AppLovinMAXModuleImpl getInstance()
|
|
147
151
|
{
|
|
148
152
|
return instance;
|
|
149
153
|
}
|
|
@@ -153,9 +157,9 @@ public class AppLovinMAXModule
|
|
|
153
157
|
return sdk;
|
|
154
158
|
}
|
|
155
159
|
|
|
156
|
-
public
|
|
160
|
+
public AppLovinMAXModuleImpl(final ReactApplicationContext reactApplicationContext)
|
|
157
161
|
{
|
|
158
|
-
|
|
162
|
+
reactContext = reactApplicationContext;
|
|
159
163
|
|
|
160
164
|
// Check that plugin version is compatible with native SDK version
|
|
161
165
|
String minCompatibleNativeSdkVersion = ALCompatibleNativeSdkVersions.get( PLUGIN_VERSION );
|
|
@@ -174,33 +178,24 @@ public class AppLovinMAXModule
|
|
|
174
178
|
reactContext.addLifecycleEventListener( this );
|
|
175
179
|
}
|
|
176
180
|
|
|
177
|
-
@NonNull
|
|
178
|
-
@Override
|
|
179
|
-
public String getName()
|
|
180
|
-
{
|
|
181
|
-
return "AppLovinMAX";
|
|
182
|
-
}
|
|
183
|
-
|
|
184
181
|
@Nullable
|
|
185
182
|
private Activity maybeGetCurrentActivity()
|
|
186
183
|
{
|
|
187
184
|
// React Native has a bug where `getCurrentActivity()` returns null: https://github.com/facebook/react-native/issues/18345
|
|
188
185
|
// To alleviate the issue - we will store as a static reference (WeakReference unfortunately did not suffice)
|
|
189
|
-
if (
|
|
186
|
+
if ( reactContext.hasCurrentActivity() )
|
|
190
187
|
{
|
|
191
|
-
currentActivity =
|
|
188
|
+
currentActivity = reactContext.getCurrentActivity();
|
|
192
189
|
}
|
|
193
190
|
|
|
194
191
|
return currentActivity;
|
|
195
192
|
}
|
|
196
193
|
|
|
197
|
-
@ReactMethod
|
|
198
194
|
public void isInitialized(final Promise promise)
|
|
199
195
|
{
|
|
200
196
|
promise.resolve( isPluginInitialized && isSdkInitialized );
|
|
201
197
|
}
|
|
202
198
|
|
|
203
|
-
@ReactMethod
|
|
204
199
|
public void initialize(final String pluginVersion, final String sdkKey, final Promise promise)
|
|
205
200
|
{
|
|
206
201
|
// Guard against running init logic multiple times
|
|
@@ -220,7 +215,7 @@ public class AppLovinMAXModule
|
|
|
220
215
|
return;
|
|
221
216
|
}
|
|
222
217
|
|
|
223
|
-
AppLovinSdkInitializationConfiguration.Builder initConfigBuidler = AppLovinSdkInitializationConfiguration.builder( sdkKey,
|
|
218
|
+
AppLovinSdkInitializationConfiguration.Builder initConfigBuidler = AppLovinSdkInitializationConfiguration.builder( sdkKey, reactContext );
|
|
224
219
|
initConfigBuidler.setPluginVersion( "React-Native-" + pluginVersion );
|
|
225
220
|
initConfigBuidler.setMediationProvider( AppLovinMediationProvider.MAX );
|
|
226
221
|
initConfigBuidler.setSegmentCollection( segmentCollectionBuilder.build() );
|
|
@@ -242,12 +237,12 @@ public class AppLovinMAXModule
|
|
|
242
237
|
sdkConfiguration = appLovinSdkConfiguration;
|
|
243
238
|
isSdkInitialized = true;
|
|
244
239
|
|
|
245
|
-
windowManager = (WindowManager)
|
|
240
|
+
windowManager = (WindowManager) reactContext.getSystemService( Context.WINDOW_SERVICE );
|
|
246
241
|
|
|
247
242
|
lastRotation = windowManager.getDefaultDisplay().getRotation();
|
|
248
243
|
|
|
249
244
|
// Enable orientation change listener, so that the ad view positions can be updated when the device is rotated.
|
|
250
|
-
new OrientationEventListener(
|
|
245
|
+
new OrientationEventListener( reactContext )
|
|
251
246
|
{
|
|
252
247
|
@Override
|
|
253
248
|
public void onOrientationChanged(final int orientation)
|
|
@@ -284,15 +279,13 @@ public class AppLovinMAXModule
|
|
|
284
279
|
|
|
285
280
|
// General Public API
|
|
286
281
|
|
|
287
|
-
@ReactMethod
|
|
288
282
|
public void isTablet(final Promise promise)
|
|
289
283
|
{
|
|
290
284
|
Activity currentActivity = maybeGetCurrentActivity();
|
|
291
|
-
Context contextToUse = ( currentActivity != null ) ? currentActivity :
|
|
285
|
+
Context contextToUse = ( currentActivity != null ) ? currentActivity : reactContext;
|
|
292
286
|
promise.resolve( AppLovinSdkUtils.isTablet( contextToUse ) );
|
|
293
287
|
}
|
|
294
288
|
|
|
295
|
-
@ReactMethod
|
|
296
289
|
public void showMediationDebugger()
|
|
297
290
|
{
|
|
298
291
|
if ( !isSdkInitialized )
|
|
@@ -304,61 +297,51 @@ public class AppLovinMAXModule
|
|
|
304
297
|
sdk.showMediationDebugger();
|
|
305
298
|
}
|
|
306
299
|
|
|
307
|
-
@ReactMethod
|
|
308
300
|
public void setHasUserConsent(final boolean hasUserConsent)
|
|
309
301
|
{
|
|
310
|
-
AppLovinPrivacySettings.setHasUserConsent( hasUserConsent,
|
|
302
|
+
AppLovinPrivacySettings.setHasUserConsent( hasUserConsent, reactContext );
|
|
311
303
|
}
|
|
312
304
|
|
|
313
|
-
@ReactMethod
|
|
314
305
|
public void hasUserConsent(final Promise promise)
|
|
315
306
|
{
|
|
316
|
-
promise.resolve( AppLovinPrivacySettings.hasUserConsent(
|
|
307
|
+
promise.resolve( AppLovinPrivacySettings.hasUserConsent( reactContext ) );
|
|
317
308
|
}
|
|
318
309
|
|
|
319
|
-
@ReactMethod
|
|
320
310
|
public void setDoNotSell(final boolean doNotSell)
|
|
321
311
|
{
|
|
322
|
-
AppLovinPrivacySettings.setDoNotSell( doNotSell,
|
|
312
|
+
AppLovinPrivacySettings.setDoNotSell( doNotSell, reactContext );
|
|
323
313
|
}
|
|
324
314
|
|
|
325
|
-
@ReactMethod
|
|
326
315
|
public void isDoNotSell(final Promise promise)
|
|
327
316
|
{
|
|
328
|
-
promise.resolve( AppLovinPrivacySettings.isDoNotSell(
|
|
317
|
+
promise.resolve( AppLovinPrivacySettings.isDoNotSell( reactContext ) );
|
|
329
318
|
}
|
|
330
319
|
|
|
331
|
-
@ReactMethod
|
|
332
320
|
public void setUserId(final String userId)
|
|
333
321
|
{
|
|
334
322
|
sdk.getSettings().setUserIdentifier( userId );
|
|
335
323
|
}
|
|
336
324
|
|
|
337
|
-
@ReactMethod
|
|
338
325
|
public void setMuted(final boolean muted)
|
|
339
326
|
{
|
|
340
327
|
sdk.getSettings().setMuted( muted );
|
|
341
328
|
}
|
|
342
329
|
|
|
343
|
-
@ReactMethod
|
|
344
330
|
public void isMuted(final Promise promise)
|
|
345
331
|
{
|
|
346
332
|
promise.resolve( sdk.getSettings().isMuted() );
|
|
347
333
|
}
|
|
348
334
|
|
|
349
|
-
@ReactMethod
|
|
350
335
|
public void setVerboseLogging(final boolean enabled)
|
|
351
336
|
{
|
|
352
337
|
sdk.getSettings().setVerboseLogging( enabled );
|
|
353
338
|
}
|
|
354
339
|
|
|
355
|
-
@ReactMethod
|
|
356
340
|
public void setCreativeDebuggerEnabled(final boolean enabled)
|
|
357
341
|
{
|
|
358
342
|
sdk.getSettings().setCreativeDebuggerEnabled( enabled );
|
|
359
343
|
}
|
|
360
344
|
|
|
361
|
-
@ReactMethod
|
|
362
345
|
public void setTestDeviceAdvertisingIds(final ReadableArray rawAdvertisingIds)
|
|
363
346
|
{
|
|
364
347
|
List<String> advertisingIds = new ArrayList<>( rawAdvertisingIds.size() );
|
|
@@ -372,7 +355,6 @@ public class AppLovinMAXModule
|
|
|
372
355
|
testDeviceAdvertisingIdsToSet = advertisingIds;
|
|
373
356
|
}
|
|
374
357
|
|
|
375
|
-
@ReactMethod
|
|
376
358
|
public void setExtraParameter(final String key, @Nullable final String value)
|
|
377
359
|
{
|
|
378
360
|
if ( TextUtils.isEmpty( key ) )
|
|
@@ -384,7 +366,6 @@ public class AppLovinMAXModule
|
|
|
384
366
|
sdk.getSettings().setExtraParameter( key, value );
|
|
385
367
|
}
|
|
386
368
|
|
|
387
|
-
@ReactMethod
|
|
388
369
|
public void setInitializationAdUnitIds(final ReadableArray rawAdUnitIds)
|
|
389
370
|
{
|
|
390
371
|
initializationAdUnitIdsToSet = new ArrayList<>( rawAdUnitIds.size() );
|
|
@@ -398,31 +379,26 @@ public class AppLovinMAXModule
|
|
|
398
379
|
|
|
399
380
|
// MAX Terms and Privacy Policy Flow
|
|
400
381
|
|
|
401
|
-
@ReactMethod
|
|
402
382
|
public void setTermsAndPrivacyPolicyFlowEnabled(final boolean enabled)
|
|
403
383
|
{
|
|
404
384
|
sdk.getSettings().getTermsAndPrivacyPolicyFlowSettings().setEnabled( enabled );
|
|
405
385
|
}
|
|
406
386
|
|
|
407
|
-
@ReactMethod
|
|
408
387
|
public void setPrivacyPolicyUrl(final String urlString)
|
|
409
388
|
{
|
|
410
389
|
sdk.getSettings().getTermsAndPrivacyPolicyFlowSettings().setPrivacyPolicyUri( Uri.parse( urlString ) );
|
|
411
390
|
}
|
|
412
391
|
|
|
413
|
-
@ReactMethod
|
|
414
392
|
public void setTermsOfServiceUrl(final String urlString)
|
|
415
393
|
{
|
|
416
394
|
sdk.getSettings().getTermsAndPrivacyPolicyFlowSettings().setTermsOfServiceUri( Uri.parse( urlString ) );
|
|
417
395
|
}
|
|
418
396
|
|
|
419
|
-
@ReactMethod
|
|
420
397
|
public void setConsentFlowDebugUserGeography(final String userGeography)
|
|
421
398
|
{
|
|
422
399
|
sdk.getSettings().getTermsAndPrivacyPolicyFlowSettings().setDebugUserGeography( getAppLovinConsentFlowUserGeography( userGeography ) );
|
|
423
400
|
}
|
|
424
401
|
|
|
425
|
-
@ReactMethod
|
|
426
402
|
public void showCmpForExistingUser(final Promise promise)
|
|
427
403
|
{
|
|
428
404
|
if ( !isPluginInitialized )
|
|
@@ -455,7 +431,6 @@ public class AppLovinMAXModule
|
|
|
455
431
|
} );
|
|
456
432
|
}
|
|
457
433
|
|
|
458
|
-
@ReactMethod
|
|
459
434
|
public void hasSupportedCmp(final Promise promise)
|
|
460
435
|
{
|
|
461
436
|
if ( !isPluginInitialized )
|
|
@@ -469,7 +444,6 @@ public class AppLovinMAXModule
|
|
|
469
444
|
|
|
470
445
|
// Segment Targeting
|
|
471
446
|
|
|
472
|
-
@ReactMethod
|
|
473
447
|
public void addSegment(final int key, final ReadableArray values, final Promise promise)
|
|
474
448
|
{
|
|
475
449
|
if ( isPluginInitialized )
|
|
@@ -503,7 +477,6 @@ public class AppLovinMAXModule
|
|
|
503
477
|
promise.resolve( null );
|
|
504
478
|
}
|
|
505
479
|
|
|
506
|
-
@ReactMethod
|
|
507
480
|
public void getSegments(final Promise promise)
|
|
508
481
|
{
|
|
509
482
|
if ( !isSdkInitialized )
|
|
@@ -533,7 +506,6 @@ public class AppLovinMAXModule
|
|
|
533
506
|
|
|
534
507
|
// EVENT TRACKING
|
|
535
508
|
|
|
536
|
-
@ReactMethod
|
|
537
509
|
public void trackEvent(final String event, final ReadableMap parameters)
|
|
538
510
|
{
|
|
539
511
|
// Convert Map<String, Object> type of `parameters.toHashMap()` to Map<String, String>
|
|
@@ -552,7 +524,6 @@ public class AppLovinMAXModule
|
|
|
552
524
|
|
|
553
525
|
// BANNERS
|
|
554
526
|
|
|
555
|
-
@ReactMethod
|
|
556
527
|
public void createBanner(final String adUnitId, final String bannerPosition)
|
|
557
528
|
{
|
|
558
529
|
if ( sdk == null )
|
|
@@ -564,7 +535,7 @@ public class AppLovinMAXModule
|
|
|
564
535
|
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, DEFAULT_AD_VIEW_OFFSET );
|
|
565
536
|
}
|
|
566
537
|
|
|
567
|
-
|
|
538
|
+
// NOTE: No function overloading in JS so we need new method signature
|
|
568
539
|
public void createBannerWithOffsets(final String adUnitId, final String bannerPosition, final float x, final float y)
|
|
569
540
|
{
|
|
570
541
|
if ( sdk == null )
|
|
@@ -573,10 +544,9 @@ public class AppLovinMAXModule
|
|
|
573
544
|
return;
|
|
574
545
|
}
|
|
575
546
|
|
|
576
|
-
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, getOffsetPixels( x, y,
|
|
547
|
+
createAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), bannerPosition, getOffsetPixels( x, y, reactContext ) );
|
|
577
548
|
}
|
|
578
549
|
|
|
579
|
-
@ReactMethod
|
|
580
550
|
public void setBannerBackgroundColor(final String adUnitId, final String hexColorCode)
|
|
581
551
|
{
|
|
582
552
|
if ( sdk == null )
|
|
@@ -588,7 +558,6 @@ public class AppLovinMAXModule
|
|
|
588
558
|
setAdViewBackgroundColor( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), hexColorCode );
|
|
589
559
|
}
|
|
590
560
|
|
|
591
|
-
@ReactMethod
|
|
592
561
|
public void setBannerPlacement(final String adUnitId, final String placement)
|
|
593
562
|
{
|
|
594
563
|
if ( sdk == null )
|
|
@@ -600,7 +569,6 @@ public class AppLovinMAXModule
|
|
|
600
569
|
setAdViewPlacement( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), placement );
|
|
601
570
|
}
|
|
602
571
|
|
|
603
|
-
@ReactMethod
|
|
604
572
|
public void setBannerCustomData(final String adUnitId, final String customData)
|
|
605
573
|
{
|
|
606
574
|
if ( sdk == null )
|
|
@@ -612,7 +580,6 @@ public class AppLovinMAXModule
|
|
|
612
580
|
setAdViewCustomData( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), customData );
|
|
613
581
|
}
|
|
614
582
|
|
|
615
|
-
@ReactMethod
|
|
616
583
|
public void setBannerWidth(final String adUnitId, final int widthDp)
|
|
617
584
|
{
|
|
618
585
|
if ( sdk == null )
|
|
@@ -624,7 +591,6 @@ public class AppLovinMAXModule
|
|
|
624
591
|
setAdViewWidth( adUnitId, widthDp, getDeviceSpecificBannerAdViewAdFormat() );
|
|
625
592
|
}
|
|
626
593
|
|
|
627
|
-
@ReactMethod
|
|
628
594
|
public void updateBannerPosition(final String adUnitId, final String bannerPosition)
|
|
629
595
|
{
|
|
630
596
|
if ( sdk == null )
|
|
@@ -636,7 +602,6 @@ public class AppLovinMAXModule
|
|
|
636
602
|
updateAdViewPosition( adUnitId, bannerPosition, DEFAULT_AD_VIEW_OFFSET, getDeviceSpecificBannerAdViewAdFormat() );
|
|
637
603
|
}
|
|
638
604
|
|
|
639
|
-
@ReactMethod
|
|
640
605
|
public void updateBannerOffsets(final String adUnitId, final float x, final float y)
|
|
641
606
|
{
|
|
642
607
|
if ( sdk == null )
|
|
@@ -645,11 +610,10 @@ public class AppLovinMAXModule
|
|
|
645
610
|
return;
|
|
646
611
|
}
|
|
647
612
|
|
|
648
|
-
updateAdViewPosition( adUnitId, adViewPositions.get( adUnitId ), getOffsetPixels( x, y,
|
|
613
|
+
updateAdViewPosition( adUnitId, adViewPositions.get( adUnitId ), getOffsetPixels( x, y, reactContext ), getDeviceSpecificBannerAdViewAdFormat() );
|
|
649
614
|
}
|
|
650
615
|
|
|
651
|
-
@
|
|
652
|
-
public void setBannerExtraParameter(final String adUnitId, final String key, final String value)
|
|
616
|
+
public void setBannerExtraParameter(final String adUnitId, final String key, @Nullable final String value)
|
|
653
617
|
{
|
|
654
618
|
if ( sdk == null )
|
|
655
619
|
{
|
|
@@ -660,14 +624,12 @@ public class AppLovinMAXModule
|
|
|
660
624
|
setAdViewExtraParameters( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), key, value );
|
|
661
625
|
}
|
|
662
626
|
|
|
663
|
-
@ReactMethod
|
|
664
627
|
public void setBannerLocalExtraParameter(final String adUnitId, final ReadableMap parameterMap)
|
|
665
628
|
{
|
|
666
629
|
Map.Entry<String, Object> entry = parameterMap.getEntryIterator().next();
|
|
667
630
|
setAdViewLocalExtraParameters( adUnitId, getDeviceSpecificBannerAdViewAdFormat(), entry.getKey(), entry.getValue() );
|
|
668
631
|
}
|
|
669
632
|
|
|
670
|
-
@ReactMethod
|
|
671
633
|
public void startBannerAutoRefresh(final String adUnitId)
|
|
672
634
|
{
|
|
673
635
|
if ( sdk == null )
|
|
@@ -679,7 +641,6 @@ public class AppLovinMAXModule
|
|
|
679
641
|
startAutoRefresh( adUnitId, getDeviceSpecificBannerAdViewAdFormat() );
|
|
680
642
|
}
|
|
681
643
|
|
|
682
|
-
@ReactMethod
|
|
683
644
|
public void stopBannerAutoRefresh(final String adUnitId)
|
|
684
645
|
{
|
|
685
646
|
if ( sdk == null )
|
|
@@ -691,7 +652,6 @@ public class AppLovinMAXModule
|
|
|
691
652
|
stopAutoRefresh( adUnitId, getDeviceSpecificBannerAdViewAdFormat() );
|
|
692
653
|
}
|
|
693
654
|
|
|
694
|
-
@ReactMethod
|
|
695
655
|
public void showBanner(final String adUnitId)
|
|
696
656
|
{
|
|
697
657
|
if ( sdk == null )
|
|
@@ -703,7 +663,6 @@ public class AppLovinMAXModule
|
|
|
703
663
|
showAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat() );
|
|
704
664
|
}
|
|
705
665
|
|
|
706
|
-
@ReactMethod
|
|
707
666
|
public void hideBanner(final String adUnitId)
|
|
708
667
|
{
|
|
709
668
|
if ( sdk == null )
|
|
@@ -715,7 +674,6 @@ public class AppLovinMAXModule
|
|
|
715
674
|
hideAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat() );
|
|
716
675
|
}
|
|
717
676
|
|
|
718
|
-
@ReactMethod
|
|
719
677
|
public void destroyBanner(final String adUnitId)
|
|
720
678
|
{
|
|
721
679
|
if ( sdk == null )
|
|
@@ -727,15 +685,13 @@ public class AppLovinMAXModule
|
|
|
727
685
|
destroyAdView( adUnitId, getDeviceSpecificBannerAdViewAdFormat() );
|
|
728
686
|
}
|
|
729
687
|
|
|
730
|
-
@ReactMethod
|
|
731
688
|
public void getAdaptiveBannerHeightForWidth(final float width, final Promise promise)
|
|
732
689
|
{
|
|
733
|
-
promise.resolve( getDeviceSpecificBannerAdViewAdFormat().getAdaptiveSize( (int) width,
|
|
690
|
+
promise.resolve( getDeviceSpecificBannerAdViewAdFormat().getAdaptiveSize( (int) width, reactContext ).getHeight() );
|
|
734
691
|
}
|
|
735
692
|
|
|
736
693
|
// MRECS
|
|
737
694
|
|
|
738
|
-
@ReactMethod
|
|
739
695
|
public void createMRec(final String adUnitId, final String mrecPosition)
|
|
740
696
|
{
|
|
741
697
|
if ( sdk == null )
|
|
@@ -747,8 +703,7 @@ public class AppLovinMAXModule
|
|
|
747
703
|
createAdView( adUnitId, MaxAdFormat.MREC, mrecPosition, DEFAULT_AD_VIEW_OFFSET );
|
|
748
704
|
}
|
|
749
705
|
|
|
750
|
-
@
|
|
751
|
-
public void setMRecPlacement(final String adUnitId, final String placement)
|
|
706
|
+
public void setMRecPlacement(final String adUnitId, @Nullable final String placement)
|
|
752
707
|
{
|
|
753
708
|
if ( sdk == null )
|
|
754
709
|
{
|
|
@@ -759,8 +714,7 @@ public class AppLovinMAXModule
|
|
|
759
714
|
setAdViewPlacement( adUnitId, MaxAdFormat.MREC, placement );
|
|
760
715
|
}
|
|
761
716
|
|
|
762
|
-
@
|
|
763
|
-
public void setMRecCustomData(final String adUnitId, final String customData)
|
|
717
|
+
public void setMRecCustomData(final String adUnitId, @Nullable final String customData)
|
|
764
718
|
{
|
|
765
719
|
if ( sdk == null )
|
|
766
720
|
{
|
|
@@ -771,7 +725,6 @@ public class AppLovinMAXModule
|
|
|
771
725
|
setAdViewCustomData( adUnitId, MaxAdFormat.MREC, customData );
|
|
772
726
|
}
|
|
773
727
|
|
|
774
|
-
@ReactMethod
|
|
775
728
|
public void updateMRecPosition(final String adUnitId, final String mrecPosition)
|
|
776
729
|
{
|
|
777
730
|
if ( sdk == null )
|
|
@@ -783,20 +736,17 @@ public class AppLovinMAXModule
|
|
|
783
736
|
updateAdViewPosition( adUnitId, mrecPosition, DEFAULT_AD_VIEW_OFFSET, MaxAdFormat.MREC );
|
|
784
737
|
}
|
|
785
738
|
|
|
786
|
-
@
|
|
787
|
-
public void setMRecExtraParameter(final String adUnitId, final String key, final String value)
|
|
739
|
+
public void setMRecExtraParameter(final String adUnitId, final String key, @Nullable final String value)
|
|
788
740
|
{
|
|
789
741
|
setAdViewExtraParameters( adUnitId, MaxAdFormat.MREC, key, value );
|
|
790
742
|
}
|
|
791
743
|
|
|
792
|
-
@ReactMethod
|
|
793
744
|
public void setMRecLocalExtraParameter(final String adUnitId, final ReadableMap parameterMap)
|
|
794
745
|
{
|
|
795
746
|
Map.Entry<String, Object> entry = parameterMap.getEntryIterator().next();
|
|
796
747
|
setAdViewLocalExtraParameters( adUnitId, MaxAdFormat.MREC, entry.getKey(), entry.getValue() );
|
|
797
748
|
}
|
|
798
749
|
|
|
799
|
-
@ReactMethod
|
|
800
750
|
public void startMRecAutoRefresh(final String adUnitId)
|
|
801
751
|
{
|
|
802
752
|
if ( sdk == null )
|
|
@@ -808,7 +758,6 @@ public class AppLovinMAXModule
|
|
|
808
758
|
startAutoRefresh( adUnitId, MaxAdFormat.MREC );
|
|
809
759
|
}
|
|
810
760
|
|
|
811
|
-
@ReactMethod
|
|
812
761
|
public void stopMRecAutoRefresh(final String adUnitId)
|
|
813
762
|
{
|
|
814
763
|
if ( sdk == null )
|
|
@@ -820,7 +769,6 @@ public class AppLovinMAXModule
|
|
|
820
769
|
stopAutoRefresh( adUnitId, MaxAdFormat.MREC );
|
|
821
770
|
}
|
|
822
771
|
|
|
823
|
-
@ReactMethod
|
|
824
772
|
public void showMRec(final String adUnitId)
|
|
825
773
|
{
|
|
826
774
|
if ( sdk == null )
|
|
@@ -832,7 +780,6 @@ public class AppLovinMAXModule
|
|
|
832
780
|
showAdView( adUnitId, MaxAdFormat.MREC );
|
|
833
781
|
}
|
|
834
782
|
|
|
835
|
-
@ReactMethod
|
|
836
783
|
public void hideMRec(final String adUnitId)
|
|
837
784
|
{
|
|
838
785
|
if ( sdk == null )
|
|
@@ -844,7 +791,6 @@ public class AppLovinMAXModule
|
|
|
844
791
|
hideAdView( adUnitId, MaxAdFormat.MREC );
|
|
845
792
|
}
|
|
846
793
|
|
|
847
|
-
@ReactMethod
|
|
848
794
|
public void destroyMRec(final String adUnitId)
|
|
849
795
|
{
|
|
850
796
|
if ( sdk == null )
|
|
@@ -858,7 +804,6 @@ public class AppLovinMAXModule
|
|
|
858
804
|
|
|
859
805
|
// INTERSTITIALS
|
|
860
806
|
|
|
861
|
-
@ReactMethod
|
|
862
807
|
public void loadInterstitial(final String adUnitId)
|
|
863
808
|
{
|
|
864
809
|
if ( sdk == null )
|
|
@@ -877,7 +822,6 @@ public class AppLovinMAXModule
|
|
|
877
822
|
interstitial.loadAd();
|
|
878
823
|
}
|
|
879
824
|
|
|
880
|
-
@ReactMethod
|
|
881
825
|
public void isInterstitialReady(final String adUnitId, final Promise promise)
|
|
882
826
|
{
|
|
883
827
|
if ( sdk == null )
|
|
@@ -897,8 +841,7 @@ public class AppLovinMAXModule
|
|
|
897
841
|
promise.resolve( interstitial.isReady() );
|
|
898
842
|
}
|
|
899
843
|
|
|
900
|
-
@
|
|
901
|
-
public void showInterstitial(final String adUnitId, final String placement, final String customData)
|
|
844
|
+
public void showInterstitial(final String adUnitId, @Nullable final String placement, @Nullable final String customData)
|
|
902
845
|
{
|
|
903
846
|
if ( sdk == null )
|
|
904
847
|
{
|
|
@@ -916,8 +859,7 @@ public class AppLovinMAXModule
|
|
|
916
859
|
interstitial.showAd( placement, customData );
|
|
917
860
|
}
|
|
918
861
|
|
|
919
|
-
@
|
|
920
|
-
public void setInterstitialExtraParameter(final String adUnitId, final String key, final String value)
|
|
862
|
+
public void setInterstitialExtraParameter(final String adUnitId, final String key, @Nullable final String value)
|
|
921
863
|
{
|
|
922
864
|
if ( sdk == null )
|
|
923
865
|
{
|
|
@@ -931,7 +873,6 @@ public class AppLovinMAXModule
|
|
|
931
873
|
interstitial.setExtraParameter( key, value );
|
|
932
874
|
}
|
|
933
875
|
|
|
934
|
-
@ReactMethod
|
|
935
876
|
public void setInterstitialLocalExtraParameter(final String adUnitId, final ReadableMap parameterMap)
|
|
936
877
|
{
|
|
937
878
|
if ( sdk == null )
|
|
@@ -949,7 +890,6 @@ public class AppLovinMAXModule
|
|
|
949
890
|
|
|
950
891
|
// REWARDED
|
|
951
892
|
|
|
952
|
-
@ReactMethod
|
|
953
893
|
public void loadRewardedAd(final String adUnitId)
|
|
954
894
|
{
|
|
955
895
|
if ( sdk == null )
|
|
@@ -968,7 +908,6 @@ public class AppLovinMAXModule
|
|
|
968
908
|
rewardedAd.loadAd();
|
|
969
909
|
}
|
|
970
910
|
|
|
971
|
-
@ReactMethod
|
|
972
911
|
public void isRewardedAdReady(final String adUnitId, final Promise promise)
|
|
973
912
|
{
|
|
974
913
|
if ( sdk == null )
|
|
@@ -988,8 +927,7 @@ public class AppLovinMAXModule
|
|
|
988
927
|
promise.resolve( rewardedAd.isReady() );
|
|
989
928
|
}
|
|
990
929
|
|
|
991
|
-
@
|
|
992
|
-
public void showRewardedAd(final String adUnitId, final String placement, final String customData)
|
|
930
|
+
public void showRewardedAd(final String adUnitId, @Nullable final String placement, @Nullable final String customData)
|
|
993
931
|
{
|
|
994
932
|
if ( sdk == null )
|
|
995
933
|
{
|
|
@@ -1007,8 +945,7 @@ public class AppLovinMAXModule
|
|
|
1007
945
|
rewardedAd.showAd( placement, customData );
|
|
1008
946
|
}
|
|
1009
947
|
|
|
1010
|
-
@
|
|
1011
|
-
public void setRewardedAdExtraParameter(final String adUnitId, final String key, final String value)
|
|
948
|
+
public void setRewardedAdExtraParameter(final String adUnitId, final String key, @Nullable final String value)
|
|
1012
949
|
{
|
|
1013
950
|
if ( sdk == null )
|
|
1014
951
|
{
|
|
@@ -1022,7 +959,6 @@ public class AppLovinMAXModule
|
|
|
1022
959
|
rewardedAd.setExtraParameter( key, value );
|
|
1023
960
|
}
|
|
1024
961
|
|
|
1025
|
-
@ReactMethod
|
|
1026
962
|
public void setRewardedAdLocalExtraParameter(final String adUnitId, final ReadableMap parameterMap)
|
|
1027
963
|
{
|
|
1028
964
|
if ( sdk == null )
|
|
@@ -1040,7 +976,6 @@ public class AppLovinMAXModule
|
|
|
1040
976
|
|
|
1041
977
|
// APP OPEN AD
|
|
1042
978
|
|
|
1043
|
-
@ReactMethod
|
|
1044
979
|
public void loadAppOpenAd(final String adUnitId)
|
|
1045
980
|
{
|
|
1046
981
|
if ( sdk == null )
|
|
@@ -1053,7 +988,6 @@ public class AppLovinMAXModule
|
|
|
1053
988
|
appOpenAd.loadAd();
|
|
1054
989
|
}
|
|
1055
990
|
|
|
1056
|
-
@ReactMethod
|
|
1057
991
|
public void isAppOpenAdReady(final String adUnitId, final Promise promise)
|
|
1058
992
|
{
|
|
1059
993
|
if ( sdk == null )
|
|
@@ -1067,7 +1001,6 @@ public class AppLovinMAXModule
|
|
|
1067
1001
|
promise.resolve( appOpenAd.isReady() );
|
|
1068
1002
|
}
|
|
1069
1003
|
|
|
1070
|
-
@ReactMethod
|
|
1071
1004
|
public void showAppOpenAd(final String adUnitId, @Nullable final String placement, @Nullable final String customData)
|
|
1072
1005
|
{
|
|
1073
1006
|
if ( sdk == null )
|
|
@@ -1080,8 +1013,7 @@ public class AppLovinMAXModule
|
|
|
1080
1013
|
appOpenAd.showAd( placement, customData );
|
|
1081
1014
|
}
|
|
1082
1015
|
|
|
1083
|
-
@
|
|
1084
|
-
public void setAppOpenAdExtraParameter(final String adUnitId, final String key, final String value)
|
|
1016
|
+
public void setAppOpenAdExtraParameter(final String adUnitId, final String key, @Nullable final String value)
|
|
1085
1017
|
{
|
|
1086
1018
|
if ( sdk == null )
|
|
1087
1019
|
{
|
|
@@ -1093,7 +1025,6 @@ public class AppLovinMAXModule
|
|
|
1093
1025
|
appOpenAd.setExtraParameter( key, value );
|
|
1094
1026
|
}
|
|
1095
1027
|
|
|
1096
|
-
@ReactMethod
|
|
1097
1028
|
public void setAppOpenAdLocalExtraParameter(final String adUnitId, final ReadableMap parameterMap)
|
|
1098
1029
|
{
|
|
1099
1030
|
MaxAppOpenAd appOpenAd = retrieveAppOpenAd( adUnitId );
|
|
@@ -1103,16 +1034,15 @@ public class AppLovinMAXModule
|
|
|
1103
1034
|
|
|
1104
1035
|
// ADVIEW PRELOADING
|
|
1105
1036
|
|
|
1106
|
-
@
|
|
1107
|
-
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormatStr, final String placement, final String customData, final ReadableMap extraParameterMap, final ReadableMap localExtraParameterMap, final Promise promise)
|
|
1037
|
+
public void preloadNativeUIComponentAdView(final String adUnitId, final String adFormatStr, @Nullable final String placement, @Nullable final String customData, @Nullable final ReadableMap extraParameterMap, @Nullable final ReadableMap localExtraParameterMap, final Promise promise)
|
|
1108
1038
|
{
|
|
1109
1039
|
MaxAdFormat adFormat;
|
|
1110
1040
|
|
|
1111
|
-
if (
|
|
1041
|
+
if ( "BANNER".equalsIgnoreCase( adFormatStr ) )
|
|
1112
1042
|
{
|
|
1113
1043
|
adFormat = getDeviceSpecificBannerAdViewAdFormat();
|
|
1114
1044
|
}
|
|
1115
|
-
else if (
|
|
1045
|
+
else if ( "MREC".equalsIgnoreCase( adFormatStr ) )
|
|
1116
1046
|
{
|
|
1117
1047
|
adFormat = MaxAdFormat.MREC;
|
|
1118
1048
|
}
|
|
@@ -1126,20 +1056,20 @@ public class AppLovinMAXModule
|
|
|
1126
1056
|
final Map<String, Object> extraParameters = ( extraParameterMap != null ) ? extraParameterMap.toHashMap() : null;
|
|
1127
1057
|
final Map<String, Object> localExtraParameters = ( localExtraParameterMap != null ) ? localExtraParameterMap.toHashMap() : null;
|
|
1128
1058
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1059
|
+
reactContext.runOnUiQueueThread( () -> AppLovinMAXAdView.preloadNativeUIComponentAdView( adUnitId,
|
|
1060
|
+
finalAdFormat,
|
|
1061
|
+
placement,
|
|
1062
|
+
customData,
|
|
1063
|
+
extraParameters,
|
|
1064
|
+
localExtraParameters,
|
|
1065
|
+
promise,
|
|
1066
|
+
reactContext ) );
|
|
1137
1067
|
}
|
|
1138
1068
|
|
|
1139
|
-
|
|
1069
|
+
|
|
1140
1070
|
public void destroyNativeUIComponentAdView(final int adViewId, final Promise promise)
|
|
1141
1071
|
{
|
|
1142
|
-
|
|
1072
|
+
reactContext.runOnUiQueueThread( () -> AppLovinMAXAdView.destroyNativeUIComponentAdView( adViewId, promise ) );
|
|
1143
1073
|
}
|
|
1144
1074
|
|
|
1145
1075
|
// AD CALLBACKS
|
|
@@ -1419,7 +1349,7 @@ public class AppLovinMAXModule
|
|
|
1419
1349
|
private void createAdView(final String adUnitId, final MaxAdFormat adFormat, final String adViewPosition, final Point adViewOffsetPixels)
|
|
1420
1350
|
{
|
|
1421
1351
|
// Run on main thread to ensure there are no concurrency issues with other ad view methods
|
|
1422
|
-
|
|
1352
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1423
1353
|
|
|
1424
1354
|
d( "Creating " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\", position: \"" + adViewPosition + "\", and offset: " + adViewOffsetPixels );
|
|
1425
1355
|
|
|
@@ -1455,7 +1385,7 @@ public class AppLovinMAXModule
|
|
|
1455
1385
|
|
|
1456
1386
|
private void setAdViewPlacement(final String adUnitId, final MaxAdFormat adFormat, final String placement)
|
|
1457
1387
|
{
|
|
1458
|
-
|
|
1388
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1459
1389
|
|
|
1460
1390
|
d( "Setting placement \"" + placement + "\" for " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1461
1391
|
|
|
@@ -1472,7 +1402,7 @@ public class AppLovinMAXModule
|
|
|
1472
1402
|
|
|
1473
1403
|
private void setAdViewCustomData(final String adUnitId, final MaxAdFormat adFormat, final String customData)
|
|
1474
1404
|
{
|
|
1475
|
-
|
|
1405
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1476
1406
|
|
|
1477
1407
|
d( "Setting custom data \"" + customData + "\" for " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1478
1408
|
|
|
@@ -1489,7 +1419,7 @@ public class AppLovinMAXModule
|
|
|
1489
1419
|
|
|
1490
1420
|
private void setAdViewWidth(final String adUnitId, final int widthDp, final MaxAdFormat adFormat)
|
|
1491
1421
|
{
|
|
1492
|
-
|
|
1422
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1493
1423
|
|
|
1494
1424
|
d( "Setting width " + widthDp + " for \"" + adFormat + "\" with ad unit identifier \"" + adUnitId + "\"" );
|
|
1495
1425
|
|
|
@@ -1506,7 +1436,7 @@ public class AppLovinMAXModule
|
|
|
1506
1436
|
|
|
1507
1437
|
private void updateAdViewPosition(final String adUnitId, final String adViewPosition, final Point offsetPixels, final MaxAdFormat adFormat)
|
|
1508
1438
|
{
|
|
1509
|
-
|
|
1439
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1510
1440
|
|
|
1511
1441
|
d( "Updating " + adFormat.getLabel() + " position to \"" + adViewPosition + "\" for ad unit id \"" + adUnitId + "\"" );
|
|
1512
1442
|
|
|
@@ -1526,7 +1456,7 @@ public class AppLovinMAXModule
|
|
|
1526
1456
|
|
|
1527
1457
|
private void showAdView(final String adUnitId, final MaxAdFormat adFormat)
|
|
1528
1458
|
{
|
|
1529
|
-
|
|
1459
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1530
1460
|
|
|
1531
1461
|
d( "Showing " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1532
1462
|
|
|
@@ -1549,7 +1479,7 @@ public class AppLovinMAXModule
|
|
|
1549
1479
|
|
|
1550
1480
|
private void hideAdView(final String adUnitId, final MaxAdFormat adFormat)
|
|
1551
1481
|
{
|
|
1552
|
-
|
|
1482
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1553
1483
|
|
|
1554
1484
|
d( "Hiding " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1555
1485
|
adUnitIdsToShowAfterCreate.remove( adUnitId );
|
|
@@ -1568,7 +1498,7 @@ public class AppLovinMAXModule
|
|
|
1568
1498
|
|
|
1569
1499
|
private void destroyAdView(final String adUnitId, final MaxAdFormat adFormat)
|
|
1570
1500
|
{
|
|
1571
|
-
|
|
1501
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1572
1502
|
|
|
1573
1503
|
d( "Destroying " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1574
1504
|
|
|
@@ -1599,7 +1529,7 @@ public class AppLovinMAXModule
|
|
|
1599
1529
|
|
|
1600
1530
|
private void setAdViewBackgroundColor(final String adUnitId, final MaxAdFormat adFormat, final String hexColorCode)
|
|
1601
1531
|
{
|
|
1602
|
-
|
|
1532
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1603
1533
|
|
|
1604
1534
|
d( "Setting " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\" to color: " + hexColorCode );
|
|
1605
1535
|
|
|
@@ -1616,7 +1546,7 @@ public class AppLovinMAXModule
|
|
|
1616
1546
|
|
|
1617
1547
|
private void setAdViewExtraParameters(final String adUnitId, final MaxAdFormat adFormat, final String key, final String value)
|
|
1618
1548
|
{
|
|
1619
|
-
|
|
1549
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1620
1550
|
|
|
1621
1551
|
d( "Setting " + adFormat.getLabel() + " extra with key: \"" + key + "\" value: " + value );
|
|
1622
1552
|
|
|
@@ -1667,7 +1597,7 @@ public class AppLovinMAXModule
|
|
|
1667
1597
|
|
|
1668
1598
|
private void setAdViewLocalExtraParameters(final String adUnitId, final MaxAdFormat adFormat, final String key, final Object value)
|
|
1669
1599
|
{
|
|
1670
|
-
|
|
1600
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1671
1601
|
|
|
1672
1602
|
d( "Setting " + adFormat.getLabel() + " local extra with key: \"" + key + "\" value: " + value );
|
|
1673
1603
|
|
|
@@ -1685,7 +1615,7 @@ public class AppLovinMAXModule
|
|
|
1685
1615
|
|
|
1686
1616
|
private void startAutoRefresh(final String adUnitId, final MaxAdFormat adFormat)
|
|
1687
1617
|
{
|
|
1688
|
-
|
|
1618
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1689
1619
|
|
|
1690
1620
|
d( "Starting auto refresh " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1691
1621
|
|
|
@@ -1702,7 +1632,7 @@ public class AppLovinMAXModule
|
|
|
1702
1632
|
|
|
1703
1633
|
private void stopAutoRefresh(final String adUnitId, final MaxAdFormat adFormat)
|
|
1704
1634
|
{
|
|
1705
|
-
|
|
1635
|
+
reactContext.runOnUiQueueThread( () -> {
|
|
1706
1636
|
|
|
1707
1637
|
d( "Stopping auto refresh " + adFormat.getLabel() + " with ad unit id \"" + adUnitId + "\"" );
|
|
1708
1638
|
|
|
@@ -1724,7 +1654,7 @@ public class AppLovinMAXModule
|
|
|
1724
1654
|
final Activity currentActivity = maybeGetCurrentActivity();
|
|
1725
1655
|
if ( currentActivity != null )
|
|
1726
1656
|
{
|
|
1727
|
-
final RelativeLayout relativeLayout = new RelativeLayout(
|
|
1657
|
+
final RelativeLayout relativeLayout = new RelativeLayout( reactContext );
|
|
1728
1658
|
relativeLayout.addView( adView );
|
|
1729
1659
|
|
|
1730
1660
|
currentActivity.addContentView( relativeLayout, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT,
|
|
@@ -1804,7 +1734,7 @@ public class AppLovinMAXModule
|
|
|
1804
1734
|
MaxAdView result = adViews.get( adUnitId );
|
|
1805
1735
|
if ( result == null && adViewPosition != null && adViewOffsetPixels != null )
|
|
1806
1736
|
{
|
|
1807
|
-
result = new MaxAdView( adUnitId, adFormat, sdk,
|
|
1737
|
+
result = new MaxAdView( adUnitId, adFormat, sdk, reactContext );
|
|
1808
1738
|
result.setListener( this );
|
|
1809
1739
|
result.setRevenueListener( this );
|
|
1810
1740
|
|
|
@@ -1862,7 +1792,7 @@ public class AppLovinMAXModule
|
|
|
1862
1792
|
else if ( TOP_CENTER.equalsIgnoreCase( adViewPosition ) || BOTTOM_CENTER.equalsIgnoreCase( adViewPosition ) )
|
|
1863
1793
|
{
|
|
1864
1794
|
int adViewWidthPx = windowRect.width();
|
|
1865
|
-
adViewWidthDp = AppLovinSdkUtils.pxToDp(
|
|
1795
|
+
adViewWidthDp = AppLovinSdkUtils.pxToDp( reactContext, adViewWidthPx );
|
|
1866
1796
|
}
|
|
1867
1797
|
// Else use standard widths of 320, 728, or 300
|
|
1868
1798
|
else
|
|
@@ -1877,15 +1807,15 @@ public class AppLovinMAXModule
|
|
|
1877
1807
|
|
|
1878
1808
|
if ( ( adFormat == MaxAdFormat.BANNER || adFormat == MaxAdFormat.LEADER ) && !isAdaptiveBannerDisabled )
|
|
1879
1809
|
{
|
|
1880
|
-
adViewHeightDp = adFormat.getAdaptiveSize( adViewWidthDp,
|
|
1810
|
+
adViewHeightDp = adFormat.getAdaptiveSize( adViewWidthDp, reactContext ).getHeight();
|
|
1881
1811
|
}
|
|
1882
1812
|
else
|
|
1883
1813
|
{
|
|
1884
1814
|
adViewHeightDp = adFormat.getSize().getHeight();
|
|
1885
1815
|
}
|
|
1886
1816
|
|
|
1887
|
-
final int widthPx = AppLovinSdkUtils.dpToPx(
|
|
1888
|
-
final int heightPx = AppLovinSdkUtils.dpToPx(
|
|
1817
|
+
final int widthPx = AppLovinSdkUtils.dpToPx( reactContext, adViewWidthDp );
|
|
1818
|
+
final int heightPx = AppLovinSdkUtils.dpToPx( reactContext, adViewHeightDp );
|
|
1889
1819
|
|
|
1890
1820
|
final RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) adView.getLayoutParams();
|
|
1891
1821
|
params.height = heightPx;
|
|
@@ -2007,7 +1937,7 @@ public class AppLovinMAXModule
|
|
|
2007
1937
|
|
|
2008
1938
|
private MaxAdFormat getDeviceSpecificBannerAdViewAdFormat()
|
|
2009
1939
|
{
|
|
2010
|
-
return getDeviceSpecificBannerAdViewAdFormat(
|
|
1940
|
+
return getDeviceSpecificBannerAdViewAdFormat( reactContext );
|
|
2011
1941
|
}
|
|
2012
1942
|
|
|
2013
1943
|
public static MaxAdFormat getDeviceSpecificBannerAdViewAdFormat(final Context context)
|
|
@@ -2301,28 +2231,51 @@ public class AppLovinMAXModule
|
|
|
2301
2231
|
rewardedAds.clear();
|
|
2302
2232
|
}
|
|
2303
2233
|
|
|
2304
|
-
// Required methods introduced React Native 0.65
|
|
2305
|
-
//
|
|
2306
|
-
// Without these methods, the following warnings are generated.
|
|
2307
|
-
//
|
|
2308
|
-
// WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method.
|
|
2309
|
-
// WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.
|
|
2310
|
-
@ReactMethod
|
|
2311
|
-
public void addListener(String eventName) { }
|
|
2312
|
-
|
|
2313
|
-
@ReactMethod
|
|
2314
|
-
public void removeListeners(Integer count) { }
|
|
2315
|
-
|
|
2316
2234
|
// React Native Bridge
|
|
2317
2235
|
|
|
2318
2236
|
public void sendReactNativeEvent(final String name, @Nullable final WritableMap params)
|
|
2319
2237
|
{
|
|
2320
|
-
|
|
2238
|
+
reactContext
|
|
2321
2239
|
.getJSModule( RCTDeviceEventEmitter.class )
|
|
2322
2240
|
.emit( name, params );
|
|
2323
2241
|
}
|
|
2324
2242
|
|
|
2325
|
-
|
|
2243
|
+
public void sendReactNativeViewEvent(final int surfaceId, final int viewId, final String eventName, final WritableMap payload)
|
|
2244
|
+
{
|
|
2245
|
+
EventDispatcher eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag( reactContext, viewId );
|
|
2246
|
+
if ( eventDispatcher != null )
|
|
2247
|
+
{
|
|
2248
|
+
eventDispatcher.dispatchEvent( new OnViewEvent( surfaceId, viewId, eventName, payload ) );
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
private class OnViewEvent
|
|
2253
|
+
extends Event<OnViewEvent>
|
|
2254
|
+
{
|
|
2255
|
+
private final WritableMap payload;
|
|
2256
|
+
private final String eventName;
|
|
2257
|
+
|
|
2258
|
+
OnViewEvent(final int surfaceId, final int viewId, final String eventName, @Nullable final WritableMap payload)
|
|
2259
|
+
{
|
|
2260
|
+
super( surfaceId, viewId );
|
|
2261
|
+
this.eventName = eventName;
|
|
2262
|
+
this.payload = payload;
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
@Override
|
|
2266
|
+
public String getEventName()
|
|
2267
|
+
{
|
|
2268
|
+
return eventName;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
@Nullable
|
|
2272
|
+
@Override
|
|
2273
|
+
protected WritableMap getEventData()
|
|
2274
|
+
{
|
|
2275
|
+
return payload;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2326
2279
|
@Nullable
|
|
2327
2280
|
public Map<String, Object> getConstants()
|
|
2328
2281
|
{
|
|
@@ -2370,19 +2323,6 @@ public class AppLovinMAXModule
|
|
|
2370
2323
|
constants.put( "ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT", AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT );
|
|
2371
2324
|
constants.put( "ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT", AppLovinMAXAdEvents.ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT );
|
|
2372
2325
|
|
|
2373
|
-
constants.put( "TOP_CENTER_POSITION", TOP_CENTER );
|
|
2374
|
-
constants.put( "TOP_LEFT_POSITION", TOP_LEFT );
|
|
2375
|
-
constants.put( "TOP_RIGHT_POSITION", TOP_RIGHT );
|
|
2376
|
-
constants.put( "CENTERED_POSITION", CENTERED );
|
|
2377
|
-
constants.put( "CENTER_LEFT_POSITION", CENTER_LEFT );
|
|
2378
|
-
constants.put( "CENTER_RIGHT_POSITION", CENTER_RIGHT );
|
|
2379
|
-
constants.put( "BOTTOM_LEFT_POSITION", BOTTOM_LEFT );
|
|
2380
|
-
constants.put( "BOTTOM_CENTER_POSITION", BOTTOM_CENTER );
|
|
2381
|
-
constants.put( "BOTTOM_RIGHT_POSITION", BOTTOM_RIGHT );
|
|
2382
|
-
|
|
2383
|
-
constants.put( "BANNER_AD_FORMAT_LABEL", MaxAdFormat.BANNER.getLabel() );
|
|
2384
|
-
constants.put( "MREC_AD_FORMAT_LABEL", MaxAdFormat.MREC.getLabel() );
|
|
2385
|
-
|
|
2386
2326
|
constants.put( "MAX_ERROR_CODE_UNSPECIFIED", MaxErrorCode.UNSPECIFIED );
|
|
2387
2327
|
constants.put( "MAX_ERROR_CODE_NO_FILL", MaxErrorCode.NO_FILL );
|
|
2388
2328
|
constants.put( "MAX_ERROR_CODE_AD_LOAD_FAILED", MaxErrorCode.AD_LOAD_FAILED );
|
|
@@ -2449,5 +2389,4 @@ public class AppLovinMAXModule
|
|
|
2449
2389
|
|
|
2450
2390
|
return versionCode;
|
|
2451
2391
|
}
|
|
2452
|
-
|
|
2453
2392
|
}
|