react-native-applovin-max 6.0.1 → 6.1.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 +3 -3
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +127 -20
- package/ios/AppLovinMAX.m +154 -25
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +4 -4
- package/package.json +5 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AdView.tsx +58 -43
- package/src/AppLovinMAX.ts +8 -10
- package/src/AppOpenAd.ts +28 -31
- package/src/BannerAd.ts +36 -35
- package/src/EventEmitter.ts +9 -9
- package/src/InterstitialAd.ts +31 -32
- package/src/MRecAd.ts +32 -31
- package/src/Privacy.ts +58 -2
- package/src/RewardedAd.ts +31 -34
- package/src/TargetingData.ts +46 -35
- package/src/index.ts +12 -12
- package/src/nativeAd/NativeAdView.tsx +64 -55
- package/src/nativeAd/NativeAdViewComponents.tsx +38 -29
- package/src/nativeAd/NativeAdViewProvider.tsx +16 -13
- package/src/types/AdEvent.ts +2 -13
- package/src/types/AdInfo.ts +6 -18
- package/src/types/AdProps.ts +7 -3
- package/src/types/AdViewProps.ts +4 -5
- package/src/types/AppLovinMAX.ts +14 -8
- package/src/types/AppOpenAd.ts +1 -1
- package/src/types/BannerAd.ts +8 -9
- package/src/types/Configuration.ts +28 -3
- package/src/types/FullscreenAd.ts +19 -19
- package/src/types/InterstitialAd.ts +1 -1
- package/src/types/MRecAd.ts +3 -4
- package/src/types/NativeAd.ts +1 -2
- package/src/types/NativeAdViewProps.ts +1 -2
- package/src/types/Privacy.ts +28 -16
- package/src/types/RewardedAd.ts +4 -5
- package/src/types/TargetingData.ts +1 -2
- package/src/types/ViewAd.ts +20 -20
- package/src/types/index.ts +4 -4
- package/android/src/main/java/com/applovin/mediation/adapters/GoogleAdManagerMediationAdapter.java.saved +0 -1616
- package/android/src/main/java/com/applovin/mediation/adapters/GoogleMediationAdapter.java.old +0 -1788
- package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.old +0 -1481
- package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.saved +0 -1448
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/hiroshi.watanabe.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
package/src/MRecAd.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { NativeModules } from
|
|
2
|
-
import { addEventListener, removeEventListener } from
|
|
3
|
-
import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import { addEventListener, removeEventListener } from './EventEmitter';
|
|
3
|
+
import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
|
|
4
|
+
import type { LocalExtraParameterValue } from './types/AdProps';
|
|
5
|
+
import type { MRecAdType } from './types/MRecAd';
|
|
6
|
+
import type { AdViewPosition } from './AdView';
|
|
6
7
|
|
|
7
8
|
const { AppLovinMAX } = NativeModules;
|
|
8
9
|
|
|
@@ -17,95 +18,95 @@ const {
|
|
|
17
18
|
|
|
18
19
|
const createAd = (adUnitId: string, position: AdViewPosition): void => {
|
|
19
20
|
AppLovinMAX.createMRec(adUnitId, position);
|
|
20
|
-
}
|
|
21
|
+
};
|
|
21
22
|
|
|
22
23
|
const destroyAd = (adUnitId: string): void => {
|
|
23
24
|
AppLovinMAX.destroyMRec(adUnitId);
|
|
24
|
-
}
|
|
25
|
+
};
|
|
25
26
|
|
|
26
27
|
const showAd = (adUnitId: string): void => {
|
|
27
28
|
AppLovinMAX.showMRec(adUnitId);
|
|
28
|
-
}
|
|
29
|
+
};
|
|
29
30
|
|
|
30
31
|
const hideAd = (adUnitId: string): void => {
|
|
31
32
|
AppLovinMAX.hideMRec(adUnitId);
|
|
32
|
-
}
|
|
33
|
+
};
|
|
33
34
|
|
|
34
35
|
const setPlacement = (adUnitId: string, placement: string | null): void => {
|
|
35
36
|
AppLovinMAX.setMRecPlacement(adUnitId, placement);
|
|
36
|
-
}
|
|
37
|
+
};
|
|
37
38
|
|
|
38
39
|
const setCustomData = (adUnitId: string, customData: string | null): void => {
|
|
39
40
|
AppLovinMAX.setMRecCustomData(adUnitId, customData);
|
|
40
|
-
}
|
|
41
|
+
};
|
|
41
42
|
|
|
42
43
|
const updatePosition = (adUnitId: string, bannerPosition: AdViewPosition): void => {
|
|
43
44
|
AppLovinMAX.updateMRecPosition(adUnitId, bannerPosition);
|
|
44
|
-
}
|
|
45
|
+
};
|
|
45
46
|
|
|
46
|
-
const setExtraParameter = (adUnitId: string, key: string, value:
|
|
47
|
+
const setExtraParameter = (adUnitId: string, key: string, value: string | null): void => {
|
|
47
48
|
AppLovinMAX.setMRecExtraParameter(adUnitId, key, value);
|
|
48
|
-
}
|
|
49
|
+
};
|
|
49
50
|
|
|
50
|
-
const setLocalExtraParameter = (adUnitId: string, key: string, value:
|
|
51
|
+
const setLocalExtraParameter = (adUnitId: string, key: string, value: LocalExtraParameterValue): void => {
|
|
51
52
|
AppLovinMAX.setMRecLocalExtraParameter(adUnitId, { [key]: value });
|
|
52
|
-
}
|
|
53
|
+
};
|
|
53
54
|
|
|
54
55
|
const startAutoRefresh = (adUnitId: string): void => {
|
|
55
56
|
AppLovinMAX.startMRecAutoRefresh(adUnitId);
|
|
56
|
-
}
|
|
57
|
+
};
|
|
57
58
|
|
|
58
59
|
const stopAutoRefresh = (adUnitId: string): void => {
|
|
59
60
|
AppLovinMAX.stopMRecAutoRefresh(adUnitId);
|
|
60
|
-
}
|
|
61
|
+
};
|
|
61
62
|
|
|
62
63
|
const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
63
64
|
addEventListener(ON_MREC_AD_LOADED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
64
|
-
}
|
|
65
|
+
};
|
|
65
66
|
|
|
66
67
|
const removeAdLoadedEventListener = () => {
|
|
67
68
|
removeEventListener(ON_MREC_AD_LOADED_EVENT);
|
|
68
|
-
}
|
|
69
|
+
};
|
|
69
70
|
|
|
70
71
|
const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void) => {
|
|
71
72
|
addEventListener(ON_MREC_AD_LOAD_FAILED_EVENT, (errorInfo: AdLoadFailedInfo) => listener(errorInfo));
|
|
72
|
-
}
|
|
73
|
+
};
|
|
73
74
|
|
|
74
75
|
const removeAdLoadFailedEventListener = () => {
|
|
75
76
|
removeEventListener(ON_MREC_AD_LOAD_FAILED_EVENT);
|
|
76
|
-
}
|
|
77
|
+
};
|
|
77
78
|
|
|
78
79
|
const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
79
80
|
addEventListener(ON_MREC_AD_CLICKED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
80
|
-
}
|
|
81
|
+
};
|
|
81
82
|
|
|
82
83
|
const removeAdClickedEventListener = () => {
|
|
83
84
|
removeEventListener(ON_MREC_AD_CLICKED_EVENT);
|
|
84
|
-
}
|
|
85
|
+
};
|
|
85
86
|
|
|
86
87
|
const addAdCollapsedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
87
88
|
addEventListener(ON_MREC_AD_COLLAPSED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
88
|
-
}
|
|
89
|
+
};
|
|
89
90
|
|
|
90
91
|
const removeAdCollapsedEventListener = () => {
|
|
91
92
|
removeEventListener(ON_MREC_AD_COLLAPSED_EVENT);
|
|
92
|
-
}
|
|
93
|
+
};
|
|
93
94
|
|
|
94
95
|
const addAdExpandedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
95
96
|
addEventListener(ON_MREC_AD_EXPANDED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
96
|
-
}
|
|
97
|
+
};
|
|
97
98
|
|
|
98
99
|
const removeAdExpandedEventListener = () => {
|
|
99
100
|
removeEventListener(ON_MREC_AD_EXPANDED_EVENT);
|
|
100
|
-
}
|
|
101
|
+
};
|
|
101
102
|
|
|
102
103
|
const addAdRevenuePaidListener = (listener: (adInfo: AdRevenueInfo) => void) => {
|
|
103
104
|
addEventListener(ON_MREC_AD_REVENUE_PAID, (adInfo: AdRevenueInfo) => listener(adInfo));
|
|
104
|
-
}
|
|
105
|
+
};
|
|
105
106
|
|
|
106
107
|
const removeAdRevenuePaidListener = () => {
|
|
107
108
|
removeEventListener(ON_MREC_AD_REVENUE_PAID);
|
|
108
|
-
}
|
|
109
|
+
};
|
|
109
110
|
|
|
110
111
|
export const MRecAd: MRecAdType = {
|
|
111
112
|
createAd,
|
|
@@ -142,6 +143,6 @@ export const MRecAd: MRecAdType = {
|
|
|
142
143
|
|
|
143
144
|
addAdRevenuePaidListener,
|
|
144
145
|
removeAdRevenuePaidListener,
|
|
145
|
-
}
|
|
146
|
+
};
|
|
146
147
|
|
|
147
148
|
export default MRecAd;
|
package/src/Privacy.ts
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
|
-
import { NativeModules } from
|
|
2
|
-
import type { PrivacyType } from
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import type { PrivacyType } from './types/Privacy';
|
|
3
3
|
|
|
4
4
|
const { AppLovinMAX } = NativeModules;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* This enum represents the user's geography used to determine the type of consent flow shown to the
|
|
8
|
+
* user.
|
|
9
|
+
*/
|
|
10
|
+
export enum ConsentFlowUserGeography {
|
|
11
|
+
/**
|
|
12
|
+
* User's geography is unknown.
|
|
13
|
+
*/
|
|
14
|
+
UNKNOWN = 'U',
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The user is in GDPR region.
|
|
18
|
+
*/
|
|
19
|
+
GDPR = 'G',
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The user is in a non-GDPR region.
|
|
23
|
+
*/
|
|
24
|
+
OTHER = 'O',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* AppLovin SDK-defined app tracking transparency status values (extended to include "unavailable"
|
|
29
|
+
* state on iOS before iOS14).
|
|
30
|
+
*/
|
|
31
|
+
export enum AppTrackingStatus {
|
|
32
|
+
/**
|
|
33
|
+
* Device is on iOS before iOS14, AppTrackingTransparency.framework is not available.
|
|
34
|
+
*/
|
|
35
|
+
UNAVAILABLE = 'U',
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The user has not yet received an authorization request to authorize access to app-related
|
|
39
|
+
* data that can be used for tracking the user or the device.
|
|
40
|
+
*/
|
|
41
|
+
NOT_DETERMINED = 'N',
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Authorization to access app-related data that can be used for tracking the user or the device
|
|
45
|
+
* is restricted.
|
|
46
|
+
*/
|
|
47
|
+
RESTRICTED = 'R',
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The user denies authorization to access app-related data that can be used for tracking the
|
|
51
|
+
* user or the device.
|
|
52
|
+
*/
|
|
53
|
+
DENIED = 'D',
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The user authorizes access to app-related data that can be used for tracking the user or the
|
|
57
|
+
* device.
|
|
58
|
+
*/
|
|
59
|
+
AUTHORIZED = 'A',
|
|
60
|
+
}
|
|
61
|
+
|
|
6
62
|
export const Privacy: PrivacyType = AppLovinMAX;
|
package/src/RewardedAd.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { NativeModules } from
|
|
2
|
-
import { addEventListener, removeEventListener } from
|
|
3
|
-
import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo, AdRewardInfo } from
|
|
4
|
-
import type {
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import { addEventListener, removeEventListener } from './EventEmitter';
|
|
3
|
+
import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo, AdRewardInfo } from './types/AdInfo';
|
|
4
|
+
import type { LocalExtraParameterValue } from './types/AdProps';
|
|
5
|
+
import type { RewardedAdType } from './types/RewardedAd';
|
|
5
6
|
|
|
6
7
|
const { AppLovinMAX } = NativeModules;
|
|
7
8
|
|
|
@@ -18,93 +19,89 @@ const {
|
|
|
18
19
|
|
|
19
20
|
const isAdReady = (adUnitId: string): Promise<boolean> => {
|
|
20
21
|
return AppLovinMAX.isRewardedAdReady(adUnitId);
|
|
21
|
-
}
|
|
22
|
+
};
|
|
22
23
|
|
|
23
24
|
const loadAd = (adUnitId: string): void => {
|
|
24
25
|
AppLovinMAX.loadRewardedAd(adUnitId);
|
|
25
|
-
}
|
|
26
|
+
};
|
|
26
27
|
|
|
27
|
-
const showAd = (
|
|
28
|
-
adUnitId: string,
|
|
29
|
-
placement?: string | null,
|
|
30
|
-
customData?: string | null
|
|
31
|
-
): void => {
|
|
28
|
+
const showAd = (adUnitId: string, placement?: string | null, customData?: string | null): void => {
|
|
32
29
|
AppLovinMAX.showRewardedAd(adUnitId, placement ?? null, customData ?? null);
|
|
33
|
-
}
|
|
30
|
+
};
|
|
34
31
|
|
|
35
|
-
const setExtraParameter = (adUnitId: string, key: string, value:
|
|
32
|
+
const setExtraParameter = (adUnitId: string, key: string, value: string | null): void => {
|
|
36
33
|
AppLovinMAX.setRewardedAdExtraParameter(adUnitId, key, value);
|
|
37
|
-
}
|
|
34
|
+
};
|
|
38
35
|
|
|
39
|
-
const setLocalExtraParameter = (adUnitId: string, key: string, value:
|
|
36
|
+
const setLocalExtraParameter = (adUnitId: string, key: string, value: LocalExtraParameterValue): void => {
|
|
40
37
|
AppLovinMAX.setRewardedAdLocalExtraParameter(adUnitId, { [key]: value });
|
|
41
|
-
}
|
|
38
|
+
};
|
|
42
39
|
|
|
43
40
|
const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
44
41
|
addEventListener(ON_REWARDED_AD_LOADED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
45
|
-
}
|
|
42
|
+
};
|
|
46
43
|
|
|
47
44
|
const removeAdLoadedEventListener = () => {
|
|
48
45
|
removeEventListener(ON_REWARDED_AD_LOADED_EVENT);
|
|
49
|
-
}
|
|
46
|
+
};
|
|
50
47
|
|
|
51
48
|
const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void) => {
|
|
52
49
|
addEventListener(ON_REWARDED_AD_LOAD_FAILED_EVENT, (errorInfo: AdLoadFailedInfo) => listener(errorInfo));
|
|
53
|
-
}
|
|
50
|
+
};
|
|
54
51
|
|
|
55
52
|
const removeAdLoadFailedEventListener = () => {
|
|
56
53
|
removeEventListener(ON_REWARDED_AD_LOAD_FAILED_EVENT);
|
|
57
|
-
}
|
|
54
|
+
};
|
|
58
55
|
|
|
59
56
|
const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
60
57
|
addEventListener(ON_REWARDED_AD_CLICKED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
60
|
const removeAdClickedEventListener = () => {
|
|
64
61
|
removeEventListener(ON_REWARDED_AD_CLICKED_EVENT);
|
|
65
|
-
}
|
|
62
|
+
};
|
|
66
63
|
|
|
67
64
|
const addAdDisplayedEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
68
65
|
addEventListener(ON_REWARDED_AD_DISPLAYED_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
69
|
-
}
|
|
66
|
+
};
|
|
70
67
|
|
|
71
68
|
const removeAdDisplayedEventListener = () => {
|
|
72
69
|
removeEventListener(ON_REWARDED_AD_DISPLAYED_EVENT);
|
|
73
|
-
}
|
|
70
|
+
};
|
|
74
71
|
|
|
75
72
|
const addAdFailedToDisplayEventListener = (listener: (errorInfo: AdDisplayFailedInfo) => void) => {
|
|
76
73
|
addEventListener(ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT, (errorInfo: AdDisplayFailedInfo) => listener(errorInfo));
|
|
77
|
-
}
|
|
74
|
+
};
|
|
78
75
|
|
|
79
76
|
const removeAdFailedToDisplayEventListener = () => {
|
|
80
77
|
removeEventListener(ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT);
|
|
81
|
-
}
|
|
78
|
+
};
|
|
82
79
|
|
|
83
80
|
const addAdHiddenEventListener = (listener: (adInfo: AdInfo) => void) => {
|
|
84
81
|
addEventListener(ON_REWARDED_AD_HIDDEN_EVENT, (adInfo: AdInfo) => listener(adInfo));
|
|
85
|
-
}
|
|
82
|
+
};
|
|
86
83
|
|
|
87
84
|
const removeAdHiddenEventListener = () => {
|
|
88
85
|
removeEventListener(ON_REWARDED_AD_HIDDEN_EVENT);
|
|
89
|
-
}
|
|
86
|
+
};
|
|
90
87
|
|
|
91
88
|
const addAdRevenuePaidListener = (listener: (adInfo: AdRevenueInfo) => void) => {
|
|
92
89
|
addEventListener(ON_REWARDED_AD_REVENUE_PAID, (adInfo: AdRevenueInfo) => listener(adInfo));
|
|
93
|
-
}
|
|
90
|
+
};
|
|
94
91
|
|
|
95
92
|
const removeAdRevenuePaidListener = () => {
|
|
96
93
|
removeEventListener(ON_REWARDED_AD_REVENUE_PAID);
|
|
97
|
-
}
|
|
94
|
+
};
|
|
98
95
|
|
|
99
96
|
// Rewarded specific APIs
|
|
100
97
|
|
|
101
98
|
const addAdReceivedRewardEventListener = (listener: (adInfo: AdRewardInfo) => void) => {
|
|
102
99
|
addEventListener(ON_REWARDED_AD_RECEIVED_REWARD_EVENT, (adInfo: AdRewardInfo) => listener(adInfo));
|
|
103
|
-
}
|
|
100
|
+
};
|
|
104
101
|
|
|
105
102
|
const removeAdReceivedRewardEventListener = () => {
|
|
106
103
|
removeEventListener(ON_REWARDED_AD_RECEIVED_REWARD_EVENT);
|
|
107
|
-
}
|
|
104
|
+
};
|
|
108
105
|
|
|
109
106
|
export const RewardedAd: RewardedAdType = {
|
|
110
107
|
isAdReady,
|
|
@@ -136,9 +133,9 @@ export const RewardedAd: RewardedAdType = {
|
|
|
136
133
|
removeAdRevenuePaidListener,
|
|
137
134
|
|
|
138
135
|
// Rewarded specific APIs
|
|
139
|
-
|
|
136
|
+
|
|
140
137
|
addAdReceivedRewardEventListener,
|
|
141
138
|
removeAdReceivedRewardEventListener,
|
|
142
|
-
}
|
|
139
|
+
};
|
|
143
140
|
|
|
144
141
|
export default RewardedAd;
|
package/src/TargetingData.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NativeModules } from
|
|
2
|
-
import type { TargetingDataType } from
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import type { TargetingDataType } from './types/TargetingData';
|
|
3
3
|
|
|
4
4
|
const { AppLovinMAX } = NativeModules;
|
|
5
5
|
|
|
@@ -27,20 +27,20 @@ const nativeMethods: NativeTargetingDataType = AppLovinMAX;
|
|
|
27
27
|
* This enumeration represents content ratings for the ads shown to users.
|
|
28
28
|
*/
|
|
29
29
|
export enum AdContentRating {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
NONE = 0,
|
|
31
|
+
ALL_AUDIENCES = 1,
|
|
32
|
+
EVERYONE_OVER_TWELVE = 2,
|
|
33
|
+
MATURE_AUDIENCES = 3,
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* This enumeration represents gender.
|
|
38
38
|
*/
|
|
39
39
|
export enum UserGender {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
UNKNOWN = 'U',
|
|
41
|
+
FEMALE = 'F',
|
|
42
|
+
MALE = 'M',
|
|
43
|
+
OTHER = 'O',
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -49,7 +49,6 @@ export enum UserGender {
|
|
|
49
49
|
* @see {@link https://support.applovin.com/hc/en-us/articles/13964925614733-Data-and-Keyword-Passing}
|
|
50
50
|
*/
|
|
51
51
|
export const TargetingData: TargetingDataType = {
|
|
52
|
-
|
|
53
52
|
/**
|
|
54
53
|
* Sets the year of birth of the user. Set this to 0 to clear this value.
|
|
55
54
|
*/
|
|
@@ -57,7 +56,7 @@ export const TargetingData: TargetingDataType = {
|
|
|
57
56
|
if (typeof value === 'number') {
|
|
58
57
|
nativeMethods.setTargetingDataYearOfBirth(value);
|
|
59
58
|
} else {
|
|
60
|
-
printError(
|
|
59
|
+
printError('TargetingData.yearOfBirth', 'number', typeof value);
|
|
61
60
|
}
|
|
62
61
|
},
|
|
63
62
|
|
|
@@ -72,13 +71,15 @@ export const TargetingData: TargetingDataType = {
|
|
|
72
71
|
* Sets the gender of the user. Set this to {@link UserGender.Unknown} to clear this value.
|
|
73
72
|
*/
|
|
74
73
|
set gender(value: UserGender | Promise<UserGender>) {
|
|
75
|
-
if (
|
|
76
|
-
value === UserGender.
|
|
77
|
-
value === UserGender.
|
|
78
|
-
value === UserGender.
|
|
74
|
+
if (
|
|
75
|
+
value === UserGender.UNKNOWN ||
|
|
76
|
+
value === UserGender.FEMALE ||
|
|
77
|
+
value === UserGender.MALE ||
|
|
78
|
+
value === UserGender.OTHER
|
|
79
|
+
) {
|
|
79
80
|
nativeMethods.setTargetingDataGender(value);
|
|
80
81
|
} else {
|
|
81
|
-
printError(
|
|
82
|
+
printError('TargetingData.gender', 'UserGender', typeof value);
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
85
|
|
|
@@ -93,17 +94,19 @@ export const TargetingData: TargetingDataType = {
|
|
|
93
94
|
|
|
94
95
|
/**
|
|
95
96
|
* Sets the maximum ad content rating shown to the user. The levels are based on IQG Media
|
|
96
|
-
* Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
|
|
97
|
+
* Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
|
|
97
98
|
* Set this to {@link AdContentRating.None} to clear this value.
|
|
98
99
|
*/
|
|
99
100
|
set maximumAdContentRating(value: AdContentRating | Promise<AdContentRating>) {
|
|
100
|
-
if (
|
|
101
|
-
value === AdContentRating.
|
|
102
|
-
value === AdContentRating.
|
|
103
|
-
value === AdContentRating.
|
|
101
|
+
if (
|
|
102
|
+
value === AdContentRating.NONE ||
|
|
103
|
+
value === AdContentRating.ALL_AUDIENCES ||
|
|
104
|
+
value === AdContentRating.EVERYONE_OVER_TWELVE ||
|
|
105
|
+
value === AdContentRating.MATURE_AUDIENCES
|
|
106
|
+
) {
|
|
104
107
|
nativeMethods.setTargetingDataMaximumAdContentRating(value);
|
|
105
108
|
} else {
|
|
106
|
-
printError(
|
|
109
|
+
printError('TargetingData.maximumAdContentRating', 'AdContentRating', typeof value);
|
|
107
110
|
}
|
|
108
111
|
},
|
|
109
112
|
|
|
@@ -126,7 +129,7 @@ export const TargetingData: TargetingDataType = {
|
|
|
126
129
|
} else if (typeof value === 'string') {
|
|
127
130
|
nativeMethods.setTargetingDataEmail(value as string);
|
|
128
131
|
} else {
|
|
129
|
-
printError(
|
|
132
|
+
printError('TargetingData.email', 'string or null', typeof value);
|
|
130
133
|
}
|
|
131
134
|
},
|
|
132
135
|
|
|
@@ -143,10 +146,10 @@ export const TargetingData: TargetingDataType = {
|
|
|
143
146
|
set phoneNumber(value: string | null | Promise<string | null>) {
|
|
144
147
|
if (value === null) {
|
|
145
148
|
nativeMethods.setTargetingDataPhoneNumber(null);
|
|
146
|
-
} else if (
|
|
149
|
+
} else if (typeof value === 'string') {
|
|
147
150
|
nativeMethods.setTargetingDataPhoneNumber(value as string);
|
|
148
151
|
} else {
|
|
149
|
-
printError(
|
|
152
|
+
printError('TargetingData.phoneNumber', 'string or null', typeof value);
|
|
150
153
|
}
|
|
151
154
|
},
|
|
152
155
|
|
|
@@ -160,13 +163,13 @@ export const TargetingData: TargetingDataType = {
|
|
|
160
163
|
/**
|
|
161
164
|
* Sets the keywords describing the application. Set this to null to clear this value.
|
|
162
165
|
*/
|
|
163
|
-
set keywords(value: string[] | null | Promise<string[]
|
|
166
|
+
set keywords(value: string[] | null | Promise<string[] | null>) {
|
|
164
167
|
if (value === null) {
|
|
165
168
|
nativeMethods.setTargetingDataKeywords(null);
|
|
166
169
|
} else if (isStringArray(value)) {
|
|
167
170
|
nativeMethods.setTargetingDataKeywords(value as string[]);
|
|
168
171
|
} else {
|
|
169
|
-
printError(
|
|
172
|
+
printError('TargetingData.keywords', 'string[] or null', typeof value);
|
|
170
173
|
}
|
|
171
174
|
},
|
|
172
175
|
|
|
@@ -186,7 +189,7 @@ export const TargetingData: TargetingDataType = {
|
|
|
186
189
|
} else if (isStringArray(value)) {
|
|
187
190
|
nativeMethods.setTargetingDataInterests(value as string[]);
|
|
188
191
|
} else {
|
|
189
|
-
printError(
|
|
192
|
+
printError('TargetingData.interests', 'string[] or null', typeof value);
|
|
190
193
|
}
|
|
191
194
|
},
|
|
192
195
|
|
|
@@ -203,12 +206,20 @@ export const TargetingData: TargetingDataType = {
|
|
|
203
206
|
clearAll(): void {
|
|
204
207
|
nativeMethods.clearAllTargetingData();
|
|
205
208
|
},
|
|
206
|
-
}
|
|
209
|
+
};
|
|
207
210
|
|
|
208
|
-
const isStringArray = (strs:
|
|
209
|
-
return Array.isArray(strs) && strs.every((value) => typeof value === 'string')
|
|
210
|
-
}
|
|
211
|
+
const isStringArray = (strs: object): boolean => {
|
|
212
|
+
return Array.isArray(strs) && strs.every((value) => typeof value === 'string');
|
|
213
|
+
};
|
|
211
214
|
|
|
212
215
|
const printError = (fieldName: string, correctType: string, wrongType: string) => {
|
|
213
|
-
console.error(
|
|
214
|
-
|
|
216
|
+
console.error(
|
|
217
|
+
'Cannot set value to ' +
|
|
218
|
+
fieldName +
|
|
219
|
+
' with unsupported type: ' +
|
|
220
|
+
wrongType +
|
|
221
|
+
'. Value has to be of type ' +
|
|
222
|
+
correctType +
|
|
223
|
+
'.'
|
|
224
|
+
);
|
|
225
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { default, AppLovinMAX } from
|
|
2
|
-
export { Privacy } from
|
|
3
|
-
export { TargetingData, AdContentRating, UserGender } from
|
|
4
|
-
export { InterstitialAd } from
|
|
5
|
-
export { RewardedAd } from
|
|
6
|
-
export { AppOpenAd } from
|
|
7
|
-
export { BannerAd } from
|
|
8
|
-
export { MRecAd } from
|
|
9
|
-
export { AdView, AdFormat, AdViewPosition } from
|
|
10
|
-
export { NativeAdView } from
|
|
1
|
+
export { default, AppLovinMAX } from './AppLovinMAX';
|
|
2
|
+
export { Privacy, ConsentFlowUserGeography, AppTrackingStatus } from './Privacy';
|
|
3
|
+
export { TargetingData, AdContentRating, UserGender } from './TargetingData';
|
|
4
|
+
export { InterstitialAd } from './InterstitialAd';
|
|
5
|
+
export { RewardedAd } from './RewardedAd';
|
|
6
|
+
export { AppOpenAd } from './AppOpenAd';
|
|
7
|
+
export { BannerAd } from './BannerAd';
|
|
8
|
+
export { MRecAd } from './MRecAd';
|
|
9
|
+
export { AdView, AdFormat, AdViewPosition } from './AdView';
|
|
10
|
+
export { NativeAdView } from './nativeAd/NativeAdView';
|
|
11
11
|
export {
|
|
12
12
|
TitleView,
|
|
13
13
|
AdvertiserView,
|
|
@@ -17,5 +17,5 @@ export {
|
|
|
17
17
|
OptionsView,
|
|
18
18
|
MediaView,
|
|
19
19
|
StarRatingView,
|
|
20
|
-
} from
|
|
21
|
-
export * from
|
|
20
|
+
} from './nativeAd/NativeAdViewComponents';
|
|
21
|
+
export * from './types';
|