react-native-applovin-max 8.2.0 → 9.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.
Files changed (196) hide show
  1. package/android/build.gradle +14 -3
  2. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +34 -27
  3. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManagerImpl.java +110 -0
  4. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +15 -13
  5. package/android/src/main/java/com/applovin/reactnative/{AppLovinMAXModule.java → AppLovinMAXModuleImpl.java} +108 -168
  6. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +84 -56
  7. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManagerImpl.java +101 -0
  8. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXPackage.java +44 -11
  9. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXUtils.java +56 -0
  10. package/android/src/newarch/com/applovin/reactnative/AppLovinMAXAdViewManager.java +151 -0
  11. package/android/src/newarch/com/applovin/reactnative/AppLovinMAXModule.java +453 -0
  12. package/android/src/newarch/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +130 -0
  13. package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXAdViewManager.java +128 -0
  14. package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXModule.java +453 -0
  15. package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +93 -0
  16. package/ios/AppLovinMAX.h +8 -3
  17. package/ios/{AppLovinMAX.m → AppLovinMAX.mm} +67 -53
  18. package/ios/AppLovinMAXAdView.h +7 -2
  19. package/ios/AppLovinMAXAdView.mm +747 -0
  20. package/ios/{AppLovinMAXAdViewManager.m → AppLovinMAXAdViewManager.mm} +3 -2
  21. package/ios/{AppLovinMAXAdViewUIComponent.m → AppLovinMAXAdViewUIComponent.mm} +2 -1
  22. package/ios/AppLovinMAXNativeAdView.h +15 -4
  23. package/ios/AppLovinMAXNativeAdView.mm +745 -0
  24. package/ios/AppLovinMAXNativeAdViewManager.mm +116 -0
  25. package/lib/commonjs/AdView.js +102 -142
  26. package/lib/commonjs/AdView.js.map +1 -1
  27. package/lib/commonjs/AppLovinMAX.js +49 -34
  28. package/lib/commonjs/AppLovinMAX.js.map +1 -1
  29. package/lib/commonjs/AppOpenAd.js +8 -10
  30. package/lib/commonjs/AppOpenAd.js.map +1 -1
  31. package/lib/commonjs/BannerAd.js +19 -21
  32. package/lib/commonjs/BannerAd.js.map +1 -1
  33. package/lib/commonjs/ErrorCode.js +27 -36
  34. package/lib/commonjs/ErrorCode.js.map +1 -1
  35. package/lib/commonjs/EventEmitter.js +24 -5
  36. package/lib/commonjs/EventEmitter.js.map +1 -1
  37. package/lib/commonjs/InterstitialAd.js +8 -10
  38. package/lib/commonjs/InterstitialAd.js.map +1 -1
  39. package/lib/commonjs/MRecAd.js +14 -16
  40. package/lib/commonjs/MRecAd.js.map +1 -1
  41. package/lib/commonjs/Privacy.js +3 -5
  42. package/lib/commonjs/Privacy.js.map +1 -1
  43. package/lib/commonjs/RewardedAd.js +8 -10
  44. package/lib/commonjs/RewardedAd.js.map +1 -1
  45. package/lib/commonjs/Utils.js +43 -0
  46. package/lib/commonjs/Utils.js.map +1 -0
  47. package/lib/commonjs/nativeAd/NativeAdView.js +84 -50
  48. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  49. package/lib/commonjs/nativeAd/NativeAdViewComponents.js +129 -82
  50. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
  51. package/lib/commonjs/nativeAd/NativeAdViewProvider.js +67 -8
  52. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
  53. package/lib/commonjs/nativeAd/img/blank_icon.png +0 -0
  54. package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js +41 -0
  55. package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -0
  56. package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js +37 -0
  57. package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -0
  58. package/lib/commonjs/specs/NativeAppLovinMAXModule.js +16 -0
  59. package/lib/commonjs/specs/NativeAppLovinMAXModule.js.map +1 -0
  60. package/lib/commonjs/types/AdInfo.js +13 -16
  61. package/lib/commonjs/types/AdInfo.js.map +1 -1
  62. package/lib/module/AdView.js +98 -139
  63. package/lib/module/AdView.js.map +1 -1
  64. package/lib/module/AppLovinMAX.js +47 -32
  65. package/lib/module/AppLovinMAX.js.map +1 -1
  66. package/lib/module/AppOpenAd.js +1 -4
  67. package/lib/module/AppOpenAd.js.map +1 -1
  68. package/lib/module/BannerAd.js +1 -4
  69. package/lib/module/BannerAd.js.map +1 -1
  70. package/lib/module/ErrorCode.js +25 -35
  71. package/lib/module/ErrorCode.js.map +1 -1
  72. package/lib/module/EventEmitter.js +24 -5
  73. package/lib/module/EventEmitter.js.map +1 -1
  74. package/lib/module/InterstitialAd.js +2 -5
  75. package/lib/module/InterstitialAd.js.map +1 -1
  76. package/lib/module/MRecAd.js +1 -4
  77. package/lib/module/MRecAd.js.map +1 -1
  78. package/lib/module/Privacy.js +1 -4
  79. package/lib/module/Privacy.js.map +1 -1
  80. package/lib/module/RewardedAd.js +2 -5
  81. package/lib/module/RewardedAd.js.map +1 -1
  82. package/lib/module/Utils.js +35 -0
  83. package/lib/module/Utils.js.map +1 -0
  84. package/lib/module/nativeAd/NativeAdView.js +83 -47
  85. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  86. package/lib/module/nativeAd/NativeAdViewComponents.js +134 -83
  87. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
  88. package/lib/module/nativeAd/NativeAdViewProvider.js +69 -9
  89. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
  90. package/lib/module/nativeAd/img/blank_icon.png +0 -0
  91. package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js +35 -0
  92. package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -0
  93. package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js +31 -0
  94. package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -0
  95. package/lib/module/specs/NativeAppLovinMAXModule.js +12 -0
  96. package/lib/module/specs/NativeAppLovinMAXModule.js.map +1 -0
  97. package/lib/module/types/AdInfo.js +13 -16
  98. package/lib/module/types/AdInfo.js.map +1 -1
  99. package/lib/typescript/src/AdView.d.ts +38 -32
  100. package/lib/typescript/src/AdView.d.ts.map +1 -1
  101. package/lib/typescript/src/AppLovinMAX.d.ts +22 -21
  102. package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
  103. package/lib/typescript/src/AppOpenAd.d.ts.map +1 -1
  104. package/lib/typescript/src/BannerAd.d.ts.map +1 -1
  105. package/lib/typescript/src/ErrorCode.d.ts +24 -31
  106. package/lib/typescript/src/ErrorCode.d.ts.map +1 -1
  107. package/lib/typescript/src/EventEmitter.d.ts +16 -0
  108. package/lib/typescript/src/EventEmitter.d.ts.map +1 -1
  109. package/lib/typescript/src/InterstitialAd.d.ts.map +1 -1
  110. package/lib/typescript/src/MRecAd.d.ts.map +1 -1
  111. package/lib/typescript/src/Privacy.d.ts.map +1 -1
  112. package/lib/typescript/src/RewardedAd.d.ts.map +1 -1
  113. package/lib/typescript/src/Utils.d.ts +31 -0
  114. package/lib/typescript/src/Utils.d.ts.map +1 -0
  115. package/lib/typescript/src/nativeAd/NativeAdView.d.ts +15 -7
  116. package/lib/typescript/src/nativeAd/NativeAdView.d.ts.map +1 -1
  117. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts +65 -1
  118. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  119. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts +31 -5
  120. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  121. package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts +130 -0
  122. package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts.map +1 -0
  123. package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts +131 -0
  124. package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts.map +1 -0
  125. package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts +142 -0
  126. package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts.map +1 -0
  127. package/lib/typescript/src/types/AdEvent.d.ts +10 -4
  128. package/lib/typescript/src/types/AdEvent.d.ts.map +1 -1
  129. package/lib/typescript/src/types/AdInfo.d.ts +79 -86
  130. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  131. package/lib/typescript/src/types/AdProps.d.ts +16 -17
  132. package/lib/typescript/src/types/AdProps.d.ts.map +1 -1
  133. package/lib/typescript/src/types/AdViewProps.d.ts +28 -29
  134. package/lib/typescript/src/types/AdViewProps.d.ts.map +1 -1
  135. package/lib/typescript/src/types/AppLovinMAX.d.ts +50 -53
  136. package/lib/typescript/src/types/AppLovinMAX.d.ts.map +1 -1
  137. package/lib/typescript/src/types/BannerAd.d.ts +22 -17
  138. package/lib/typescript/src/types/BannerAd.d.ts.map +1 -1
  139. package/lib/typescript/src/types/CMPError.d.ts +7 -4
  140. package/lib/typescript/src/types/CMPError.d.ts.map +1 -1
  141. package/lib/typescript/src/types/Configuration.d.ts +12 -14
  142. package/lib/typescript/src/types/Configuration.d.ts.map +1 -1
  143. package/lib/typescript/src/types/FullscreenAd.d.ts +39 -46
  144. package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -1
  145. package/lib/typescript/src/types/MRecAd.d.ts +7 -3
  146. package/lib/typescript/src/types/MRecAd.d.ts.map +1 -1
  147. package/lib/typescript/src/types/NativeAd.d.ts +15 -10
  148. package/lib/typescript/src/types/NativeAd.d.ts.map +1 -1
  149. package/lib/typescript/src/types/NativeAdViewProps.d.ts +4 -3
  150. package/lib/typescript/src/types/NativeAdViewProps.d.ts.map +1 -1
  151. package/lib/typescript/src/types/Privacy.d.ts +13 -6
  152. package/lib/typescript/src/types/Privacy.d.ts.map +1 -1
  153. package/lib/typescript/src/types/RewardedAd.d.ts +7 -5
  154. package/lib/typescript/src/types/RewardedAd.d.ts.map +1 -1
  155. package/lib/typescript/src/types/ViewAd.d.ts +46 -50
  156. package/lib/typescript/src/types/ViewAd.d.ts.map +1 -1
  157. package/package.json +9 -1
  158. package/react-native-applovin-max.podspec +3 -3
  159. package/src/AdView.tsx +100 -183
  160. package/src/AppLovinMAX.ts +42 -33
  161. package/src/AppOpenAd.ts +1 -3
  162. package/src/BannerAd.ts +1 -3
  163. package/src/ErrorCode.ts +25 -34
  164. package/src/EventEmitter.ts +22 -5
  165. package/src/InterstitialAd.ts +2 -4
  166. package/src/MRecAd.ts +1 -3
  167. package/src/Privacy.ts +1 -3
  168. package/src/RewardedAd.ts +2 -4
  169. package/src/Utils.ts +45 -0
  170. package/src/nativeAd/NativeAdView.tsx +83 -73
  171. package/src/nativeAd/NativeAdViewComponents.tsx +120 -89
  172. package/src/nativeAd/NativeAdViewProvider.tsx +60 -12
  173. package/src/nativeAd/img/blank_icon.png +0 -0
  174. package/src/specs/AppLovinMAXAdViewNativeComponent.ts +157 -0
  175. package/src/specs/AppLovinMAXNativeAdViewNativeComponent.ts +153 -0
  176. package/src/specs/NativeAppLovinMAXModule.ts +228 -0
  177. package/src/types/AdEvent.ts +10 -4
  178. package/src/types/AdInfo.ts +79 -86
  179. package/src/types/AdProps.ts +16 -17
  180. package/src/types/AdViewProps.ts +28 -29
  181. package/src/types/AppLovinMAX.ts +50 -53
  182. package/src/types/BannerAd.ts +22 -17
  183. package/src/types/CMPError.ts +7 -4
  184. package/src/types/Configuration.ts +12 -14
  185. package/src/types/FullscreenAd.ts +39 -46
  186. package/src/types/MRecAd.ts +7 -3
  187. package/src/types/NativeAd.ts +16 -10
  188. package/src/types/NativeAdViewProps.ts +4 -3
  189. package/src/types/Privacy.ts +13 -6
  190. package/src/types/RewardedAd.ts +7 -5
  191. package/src/types/ViewAd.ts +46 -50
  192. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +0 -149
  193. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +0 -163
  194. package/ios/AppLovinMAXAdView.m +0 -325
  195. package/ios/AppLovinMAXNativeAdView.m +0 -432
  196. package/ios/AppLovinMAXNativeAdViewManager.m +0 -64
@@ -1,25 +1,32 @@
1
+ /**
2
+ * Provides methods to manage user privacy settings for AppLovin MAX.
3
+ */
1
4
  export type PrivacyType = {
2
5
  /**
3
- * Sets whether or not the user provided consent for information-sharing with AppLovin.
6
+ * Sets whether the user has granted consent for data collection and sharing.
4
7
  *
5
- * @param hasUserConsent true if the user provided consent for information sharing.
8
+ * @param hasUserConsent - `true` if the user has provided consent.
6
9
  */
7
10
  setHasUserConsent(hasUserConsent: boolean): void;
8
11
 
9
12
  /**
10
- * Checks if user set consent for information sharing.
13
+ * Checks whether the user has granted consent for information sharing.
14
+ *
15
+ * @returns A promise that resolves to `true` if the user has granted consent.
11
16
  */
12
17
  hasUserConsent(): Promise<boolean>;
13
18
 
14
19
  /**
15
- * Sets whether or not the user opted out of the sale of their personal information.
20
+ * Sets whether the user has opted out of the sale of their personal information.
16
21
  *
17
- * @param doNotSell true if the user opted out of the sale of their personal information.
22
+ * @param doNotSell - `true` if the user opted out of personal data sale.
18
23
  */
19
24
  setDoNotSell(doNotSell: boolean): void;
20
25
 
21
26
  /**
22
- * Checks if the user opted out of the sale of their personal information.
27
+ * Checks whether the user has opted out of the sale of their personal information.
28
+ *
29
+ * @returns A promise that resolves to `true` if the user has opted out.
23
30
  */
24
31
  isDoNotSell(): Promise<boolean>;
25
32
  };
@@ -2,18 +2,20 @@ import type { AdEventListener } from './AdEvent';
2
2
  import type { AdRewardInfo } from './AdInfo';
3
3
  import type { FullscreenAdType } from './FullscreenAd';
4
4
 
5
+ /**
6
+ * Defines the interface for managing rewarded ads.
7
+ * Extends {@link FullscreenAdType} with reward-specific callbacks.
8
+ */
5
9
  export type RewardedAdType = FullscreenAdType & {
6
10
  /**
7
- * Adds the specified event listener to receive {@link AdRewardInfo} when {@link RewardedAd}
8
- * rewards the user.
11
+ * Registers a listener for when a reward is granted to the user.
9
12
  *
10
- * @param listener Listener to be notified.
13
+ * @param listener - Callback to be notified with {@link AdRewardInfo}.
11
14
  */
12
15
  addAdReceivedRewardEventListener(listener: AdEventListener<AdRewardInfo>): void;
13
16
 
14
17
  /**
15
- * Removes the event listener to receive {@link AdRewardInfo} when {@link RewardedAd} rewards
16
- * the user.
18
+ * Unregisters the reward event listener.
17
19
  */
18
20
  removeAdReceivedRewardEventListener(): void;
19
21
  };
@@ -4,159 +4,155 @@ import type { LocalExtraParameterValue } from './AdProps';
4
4
  import type { AdViewPosition } from '../AdView';
5
5
 
6
6
  /**
7
- * Define a view-based ad (i.e. Banner / MREC)
7
+ * Defines the interface for view-based ads such as Banners and MRECs.
8
8
  */
9
9
  export type ViewAdType = {
10
10
  /**
11
- * Destroys the banner/MREC.
11
+ * Destroys the banner or MREC ad.
12
12
  *
13
- * @param adUnitId The ad unit ID of the ad to destroy.
13
+ * @param adUnitId - The ad unit ID of the ad to destroy.
14
14
  */
15
15
  destroyAd(adUnitId: string): void;
16
16
 
17
17
  /**
18
- * Shows the banner/MREC.
18
+ * Displays the banner or MREC ad.
19
19
  *
20
- * @param adUnitId The ad unit ID of the ad to show.
20
+ * @param adUnitId - The ad unit ID of the ad to show.
21
21
  */
22
22
  showAd(adUnitId: string): void;
23
23
 
24
24
  /**
25
- * Hides the banner/MREC.
25
+ * Hides the banner or MREC ad.
26
26
  *
27
- * @param adUnitId The ad unit ID of the ad to hide.
27
+ * @param adUnitId - The ad unit ID of the ad to hide.
28
28
  */
29
29
  hideAd(adUnitId: string): void;
30
30
 
31
31
  /**
32
- * Sets a placement to tie the showing ad’s events to.
32
+ * Sets a placement to associate with the showing ad’s events.
33
33
  *
34
- * @param adUnitId The ad unit ID of the ad to set a placement for.
35
- * @param placement The placement to tie the showing ad's events to.
34
+ * @param adUnitId - The ad unit ID.
35
+ * @param placement - The placement name.
36
36
  */
37
37
  setPlacement(adUnitId: string, placement: string | null): void;
38
38
 
39
39
  /**
40
- * Sets custom data to tie the showing ad’s events to.
40
+ * Sets custom data to associate with the showing ad’s events.
41
41
  *
42
- * @param adUnitId The ad unit ID of the ad to set custom data for.
43
- * @param customData The custom data to tie the showing ad's events to. Maximum size is 8KB.
42
+ * @param adUnitId - The ad unit ID.
43
+ * @param customData - Optional custom string (max 8 KB).
44
44
  */
45
45
  setCustomData(adUnitId: string, customData: string | null): void;
46
46
 
47
47
  /**
48
- * Updates the banner/mrec position.
48
+ * Updates the position of the banner or MREC.
49
49
  *
50
- * @param adUnitId The ad unit ID of the ad to update the position of.
51
- * @param bannerPosition {@link AdViewPosition} position.
50
+ * @param adUnitId - The ad unit ID.
51
+ * @param bannerPosition - The new position on screen.
52
52
  */
53
53
  updatePosition(adUnitId: string, bannerPosition: AdViewPosition): void;
54
54
 
55
55
  /**
56
- * Sets an extra key/value parameter for the ad.
56
+ * Sets an extra parameter for the ad.
57
57
  *
58
- * @param adUnitId The ad unit ID of the ad to set a parameter for.
59
- * @param key Key parameter.
60
- * @param value Value parameter.
58
+ * @param adUnitId - The ad unit ID.
59
+ * @param key - Parameter name.
60
+ * @param value - Parameter value (or `null` to clear it).
61
61
  */
62
62
  setExtraParameter(adUnitId: string, key: string, value: string | null): void;
63
63
 
64
64
  /**
65
- * Set a local extra parameter to pass to the adapter instances.
65
+ * Sets a local extra parameter to be passed to the mediation adapter.
66
66
  *
67
- * @param adUnitId The ad unit ID of the ad to set a local parameter for.
68
- * @param key Key parameter.
69
- * @param value Value parameter.
67
+ * @param adUnitId - The ad unit ID.
68
+ * @param key - Parameter name.
69
+ * @param value - Parameter value (string, number, boolean, object, or null).
70
70
  */
71
71
  setLocalExtraParameter(adUnitId: string, key: string, value: LocalExtraParameterValue): void;
72
72
 
73
73
  /**
74
- * Starts or resumes auto-refreshing of the banner/mrec.
74
+ * Starts or resumes auto-refresh for the ad.
75
75
  *
76
- * @param adUnitId The ad unit ID of the ad to start or resume auto-refreshing.
76
+ * @param adUnitId - The ad unit ID.
77
77
  */
78
78
  startAutoRefresh(adUnitId: string): void;
79
79
 
80
80
  /**
81
- * Pauses auto-refreshing of the banner/mrec.
81
+ * Pauses auto-refresh for the ad.
82
82
  *
83
- * @param adUnitId The ad unit ID of the ad to stop auto-refreshing.
83
+ * @param adUnitId - The ad unit ID.
84
84
  */
85
85
  stopAutoRefresh(adUnitId: string): void;
86
86
 
87
87
  /**
88
- * Adds the specified event listener to receive {@link AdInfo} when a view-base ad loads a new ad.
88
+ * Registers a listener for when a new ad is successfully loaded.
89
89
  *
90
- * @param listener Listener to be notified.
90
+ * @param listener - Callback to be notified with {@link AdInfo}.
91
91
  */
92
92
  addAdLoadedEventListener(listener: AdEventListener<AdInfo>): void;
93
93
 
94
94
  /**
95
- * Removes the event listener to receive {@link AdInfo} when a view-base ad loads a new ad.
95
+ * Unregisters the ad loaded listener.
96
96
  */
97
97
  removeAdLoadedEventListener(): void;
98
98
 
99
99
  /**
100
- * Adds the specified event listener to receive {@link AdLoadFailedInfo} when a view-base ad
101
- * could not load a new ad.
100
+ * Registers a listener for when ad loading fails.
102
101
  *
103
- * @param listener Listener to be notified.
102
+ * @param listener - Callback to be notified with {@link AdLoadFailedInfo}.
104
103
  */
105
104
  addAdLoadFailedEventListener(listener: AdEventListener<AdLoadFailedInfo>): void;
106
105
 
107
106
  /**
108
- * Removes the event listener to receive {@link AdLoadFailedInfo} when a view-base ad could not
109
- * load a new ad.
107
+ * Unregisters the ad load failure listener.
110
108
  */
111
109
  removeAdLoadFailedEventListener(): void;
112
110
 
113
111
  /**
114
- * Adds the specified event listener to receive {@link AdInfo} when the user clicks the ad.
112
+ * Registers a listener for ad click events.
115
113
  *
116
- * @param listener Listener to be notified.
114
+ * @param listener - Callback to be notified with {@link AdInfo}.
117
115
  */
118
116
  addAdClickedEventListener(listener: AdEventListener<AdInfo>): void;
119
117
 
120
118
  /**
121
- * Removes the event listener to receive {@link AdInfo} when the user clicks the ad.
119
+ * Unregisters the ad click listener.
122
120
  */
123
121
  removeAdClickedEventListener(): void;
124
122
 
125
123
  /**
126
- * Adds the specified event listener to receive {@link AdInfo} when a view-base ad collapses the ad.
124
+ * Registers a listener for when the ad collapses (e.g. after expansion).
127
125
  *
128
- * @param listener Listener to be notified.
126
+ * @param listener - Callback to be notified with {@link AdInfo}.
129
127
  */
130
128
  addAdCollapsedEventListener(listener: AdEventListener<AdInfo>): void;
131
129
 
132
130
  /**
133
- * Removes the event listener to receive {@link AdInfo} when a view-base ad collapses the ad.
131
+ * Unregisters the ad collapsed listener.
134
132
  */
135
133
  removeAdCollapsedEventListener(): void;
136
134
 
137
135
  /**
138
- * Adds the specified event listener to receive {@link AdInfo} when a view-base ad expands the ad.
136
+ * Registers a listener for when the ad expands.
139
137
  *
140
- * @param listener Listener to be notified.
138
+ * @param listener - Callback to be notified with {@link AdInfo}.
141
139
  */
142
140
  addAdExpandedEventListener(listener: AdEventListener<AdInfo>): void;
143
141
 
144
142
  /**
145
- * Removes the event listener to receive {@link AdInfo} when a view-base ad expands the ad.
143
+ * Unregisters the ad expanded listener.
146
144
  */
147
145
  removeAdExpandedEventListener(): void;
148
146
 
149
147
  /**
150
- * Adds the specified event listener to receive {@link AdInfo} when a view-base ad pays
151
- * ad revenue to the publisher.
148
+ * Registers a listener for when the ad pays revenue to the publisher.
152
149
  *
153
- * @param listener Listener to be notified.
150
+ * @param listener - Callback to be notified with {@link AdInfo}.
154
151
  */
155
152
  addAdRevenuePaidListener(listener: AdEventListener<AdInfo>): void;
156
153
 
157
154
  /**
158
- * Removes the event listener to receive {@link AdInfo} when when a view-base ad pays ad
159
- * revenue to the publisher.
155
+ * Unregisters the ad revenue paid listener.
160
156
  */
161
157
  removeAdRevenuePaidListener(): void;
162
158
  };
@@ -1,149 +0,0 @@
1
- package com.applovin.reactnative;
2
-
3
- import com.facebook.react.bridge.ReadableArray;
4
- import com.facebook.react.bridge.ReadableMap;
5
- import com.facebook.react.common.MapBuilder;
6
- import com.facebook.react.uimanager.SimpleViewManager;
7
- import com.facebook.react.uimanager.ThemedReactContext;
8
- import com.facebook.react.uimanager.annotations.ReactProp;
9
-
10
- import java.util.Map;
11
-
12
- import androidx.annotation.NonNull;
13
- import androidx.annotation.Nullable;
14
-
15
- /**
16
- * Created by Thomas So on September 26 2020
17
- */
18
- class AppLovinMAXAdViewManager
19
- extends SimpleViewManager<AppLovinMAXAdView>
20
- {
21
- private static final int COMMAND_LOAD_AD = 1;
22
-
23
- public AppLovinMAXAdViewManager() { }
24
-
25
- @NonNull
26
- @Override
27
- public String getName()
28
- {
29
- return "AppLovinMAXAdView";
30
- }
31
-
32
- @Nullable
33
- @Override
34
- public Map<String, Object> getExportedCustomDirectEventTypeConstants()
35
- {
36
- // mapping Android events to JavaScript events
37
- return MapBuilder.<String, Object>builder()
38
- .put( AppLovinMAXAdEvents.ON_AD_LOADED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOADED_EVENT ) )
39
- .put( AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT ) )
40
- .put( AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT ) )
41
- .put( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT ) )
42
- .put( AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT ) )
43
- .put( AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT ) )
44
- .put( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT ) )
45
- .build();
46
- }
47
-
48
- @Nullable
49
- @Override
50
- public Map<String, Integer> getCommandsMap()
51
- {
52
- return MapBuilder.of(
53
- "loadAd", COMMAND_LOAD_AD
54
- );
55
- }
56
-
57
- @Override
58
- public void receiveCommand(@NonNull final AppLovinMAXAdView view, final int commandId, @Nullable final ReadableArray args)
59
- {
60
- if ( commandId == COMMAND_LOAD_AD )
61
- {
62
- view.loadAd();
63
- }
64
- }
65
-
66
- @NonNull
67
- @Override
68
- protected AppLovinMAXAdView createViewInstance(@NonNull final ThemedReactContext reactContext)
69
- {
70
- // 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
71
- return new AppLovinMAXAdView( reactContext );
72
- }
73
-
74
- @ReactProp(name = "adUnitId")
75
- public void setAdUnitId(final AppLovinMAXAdView view, final String adUnitId)
76
- {
77
- view.setAdUnitId( adUnitId );
78
- }
79
-
80
- @ReactProp(name = "adFormat")
81
- public void setAdFormat(final AppLovinMAXAdView view, final String adFormatStr)
82
- {
83
- view.setAdFormat( adFormatStr );
84
- }
85
-
86
- @ReactProp(name = "adViewId")
87
- public void setAdViewId(final AppLovinMAXAdView view, final int adViewId)
88
- {
89
- view.setAdViewId( adViewId );
90
- }
91
-
92
- @ReactProp(name = "placement")
93
- public void setPlacement(final AppLovinMAXAdView view, @Nullable final String placement)
94
- {
95
- view.setPlacement( placement );
96
- }
97
-
98
- @ReactProp(name = "customData")
99
- public void setCustomData(final AppLovinMAXAdView view, @Nullable final String customData)
100
- {
101
- view.setCustomData( customData );
102
- }
103
-
104
- @ReactProp(name = "adaptiveBannerEnabled")
105
- public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final boolean enabled)
106
- {
107
- view.setAdaptiveBannerEnabled( enabled );
108
- }
109
-
110
- @ReactProp(name = "autoRefresh")
111
- public void setAutoRefresh(final AppLovinMAXAdView view, final boolean enabled)
112
- {
113
- view.setAutoRefreshEnabled( enabled );
114
- }
115
-
116
- @ReactProp(name = "loadOnMount")
117
- public void setLoadOnMount(final AppLovinMAXAdView view, final boolean enabled)
118
- {
119
- view.setLoadOnMount( enabled );
120
- }
121
-
122
- @ReactProp(name = "extraParameters")
123
- public void setExtraParameters(final AppLovinMAXAdView view, @Nullable final ReadableMap value)
124
- {
125
- view.setExtraParameters( value );
126
- }
127
-
128
- @ReactProp(name = "localExtraParameters")
129
- public void setLocalExtraParameters(final AppLovinMAXAdView view, @Nullable final ReadableMap value)
130
- {
131
- view.setLocalExtraParameters( value );
132
- }
133
-
134
- @Override
135
- public void onAfterUpdateTransaction(@NonNull final AppLovinMAXAdView view)
136
- {
137
- super.onAfterUpdateTransaction( view );
138
-
139
- view.onSetProps();
140
- }
141
-
142
- @Override
143
- public void onDropViewInstance(AppLovinMAXAdView view)
144
- {
145
- view.destroy();
146
-
147
- super.onDropViewInstance( view );
148
- }
149
- }
@@ -1,163 +0,0 @@
1
- package com.applovin.reactnative;
2
-
3
- import com.facebook.react.bridge.ReadableArray;
4
- import com.facebook.react.bridge.ReadableMap;
5
- import com.facebook.react.common.MapBuilder;
6
- import com.facebook.react.uimanager.ThemedReactContext;
7
- import com.facebook.react.uimanager.ViewGroupManager;
8
- import com.facebook.react.uimanager.annotations.ReactProp;
9
-
10
- import java.util.Map;
11
-
12
- import androidx.annotation.NonNull;
13
- import androidx.annotation.Nullable;
14
-
15
- public class AppLovinMAXNativeAdViewManager
16
- extends ViewGroupManager<AppLovinMAXNativeAdView>
17
- {
18
- public static final String REACT_CLASS = "AppLovinMAXNativeAdView";
19
-
20
- public final int COMMAND_LOAD_AD = 1;
21
-
22
- public AppLovinMAXNativeAdViewManager() { }
23
-
24
- @NonNull
25
- @Override
26
- protected AppLovinMAXNativeAdView createViewInstance(@NonNull final ThemedReactContext reactContext)
27
- {
28
- return new AppLovinMAXNativeAdView( reactContext );
29
- }
30
-
31
- @NonNull
32
- @Override
33
- public String getName()
34
- {
35
- return REACT_CLASS;
36
- }
37
-
38
- /// Callback to JavaScript
39
-
40
- @Nullable
41
- @Override
42
- public Map<String, Object> getExportedCustomDirectEventTypeConstants()
43
- {
44
- // mapping Android events to JavaScript events
45
- return MapBuilder.<String, Object>builder()
46
- .put( AppLovinMAXAdEvents.ON_AD_LOADED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOADED_EVENT ) )
47
- .put( AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT ) )
48
- .put( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT ) )
49
- .put( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT ) )
50
- .build();
51
- }
52
-
53
- /// Call from JavaScript
54
-
55
- @Nullable
56
- @Override
57
- public Map<String, Integer> getCommandsMap()
58
- {
59
- return MapBuilder.of(
60
- "loadAd", COMMAND_LOAD_AD
61
- );
62
- }
63
-
64
- // NOTE: the method is deprecated but the new version won't work
65
- @Override
66
- public void receiveCommand(@NonNull final AppLovinMAXNativeAdView root, final int commandId, @Nullable final ReadableArray args)
67
- {
68
- if ( commandId == COMMAND_LOAD_AD )
69
- {
70
- root.loadAd();
71
- }
72
- }
73
-
74
- /// Property Setters
75
-
76
- @ReactProp(name = "adUnitId")
77
- public void setAdUnitId(final AppLovinMAXNativeAdView view, final String value)
78
- {
79
- view.setAdUnitId( value );
80
- }
81
-
82
- @ReactProp(name = "placement")
83
- public void setPlacement(final AppLovinMAXNativeAdView view, @Nullable final String value)
84
- {
85
- view.setPlacement( value );
86
- }
87
-
88
- @ReactProp(name = "customData")
89
- public void setCustomData(final AppLovinMAXNativeAdView view, @Nullable final String value)
90
- {
91
- view.setCustomData( value );
92
- }
93
-
94
- @ReactProp(name = "extraParameters")
95
- public void setExtraParameters(final AppLovinMAXNativeAdView view, @Nullable final ReadableMap value)
96
- {
97
- view.setExtraParameters( value );
98
- }
99
-
100
- @ReactProp(name = "localExtraParameters")
101
- public void setLocalExtraParameters(final AppLovinMAXNativeAdView view, @Nullable final ReadableMap value)
102
- {
103
- view.setLocalExtraParameters( value );
104
- }
105
-
106
- @ReactProp(name = "titleView")
107
- public void setTitleView(final AppLovinMAXNativeAdView view, final int value)
108
- {
109
- view.setTitleView( value );
110
- }
111
-
112
- @ReactProp(name = "advertiserView")
113
- public void setAdvertiserView(final AppLovinMAXNativeAdView view, final int value)
114
- {
115
- view.setAdvertiserView( value );
116
- }
117
-
118
- @ReactProp(name = "bodyView")
119
- public void setBodyView(final AppLovinMAXNativeAdView view, final int value)
120
- {
121
- view.setBodyView( value );
122
- }
123
-
124
- @ReactProp(name = "callToActionView")
125
- public void setCallToActionView(final AppLovinMAXNativeAdView view, final int value)
126
- {
127
- view.setCallToActionView( value );
128
- }
129
-
130
- @ReactProp(name = "iconView")
131
- public void setIconView(final AppLovinMAXNativeAdView view, final int value)
132
- {
133
- view.setIconView( value );
134
- }
135
-
136
- @ReactProp(name = "optionsView")
137
- public void setOptionsView(final AppLovinMAXNativeAdView view, final int value)
138
- {
139
- view.setOptionsView( value );
140
- }
141
-
142
- @ReactProp(name = "mediaView")
143
- public void setMediaView(final AppLovinMAXNativeAdView view, final int value)
144
- {
145
- view.setMediaView( value );
146
- }
147
-
148
- @Override
149
- public void onAfterUpdateTransaction(@NonNull final AppLovinMAXNativeAdView view)
150
- {
151
- super.onAfterUpdateTransaction( view );
152
-
153
- view.onSetProps();
154
- }
155
-
156
- @Override
157
- public void onDropViewInstance(@NonNull final AppLovinMAXNativeAdView view)
158
- {
159
- view.destroy();
160
-
161
- super.onDropViewInstance( view );
162
- }
163
- }