react-native-applovin-max 3.3.0 → 3.3.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 +4 -4
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +162 -61
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +22 -165
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +12 -6
- package/ios/AppLovinMAX.h +5 -0
- package/ios/AppLovinMAX.m +2 -2
- package/ios/AppLovinMAX.xcodeproj/project.pbxproj +6 -0
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +24 -0
- package/ios/AppLovinMAXAdView.h +9 -0
- package/ios/AppLovinMAXAdView.m +190 -0
- package/ios/AppLovinMAXAdViewManager.m +10 -280
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +5 -5
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AppLovinMAXAdView.js +35 -142
- package/src/index.js +1 -1
package/android/build.gradle
CHANGED
|
@@ -16,7 +16,7 @@ buildscript {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
dependencies {
|
|
19
|
-
classpath 'com.android.tools.build:gradle:3.5.
|
|
19
|
+
classpath 'com.android.tools.build:gradle:3.5.4'
|
|
20
20
|
// noinspection DifferentKotlinGradleVersion
|
|
21
21
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
22
22
|
|
|
@@ -41,8 +41,8 @@ android {
|
|
|
41
41
|
defaultConfig {
|
|
42
42
|
minSdkVersion 16
|
|
43
43
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
44
|
-
versionCode
|
|
45
|
-
versionName "3.3.
|
|
44
|
+
versionCode 3030100
|
|
45
|
+
versionName "3.3.1"
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
flavorDimensions("default")
|
|
@@ -150,5 +150,5 @@ dependencies {
|
|
|
150
150
|
|
|
151
151
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
152
152
|
|
|
153
|
-
implementation 'com.applovin:applovin-sdk:11.
|
|
153
|
+
implementation 'com.applovin:applovin-sdk:11.5.1'
|
|
154
154
|
}
|
|
@@ -19,9 +19,14 @@ class AppLovinMAXAdView
|
|
|
19
19
|
{
|
|
20
20
|
private final ThemedReactContext reactContext;
|
|
21
21
|
|
|
22
|
-
private MaxAdView adView;
|
|
23
|
-
|
|
24
|
-
private
|
|
22
|
+
private @Nullable MaxAdView adView;
|
|
23
|
+
|
|
24
|
+
private String adUnitId;
|
|
25
|
+
private MaxAdFormat adFormat;
|
|
26
|
+
private @Nullable String placement;
|
|
27
|
+
private @Nullable String customData;
|
|
28
|
+
private boolean adaptiveBannerEnabled;
|
|
29
|
+
private boolean autoRefresh;
|
|
25
30
|
|
|
26
31
|
public AppLovinMAXAdView(final Context context)
|
|
27
32
|
{
|
|
@@ -29,6 +34,93 @@ class AppLovinMAXAdView
|
|
|
29
34
|
this.reactContext = (ThemedReactContext) context;
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
public void setAdUnitId(final String value)
|
|
38
|
+
{
|
|
39
|
+
// Ad Unit ID must be set prior to creating MaxAdView
|
|
40
|
+
if ( adView != null )
|
|
41
|
+
{
|
|
42
|
+
AppLovinMAXModule.e( "Attempting to set Ad Unit ID " + value + " after MaxAdView is created" );
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
adUnitId = value;
|
|
47
|
+
|
|
48
|
+
maybeAttachAdView();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public void setAdFormat(final String value)
|
|
52
|
+
{
|
|
53
|
+
// Ad format must be set prior to creating MaxAdView
|
|
54
|
+
if ( adView != null )
|
|
55
|
+
{
|
|
56
|
+
AppLovinMAXModule.e( "Attempting to set ad format " + value + " after MaxAdView is created" );
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if ( "banner".equals( value ) )
|
|
61
|
+
{
|
|
62
|
+
adFormat = AppLovinMAXModule.getDeviceSpecificBannerAdViewAdFormat( reactContext );
|
|
63
|
+
}
|
|
64
|
+
else if ( "mrec".equals( value ) )
|
|
65
|
+
{
|
|
66
|
+
adFormat = MaxAdFormat.MREC;
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
{
|
|
70
|
+
AppLovinMAXModule.e( "Attempting to set an invalid ad format of \"" + value + "\" for " + adUnitId );
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
maybeAttachAdView();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public void setPlacement(@Nullable final String value)
|
|
78
|
+
{
|
|
79
|
+
placement = value;
|
|
80
|
+
|
|
81
|
+
if ( adView != null )
|
|
82
|
+
{
|
|
83
|
+
adView.setPlacement( placement );
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public void setCustomData(@Nullable final String value)
|
|
88
|
+
{
|
|
89
|
+
customData = value;
|
|
90
|
+
|
|
91
|
+
if ( adView != null )
|
|
92
|
+
{
|
|
93
|
+
adView.setCustomData( customData );
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public void setAdaptiveBannerEnabled(final boolean enabled)
|
|
98
|
+
{
|
|
99
|
+
adaptiveBannerEnabled = enabled;
|
|
100
|
+
|
|
101
|
+
if ( adView != null )
|
|
102
|
+
{
|
|
103
|
+
adView.setExtraParameter( "adaptive_banner", Boolean.toString( enabled ) );
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public void setAutoRefresh(final boolean enabled)
|
|
108
|
+
{
|
|
109
|
+
autoRefresh = enabled;
|
|
110
|
+
|
|
111
|
+
if ( adView != null )
|
|
112
|
+
{
|
|
113
|
+
if ( autoRefresh )
|
|
114
|
+
{
|
|
115
|
+
adView.startAutoRefresh();
|
|
116
|
+
}
|
|
117
|
+
else
|
|
118
|
+
{
|
|
119
|
+
adView.stopAutoRefresh();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
32
124
|
@Override
|
|
33
125
|
public void requestLayout()
|
|
34
126
|
{
|
|
@@ -38,6 +130,9 @@ class AppLovinMAXAdView
|
|
|
38
130
|
// This is required to ensure ad refreshes render correctly in RN Android due to known issue where `getWidth()` and `getHeight()` return 0 on attach
|
|
39
131
|
if ( adView != null )
|
|
40
132
|
{
|
|
133
|
+
int currentWidthPx = getWidth();
|
|
134
|
+
int currentHeightPx = getHeight();
|
|
135
|
+
|
|
41
136
|
adView.measure(
|
|
42
137
|
MeasureSpec.makeMeasureSpec( currentWidthPx, MeasureSpec.EXACTLY ),
|
|
43
138
|
MeasureSpec.makeMeasureSpec( currentHeightPx, MeasureSpec.EXACTLY )
|
|
@@ -68,13 +163,7 @@ class AppLovinMAXAdView
|
|
|
68
163
|
}
|
|
69
164
|
}
|
|
70
165
|
|
|
71
|
-
|
|
72
|
-
protected MaxAdView getAdView()
|
|
73
|
-
{
|
|
74
|
-
return adView;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public void maybeAttachAdView(final String placement, final String customData, final String adaptiveBannerEnabledStr, final Boolean autoRefreshEnabled, final String adUnitId, final MaxAdFormat adFormat)
|
|
166
|
+
private void maybeAttachAdView()
|
|
78
167
|
{
|
|
79
168
|
final Activity currentActivity = reactContext.getCurrentActivity();
|
|
80
169
|
if ( currentActivity == null )
|
|
@@ -83,58 +172,70 @@ class AppLovinMAXAdView
|
|
|
83
172
|
return;
|
|
84
173
|
}
|
|
85
174
|
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
175
|
+
// Re-assign in case of race condition
|
|
176
|
+
final String adUnitId = this.adUnitId;
|
|
177
|
+
final MaxAdFormat adFormat = this.adFormat;
|
|
178
|
+
|
|
179
|
+
// Run after 0.25 sec delay to allow all properties to set
|
|
180
|
+
postDelayed( () -> {
|
|
181
|
+
|
|
182
|
+
if ( TextUtils.isEmpty( adUnitId ) )
|
|
183
|
+
{
|
|
184
|
+
AppLovinMAXModule.e( "Attempting to attach MaxAdView without Ad Unit ID" );
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if ( adFormat == null )
|
|
189
|
+
{
|
|
190
|
+
AppLovinMAXModule.e( "Attempting to attach MaxAdView without ad format" );
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if ( adView != null )
|
|
195
|
+
{
|
|
196
|
+
AppLovinMAXModule.e( "Attempting to re-attach with existing MaxAdView: " + adView );
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
AppLovinMAXModule.d( "Attaching MaxAdView for " + adUnitId );
|
|
201
|
+
|
|
202
|
+
adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), currentActivity );
|
|
203
|
+
adView.setListener( AppLovinMAXModule.getInstance() );
|
|
204
|
+
adView.setRevenueListener( AppLovinMAXModule.getInstance() );
|
|
205
|
+
adView.setPlacement( placement );
|
|
206
|
+
adView.setCustomData( customData );
|
|
207
|
+
adView.setExtraParameter( "adaptive_banner", Boolean.toString( adaptiveBannerEnabled ) );
|
|
208
|
+
// Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
|
|
209
|
+
adView.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" );
|
|
210
|
+
|
|
211
|
+
if ( autoRefresh )
|
|
212
|
+
{
|
|
213
|
+
adView.startAutoRefresh();
|
|
214
|
+
}
|
|
215
|
+
else
|
|
91
216
|
{
|
|
92
|
-
|
|
93
|
-
if ( !TextUtils.isEmpty( adUnitId ) && adFormat != null )
|
|
94
|
-
{
|
|
95
|
-
// NOTE: AppLovinMAXModule.getInstance().getSdk() may be null
|
|
96
|
-
adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), currentActivity );
|
|
97
|
-
adView.setListener( AppLovinMAXModule.getInstance() );
|
|
98
|
-
adView.setRevenueListener( AppLovinMAXModule.getInstance() );
|
|
99
|
-
|
|
100
|
-
if ( placement != null )
|
|
101
|
-
{
|
|
102
|
-
adView.setPlacement( placement );
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if ( customData != null )
|
|
106
|
-
{
|
|
107
|
-
adView.setCustomData( customData );
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if ( adaptiveBannerEnabledStr != null )
|
|
111
|
-
{
|
|
112
|
-
adView.setExtraParameter( "adaptive_banner", adaptiveBannerEnabledStr );
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
|
|
116
|
-
adView.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" );
|
|
117
|
-
|
|
118
|
-
if ( autoRefreshEnabled != null )
|
|
119
|
-
{
|
|
120
|
-
if ( autoRefreshEnabled.booleanValue() )
|
|
121
|
-
{
|
|
122
|
-
adView.startAutoRefresh();
|
|
123
|
-
}
|
|
124
|
-
else
|
|
125
|
-
{
|
|
126
|
-
adView.stopAutoRefresh();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
adView.loadAd();
|
|
131
|
-
|
|
132
|
-
currentWidthPx = getWidth();
|
|
133
|
-
currentHeightPx = getHeight();
|
|
134
|
-
|
|
135
|
-
addView( adView );
|
|
136
|
-
}
|
|
217
|
+
adView.stopAutoRefresh();
|
|
137
218
|
}
|
|
138
|
-
|
|
219
|
+
|
|
220
|
+
adView.loadAd();
|
|
221
|
+
|
|
222
|
+
addView( adView );
|
|
223
|
+
}, 250 );
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
public void destroy()
|
|
227
|
+
{
|
|
228
|
+
if ( adView != null )
|
|
229
|
+
{
|
|
230
|
+
AppLovinMAXModule.d( "Unmounting MaxAdView: " + adView );
|
|
231
|
+
|
|
232
|
+
removeView( adView );
|
|
233
|
+
|
|
234
|
+
adView.setListener( null );
|
|
235
|
+
adView.setRevenueListener( null );
|
|
236
|
+
adView.destroy();
|
|
237
|
+
|
|
238
|
+
adView = null;
|
|
239
|
+
}
|
|
139
240
|
}
|
|
140
241
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
package com.applovin.reactnative;
|
|
2
2
|
|
|
3
|
-
import com.applovin.mediation.MaxAdFormat;
|
|
4
|
-
import com.applovin.mediation.ads.MaxAdView;
|
|
5
3
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
7
4
|
import com.facebook.react.uimanager.SimpleViewManager;
|
|
8
5
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
6
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
9
7
|
|
|
10
8
|
import org.jetbrains.annotations.NotNull;
|
|
11
9
|
|
|
12
|
-
import java.util.HashMap;
|
|
13
|
-
import java.util.Map;
|
|
14
|
-
|
|
15
|
-
import androidx.annotation.NonNull;
|
|
16
10
|
import androidx.annotation.Nullable;
|
|
17
11
|
|
|
18
12
|
/**
|
|
@@ -21,200 +15,63 @@ import androidx.annotation.Nullable;
|
|
|
21
15
|
class AppLovinMAXAdViewManager
|
|
22
16
|
extends SimpleViewManager<AppLovinMAXAdView>
|
|
23
17
|
{
|
|
24
|
-
|
|
25
|
-
private final ReactApplicationContext reactApplicationContext;
|
|
26
|
-
|
|
27
|
-
// Maps from the view to the corresponding ad unit id and ad format.
|
|
28
|
-
// Both must be set before the MaxAdView is created.
|
|
29
|
-
private final Map<AppLovinMAXAdView, String> adUnitIdRegistry = new HashMap<>();
|
|
30
|
-
private final Map<AppLovinMAXAdView, MaxAdFormat> adFormatRegistry = new HashMap<>();
|
|
31
|
-
|
|
32
|
-
// Storage for placement and extra parameters if set before the MAAdView is created
|
|
33
|
-
private final Map<AppLovinMAXAdView, String> placementRegistry = new HashMap<>();
|
|
34
|
-
private final Map<AppLovinMAXAdView, String> customDataRegistry = new HashMap<>();
|
|
35
|
-
private final Map<AppLovinMAXAdView, String> adaptiveBannerEnabledRegistry = new HashMap<>();
|
|
36
|
-
private final Map<AppLovinMAXAdView, Boolean> autoRefreshEnabledRegistry = new HashMap<>();
|
|
37
|
-
|
|
38
|
-
public AppLovinMAXAdViewManager(final ReactApplicationContext reactApplicationContext)
|
|
39
|
-
{
|
|
40
|
-
this.reactApplicationContext = reactApplicationContext;
|
|
41
|
-
}
|
|
18
|
+
public AppLovinMAXAdViewManager(final ReactApplicationContext reactApplicationContext) { }
|
|
42
19
|
|
|
20
|
+
@NotNull
|
|
43
21
|
@Override
|
|
44
|
-
public
|
|
22
|
+
public String getName()
|
|
45
23
|
{
|
|
46
24
|
return "AppLovinMAXAdView";
|
|
47
25
|
}
|
|
48
26
|
|
|
27
|
+
@NotNull
|
|
49
28
|
@Override
|
|
50
|
-
protected
|
|
29
|
+
protected AppLovinMAXAdView createViewInstance(@NotNull final ThemedReactContext reactContext)
|
|
51
30
|
{
|
|
52
31
|
// NOTE: Do not set frame or backgroundColor as RN will overwrite the values set by your custom class in order to match your JavaScript component's layout props - hence wrapper
|
|
53
32
|
return new AppLovinMAXAdView( reactContext );
|
|
54
33
|
}
|
|
55
34
|
|
|
56
|
-
@
|
|
57
|
-
public void
|
|
35
|
+
@ReactProp(name = "placement")
|
|
36
|
+
public void setPlacement(final AppLovinMAXAdView view, @Nullable final String placement)
|
|
58
37
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if ( "setAutoRefresh".equals( commandId ) )
|
|
62
|
-
{
|
|
63
|
-
setAutoRefresh( view, args.getBoolean( 0 ) );
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
String arg = args.getString( 0 );
|
|
68
|
-
if ( arg == null ) return;
|
|
69
|
-
|
|
70
|
-
if ( "setPlacement".equals( commandId ) )
|
|
71
|
-
{
|
|
72
|
-
setPlacement( view, arg );
|
|
73
|
-
}
|
|
74
|
-
else if ( "setAdaptiveBannerEnabled".equals( commandId ) )
|
|
75
|
-
{
|
|
76
|
-
setAdaptiveBannerEnabled( view, arg );
|
|
77
|
-
}
|
|
78
|
-
else if ( "setCustomData".equals( commandId ) )
|
|
79
|
-
{
|
|
80
|
-
setCustomData( view, arg );
|
|
81
|
-
}
|
|
82
|
-
else if ( "setAdUnitId".equals( commandId ) )
|
|
83
|
-
{
|
|
84
|
-
setAdUnitId( view, arg );
|
|
85
|
-
}
|
|
86
|
-
else if ( "setAdFormat".equals( commandId ) )
|
|
87
|
-
{
|
|
88
|
-
setAdFormat( view, arg );
|
|
89
|
-
}
|
|
90
|
-
else
|
|
91
|
-
{
|
|
92
|
-
AppLovinMAXModule.e( "Unable to parse command: " + commandId + " for AdView: + " + view + " with args: " + args );
|
|
93
|
-
}
|
|
38
|
+
view.setPlacement( placement );
|
|
94
39
|
}
|
|
95
40
|
|
|
96
|
-
|
|
41
|
+
@ReactProp(name = "customData")
|
|
42
|
+
public void setCustomData(final AppLovinMAXAdView view, @Nullable final String customData)
|
|
97
43
|
{
|
|
98
|
-
|
|
99
|
-
view.post( () -> {
|
|
100
|
-
|
|
101
|
-
MaxAdView adView = view.getAdView();
|
|
102
|
-
if ( adView != null )
|
|
103
|
-
{
|
|
104
|
-
adView.setPlacement( placement );
|
|
105
|
-
}
|
|
106
|
-
else
|
|
107
|
-
{
|
|
108
|
-
placementRegistry.put( view, placement );
|
|
109
|
-
}
|
|
110
|
-
} );
|
|
44
|
+
view.setCustomData( customData );
|
|
111
45
|
}
|
|
112
46
|
|
|
113
|
-
|
|
47
|
+
@ReactProp(name = "adaptiveBannerEnabled")
|
|
48
|
+
public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final boolean enabled)
|
|
114
49
|
{
|
|
115
|
-
|
|
116
|
-
view.post( () -> {
|
|
117
|
-
|
|
118
|
-
MaxAdView adView = view.getAdView();
|
|
119
|
-
if ( adView != null )
|
|
120
|
-
{
|
|
121
|
-
adView.setCustomData( customData );
|
|
122
|
-
}
|
|
123
|
-
else
|
|
124
|
-
{
|
|
125
|
-
customDataRegistry.put( view, customData );
|
|
126
|
-
}
|
|
127
|
-
} );
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final String enabledStr)
|
|
131
|
-
{
|
|
132
|
-
// Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
|
|
133
|
-
view.post( () -> {
|
|
134
|
-
|
|
135
|
-
MaxAdView adView = view.getAdView();
|
|
136
|
-
if ( adView != null )
|
|
137
|
-
{
|
|
138
|
-
adView.setExtraParameter( "adaptive_banner", enabledStr );
|
|
139
|
-
}
|
|
140
|
-
else
|
|
141
|
-
{
|
|
142
|
-
adaptiveBannerEnabledRegistry.put( view, enabledStr );
|
|
143
|
-
}
|
|
144
|
-
} );
|
|
50
|
+
view.setAdaptiveBannerEnabled( enabled );
|
|
145
51
|
}
|
|
146
52
|
|
|
53
|
+
@ReactProp(name = "autoRefresh")
|
|
147
54
|
public void setAutoRefresh(final AppLovinMAXAdView view, final boolean enabled)
|
|
148
55
|
{
|
|
149
|
-
|
|
150
|
-
view.post( () -> {
|
|
151
|
-
|
|
152
|
-
MaxAdView adView = view.getAdView();
|
|
153
|
-
if ( adView != null )
|
|
154
|
-
{
|
|
155
|
-
if ( enabled )
|
|
156
|
-
{
|
|
157
|
-
adView.startAutoRefresh();
|
|
158
|
-
}
|
|
159
|
-
else
|
|
160
|
-
{
|
|
161
|
-
adView.stopAutoRefresh();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else
|
|
165
|
-
{
|
|
166
|
-
autoRefreshEnabledRegistry.put( view, enabled );
|
|
167
|
-
}
|
|
168
|
-
} );
|
|
56
|
+
view.setAutoRefresh( enabled );
|
|
169
57
|
}
|
|
170
58
|
|
|
59
|
+
@ReactProp(name = "adUnitId")
|
|
171
60
|
public void setAdUnitId(final AppLovinMAXAdView view, final String adUnitId)
|
|
172
61
|
{
|
|
173
|
-
|
|
174
|
-
maybeAttachAdView( view );
|
|
62
|
+
view.setAdUnitId( adUnitId );
|
|
175
63
|
}
|
|
176
64
|
|
|
65
|
+
@ReactProp(name = "adFormat")
|
|
177
66
|
public void setAdFormat(final AppLovinMAXAdView view, final String adFormatStr)
|
|
178
67
|
{
|
|
179
|
-
|
|
180
|
-
{
|
|
181
|
-
adFormatRegistry.put( view, AppLovinMAXModule.getDeviceSpecificBannerAdViewAdFormat( reactApplicationContext ) );
|
|
182
|
-
}
|
|
183
|
-
else if ( "mrec".equals( adFormatStr ) )
|
|
184
|
-
{
|
|
185
|
-
adFormatRegistry.put( view, MaxAdFormat.MREC );
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
maybeAttachAdView( view );
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
private void maybeAttachAdView(final AppLovinMAXAdView view)
|
|
192
|
-
{
|
|
193
|
-
String placement = placementRegistry.remove( view );
|
|
194
|
-
String customData = customDataRegistry.remove( view );
|
|
195
|
-
String adaptiveBannerEnabledStr = adaptiveBannerEnabledRegistry.remove( view );
|
|
196
|
-
Boolean autoRefreshEnabled = autoRefreshEnabledRegistry.remove( view );
|
|
197
|
-
|
|
198
|
-
view.maybeAttachAdView( placement,
|
|
199
|
-
customData,
|
|
200
|
-
adaptiveBannerEnabledStr,
|
|
201
|
-
autoRefreshEnabled,
|
|
202
|
-
adUnitIdRegistry.get( view ),
|
|
203
|
-
adFormatRegistry.get( view ) );
|
|
68
|
+
view.setAdFormat( adFormatStr );
|
|
204
69
|
}
|
|
205
70
|
|
|
206
71
|
@Override
|
|
207
72
|
public void onDropViewInstance(@NotNull AppLovinMAXAdView view)
|
|
208
73
|
{
|
|
209
|
-
|
|
210
|
-
adUnitIdRegistry.remove( view );
|
|
211
|
-
|
|
212
|
-
// HACK ALERT: Since current SDK does not respect auto-refresh APIs until _after_ `onAdLoaded()`, explicitly expose view validity to the main module
|
|
213
|
-
MaxAdView adView = view.getAdView();
|
|
214
|
-
if ( adView != null )
|
|
215
|
-
{
|
|
216
|
-
AppLovinMAXModule.sAdViewsToRemove.put( adView.getAdUnitId(), adView );
|
|
217
|
-
}
|
|
74
|
+
view.destroy();
|
|
218
75
|
|
|
219
76
|
super.onDropViewInstance( view );
|
|
220
77
|
}
|
|
@@ -931,12 +931,6 @@ public class AppLovinMAXModule
|
|
|
931
931
|
{
|
|
932
932
|
adView.stopAutoRefresh();
|
|
933
933
|
}
|
|
934
|
-
|
|
935
|
-
adView = sAdViewsToRemove.remove( ad.getAdUnitId() );
|
|
936
|
-
if ( adView != null )
|
|
937
|
-
{
|
|
938
|
-
adView.stopAutoRefresh();
|
|
939
|
-
}
|
|
940
934
|
}
|
|
941
935
|
else if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
942
936
|
{
|
|
@@ -1933,6 +1927,18 @@ public class AppLovinMAXModule
|
|
|
1933
1927
|
mRewardedAds.clear();
|
|
1934
1928
|
}
|
|
1935
1929
|
|
|
1930
|
+
// Required methods introduced React Native 0.65
|
|
1931
|
+
//
|
|
1932
|
+
// Without these methods, the following warnings are generated.
|
|
1933
|
+
//
|
|
1934
|
+
// WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method.
|
|
1935
|
+
// WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.
|
|
1936
|
+
@ReactMethod
|
|
1937
|
+
public void addListener(String eventName) { }
|
|
1938
|
+
|
|
1939
|
+
@ReactMethod
|
|
1940
|
+
public void removeListeners(Integer count) { }
|
|
1941
|
+
|
|
1936
1942
|
// React Native Bridge
|
|
1937
1943
|
|
|
1938
1944
|
private void sendReactNativeEvent(final String name, @Nullable final WritableMap params)
|
package/ios/AppLovinMAX.h
CHANGED
package/ios/AppLovinMAX.m
CHANGED
|
@@ -187,7 +187,7 @@ RCT_EXPORT_METHOD(initialize:(NSString *)pluginVersion :(NSString *)sdkKey :(RCT
|
|
|
187
187
|
// Set verbose logging state if needed
|
|
188
188
|
if ( self.verboseLoggingToSet )
|
|
189
189
|
{
|
|
190
|
-
self.sdk.settings.
|
|
190
|
+
self.sdk.settings.verboseLoggingEnabled = self.verboseLoggingToSet.boolValue;
|
|
191
191
|
self.verboseLoggingToSet = nil;
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -312,7 +312,7 @@ RCT_EXPORT_METHOD(setVerboseLogging:(BOOL)enabled)
|
|
|
312
312
|
{
|
|
313
313
|
if ( [self isPluginInitialized] )
|
|
314
314
|
{
|
|
315
|
-
self.sdk.settings.
|
|
315
|
+
self.sdk.settings.verboseLoggingEnabled = enabled;
|
|
316
316
|
self.verboseLoggingToSet = nil;
|
|
317
317
|
}
|
|
318
318
|
else
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
10
|
1D2890F5251ABC83004F1CC4 /* AppLovinMAXAdViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2890F4251ABC83004F1CC4 /* AppLovinMAXAdViewManager.m */; };
|
|
11
|
+
1D3CC34128C18441003E5A07 /* AppLovinMAXAdView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3CC34028C18441003E5A07 /* AppLovinMAXAdView.m */; };
|
|
11
12
|
1DEA13CD24B9258700D42847 /* AppLovinMAX.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DEA13CC24B9258700D42847 /* AppLovinMAX.m */; };
|
|
12
13
|
DE4E5A3D46DDFAE766DFFE58 /* libPods-AppLovinMAX.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EF1B4EBC7187611714984C78 /* libPods-AppLovinMAX.a */; };
|
|
13
14
|
/* End PBXBuildFile section */
|
|
@@ -29,6 +30,8 @@
|
|
|
29
30
|
134814201AA4EA6300B7C361 /* libAppLovinMAX.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAppLovinMAX.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
30
31
|
1D2890F3251ABC83004F1CC4 /* AppLovinMAXAdViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppLovinMAXAdViewManager.h; sourceTree = "<group>"; };
|
|
31
32
|
1D2890F4251ABC83004F1CC4 /* AppLovinMAXAdViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppLovinMAXAdViewManager.m; sourceTree = "<group>"; };
|
|
33
|
+
1D3CC33F28C18440003E5A07 /* AppLovinMAXAdView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppLovinMAXAdView.h; sourceTree = "<group>"; };
|
|
34
|
+
1D3CC34028C18441003E5A07 /* AppLovinMAXAdView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppLovinMAXAdView.m; sourceTree = "<group>"; };
|
|
32
35
|
1DEA13CC24B9258700D42847 /* AppLovinMAX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppLovinMAX.m; sourceTree = "<group>"; };
|
|
33
36
|
B3E7B5881CC2AC0600A0062D /* AppLovinMAX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppLovinMAX.h; sourceTree = "<group>"; };
|
|
34
37
|
EF1B4EBC7187611714984C78 /* libPods-AppLovinMAX.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AppLovinMAX.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
@@ -68,6 +71,8 @@
|
|
|
68
71
|
children = (
|
|
69
72
|
B3E7B5881CC2AC0600A0062D /* AppLovinMAX.h */,
|
|
70
73
|
1DEA13CC24B9258700D42847 /* AppLovinMAX.m */,
|
|
74
|
+
1D3CC33F28C18440003E5A07 /* AppLovinMAXAdView.h */,
|
|
75
|
+
1D3CC34028C18441003E5A07 /* AppLovinMAXAdView.m */,
|
|
71
76
|
1D2890F3251ABC83004F1CC4 /* AppLovinMAXAdViewManager.h */,
|
|
72
77
|
1D2890F4251ABC83004F1CC4 /* AppLovinMAXAdViewManager.m */,
|
|
73
78
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
@@ -169,6 +174,7 @@
|
|
|
169
174
|
buildActionMask = 2147483647;
|
|
170
175
|
files = (
|
|
171
176
|
1D2890F5251ABC83004F1CC4 /* AppLovinMAXAdViewManager.m in Sources */,
|
|
177
|
+
1D3CC34128C18441003E5A07 /* AppLovinMAXAdView.m in Sources */,
|
|
172
178
|
1DEA13CD24B9258700D42847 /* AppLovinMAX.m in Sources */,
|
|
173
179
|
);
|
|
174
180
|
runOnlyForDeploymentPostprocessing = 0;
|
package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate
CHANGED
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Bucket
|
|
3
|
+
uuid = "8322C692-8067-489C-89A1-217F139F4039"
|
|
4
|
+
type = "0"
|
|
5
|
+
version = "2.0">
|
|
6
|
+
<Breakpoints>
|
|
7
|
+
<BreakpointProxy
|
|
8
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
9
|
+
<BreakpointContent
|
|
10
|
+
uuid = "1DACA5BD-D4D2-4CD6-BEFD-D951963D77E1"
|
|
11
|
+
shouldBeEnabled = "No"
|
|
12
|
+
ignoreCount = "0"
|
|
13
|
+
continueAfterRunningActions = "No"
|
|
14
|
+
filePath = "AppLovinMAX.m"
|
|
15
|
+
startingColumnNumber = "9223372036854775807"
|
|
16
|
+
endingColumnNumber = "9223372036854775807"
|
|
17
|
+
startingLineNumber = "1304"
|
|
18
|
+
endingLineNumber = "1304"
|
|
19
|
+
landmarkName = "-positionAdViewForAdUnitIdentifier:adFormat:"
|
|
20
|
+
landmarkType = "7">
|
|
21
|
+
</BreakpointContent>
|
|
22
|
+
</BreakpointProxy>
|
|
23
|
+
</Breakpoints>
|
|
24
|
+
</Bucket>
|