react-native-applovin-max 3.0.2 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +7 -1
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +24 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +401 -116
- package/ios/AppLovinMAX.h +1 -1
- package/ios/AppLovinMAX.m +313 -37
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/AppLovinMAXAdViewManager.m +35 -0
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +4 -4
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AppLovinMAXAdView.js +24 -0
- package/src/TargetingData.js +70 -0
- package/src/UserSegment.js +12 -0
- package/src/index.js +58 -1
package/src/AppLovinMAXAdView.js
CHANGED
|
@@ -13,6 +13,7 @@ class AdView extends React.Component {
|
|
|
13
13
|
this.setAdUnitId(this.props.adUnitId);
|
|
14
14
|
this.setAdFormat(this.props.adFormat);
|
|
15
15
|
this.setPlacement(this.props.placement);
|
|
16
|
+
this.setCustomData(this.props.customData);
|
|
16
17
|
this.setAdaptiveBannerEnabled(this.props.adaptiveBannerEnabled);
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -30,6 +31,10 @@ class AdView extends React.Component {
|
|
|
30
31
|
this.setPlacement(this.props.placement);
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
if (prevProps.customData !== this.props.customData) {
|
|
35
|
+
this.setCustomData(this.props.customData);
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
if (prevProps.adaptiveBannerEnabled !== this.props.adaptiveBannerEnabled) {
|
|
34
39
|
this.setAdaptiveBannerEnabled(this.props.adaptiveBannerEnabled);
|
|
35
40
|
}
|
|
@@ -94,6 +99,20 @@ class AdView extends React.Component {
|
|
|
94
99
|
);
|
|
95
100
|
}
|
|
96
101
|
|
|
102
|
+
setCustomData(customData) {
|
|
103
|
+
var adUnitId = this.props.adUnitId;
|
|
104
|
+
var adFormat = this.props.adFormat;
|
|
105
|
+
|
|
106
|
+
// If the ad unit id or ad format are unset, we can't set the customData.
|
|
107
|
+
if (adUnitId == null || adFormat == null) return;
|
|
108
|
+
|
|
109
|
+
UIManager.dispatchViewManagerCommand(
|
|
110
|
+
findNodeHandle(this),
|
|
111
|
+
Platform.OS === 'android' ? "setCustomData" : UIManager.getViewManagerConfig("AppLovinMAXAdView").Commands.setCustomData,
|
|
112
|
+
[customData]
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
97
116
|
setAdaptiveBannerEnabled(enabled) {
|
|
98
117
|
var adUnitId = this.props.adUnitId;
|
|
99
118
|
var adFormat = this.props.adFormat;
|
|
@@ -129,6 +148,11 @@ AdView.propTypes = {
|
|
|
129
148
|
*/
|
|
130
149
|
placement: PropTypes.string,
|
|
131
150
|
|
|
151
|
+
/**
|
|
152
|
+
* A string value representing the customData name that you assign when you integrate each ad format, for granular reporting in ad events.
|
|
153
|
+
*/
|
|
154
|
+
customData: PropTypes.string,
|
|
155
|
+
|
|
132
156
|
/**
|
|
133
157
|
* A boolean value representing whether or not to enable adaptive banners. Note that adaptive banners are enabled by default as of v2.3.0.
|
|
134
158
|
*/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import AppLovinMAX from "./index.js";
|
|
2
|
+
|
|
3
|
+
const AdContentRating = {
|
|
4
|
+
None: 0,
|
|
5
|
+
AllAudiences: 1,
|
|
6
|
+
EveryoneOverTwelve: 2,
|
|
7
|
+
MatureAudiences: 3,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const UserGender = {
|
|
11
|
+
Unknown: 'U',
|
|
12
|
+
Female: 'F',
|
|
13
|
+
Male: 'M',
|
|
14
|
+
Other: 'O'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let TargetingData = {
|
|
18
|
+
|
|
19
|
+
set yearOfBirth(value) {
|
|
20
|
+
AppLovinMAX.setTargetingDataYearOfBirth(value);
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
set gender(value) {
|
|
24
|
+
if ( value === UserGender.Unknown ||
|
|
25
|
+
value === UserGender.Female ||
|
|
26
|
+
value === UserGender.Male ||
|
|
27
|
+
value === UserGender.Other ) {
|
|
28
|
+
AppLovinMAX.setTargetingDataGender(value);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
set maximumAdContentRating(value) {
|
|
33
|
+
if ( value === AdContentRating.None ||
|
|
34
|
+
value === AdContentRating.AllAudiences ||
|
|
35
|
+
value === AdContentRating.EveryoneOverTwelve ||
|
|
36
|
+
value === AdContentRating.MatureAudiences ) {
|
|
37
|
+
AppLovinMAX.setTargetingDataMaximumAdContentRating(value);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
set email(value) {
|
|
42
|
+
AppLovinMAX.setTargetingDataEmail(value);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
set phoneNumber(value) {
|
|
46
|
+
AppLovinMAX.setTargetingDataPhoneNumber(value);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
set keywords(value) {
|
|
50
|
+
AppLovinMAX.setTargetingDataKeywords(value);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
set interests(value) {
|
|
54
|
+
AppLovinMAX.setTargetingDataInterests(value);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
clearAll() {
|
|
58
|
+
AppLovinMAX.clearAllTargetingData();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
TargetingData.AdContentRating = AdContentRating;
|
|
64
|
+
TargetingData.UserGender = UserGender;
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
TargetingData,
|
|
68
|
+
AdContentRating,
|
|
69
|
+
UserGender
|
|
70
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { NativeModules, NativeEventEmitter } from "react-native";
|
|
2
2
|
import AdView from "./AppLovinMAXAdView";
|
|
3
|
+
import { TargetingData as targetingData, AdContentRating, UserGender } from "./TargetingData";
|
|
4
|
+
import { UserSegment as userSegment } from "./UserSegment";
|
|
3
5
|
|
|
4
6
|
const { AppLovinMAX } = NativeModules;
|
|
5
7
|
|
|
6
|
-
const VERSION = "3.
|
|
8
|
+
const VERSION = "3.2.1";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* This enum represents whether or not the consent dialog should be shown for this user.
|
|
@@ -33,6 +35,7 @@ const AdFormat = {
|
|
|
33
35
|
|
|
34
36
|
const AdViewPosition = {
|
|
35
37
|
TOP_CENTER: "top_center",
|
|
38
|
+
TOP_LEFT: "top_left",
|
|
36
39
|
TOP_RIGHT: "top_right",
|
|
37
40
|
CENTERED: "centered",
|
|
38
41
|
CENTER_LEFT: "center_left",
|
|
@@ -64,9 +67,47 @@ const removeEventListener = (event) => {
|
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
|
|
70
|
+
const showInterstitial = (adUnitId, ...args) => {
|
|
71
|
+
switch (args.length) {
|
|
72
|
+
case 0:
|
|
73
|
+
AppLovinMAX.showInterstitial(adUnitId, null, null);
|
|
74
|
+
break;
|
|
75
|
+
case 1:
|
|
76
|
+
AppLovinMAX.showInterstitial(adUnitId, args[0], null);
|
|
77
|
+
break;
|
|
78
|
+
case 2:
|
|
79
|
+
AppLovinMAX.showInterstitial(adUnitId, args[0], args[1]);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
// do nothing - unexpected number of arguments
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const showRewardedAd = (adUnitId, ...args) => {
|
|
88
|
+
switch (args.length) {
|
|
89
|
+
case 0:
|
|
90
|
+
AppLovinMAX.showRewardedAd(adUnitId, null, null);
|
|
91
|
+
break;
|
|
92
|
+
case 1:
|
|
93
|
+
AppLovinMAX.showRewardedAd(adUnitId, args[0], null);
|
|
94
|
+
break;
|
|
95
|
+
case 2:
|
|
96
|
+
AppLovinMAX.showRewardedAd(adUnitId, args[0], args[1]);
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
// do nothing - unexpected number of arguments
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
67
104
|
export default {
|
|
68
105
|
...AppLovinMAX,
|
|
69
106
|
AdView,
|
|
107
|
+
userSegment,
|
|
108
|
+
targetingData,
|
|
109
|
+
AdContentRating,
|
|
110
|
+
UserGender,
|
|
70
111
|
ConsentDialogState,
|
|
71
112
|
AdViewPosition,
|
|
72
113
|
AdFormat,
|
|
@@ -76,6 +117,8 @@ export default {
|
|
|
76
117
|
initialize(sdkKey, callback) {
|
|
77
118
|
AppLovinMAX.initialize(VERSION, sdkKey, callback); // Inject VERSION into native code
|
|
78
119
|
},
|
|
120
|
+
showInterstitial,
|
|
121
|
+
showRewardedAd,
|
|
79
122
|
|
|
80
123
|
/*----------------------*/
|
|
81
124
|
/** AUTO-DECLARED APIs **/
|
|
@@ -91,6 +134,7 @@ export default {
|
|
|
91
134
|
/*--------------*/
|
|
92
135
|
/* PRIVACY APIs */
|
|
93
136
|
/*--------------*/
|
|
137
|
+
/* showConsentDialog(callback) */
|
|
94
138
|
/* getConsentDialogState() */
|
|
95
139
|
/* setHasUserConsent(hasUserConsent) */
|
|
96
140
|
/* hasUserConsent() */
|
|
@@ -112,6 +156,19 @@ export default {
|
|
|
112
156
|
/* setConsentFlowEnabled(enabled) */
|
|
113
157
|
/* setPrivacyPolicyUrl(urlString) */
|
|
114
158
|
/* setTermsOfServiceUrl(urlString) */
|
|
159
|
+
/* setLocationCollectionEnabled(locationCollectionEnabled) */
|
|
160
|
+
|
|
161
|
+
/*----------------*/
|
|
162
|
+
/* DATA PASSING */
|
|
163
|
+
/*----------------*/
|
|
164
|
+
/* setTargetingDataYearOfBirth(yearOfBirth) */
|
|
165
|
+
/* setTargetingDataGender(gender) */
|
|
166
|
+
/* setTargetingDataMaximumAdContentRating(maximumAdContentRating) */
|
|
167
|
+
/* setTargetingDataEmail(email) */
|
|
168
|
+
/* setTargetingDataPhoneNumber(phoneNumber) */
|
|
169
|
+
/* setTargetingDataKeywords(keywords) */
|
|
170
|
+
/* setTargetingDataInterests(interests) */
|
|
171
|
+
/* clearAllTargetingData() */
|
|
115
172
|
|
|
116
173
|
/*----------------*/
|
|
117
174
|
/* EVENT TRACKING */
|