react-native-applovin-max 6.5.0 → 7.0.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.
Files changed (238) hide show
  1. package/android/build.gradle +46 -100
  2. package/android/gradle.properties +4 -4
  3. package/android/src/main/AndroidManifest.xml +2 -2
  4. package/android/src/main/AndroidManifestNew.xml +2 -0
  5. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +123 -163
  6. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +24 -17
  7. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +242 -0
  8. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +297 -336
  9. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +13 -12
  10. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +11 -14
  11. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXPackage.java +3 -3
  12. package/ios/AppLovinMAX.h +1 -1
  13. package/ios/AppLovinMAX.m +62 -12
  14. package/ios/AppLovinMAXAdView.h +12 -0
  15. package/ios/AppLovinMAXAdView.m +120 -142
  16. package/ios/AppLovinMAXAdViewUIComponent.h +27 -0
  17. package/ios/AppLovinMAXAdViewUIComponent.m +199 -0
  18. package/lib/commonjs/AdView.js +348 -0
  19. package/lib/commonjs/AdView.js.map +1 -0
  20. package/lib/commonjs/AppLovinMAX.js +52 -0
  21. package/lib/commonjs/AppLovinMAX.js.map +1 -0
  22. package/lib/commonjs/AppOpenAd.js +102 -0
  23. package/lib/commonjs/AppOpenAd.js.map +1 -0
  24. package/lib/commonjs/BannerAd.js +139 -0
  25. package/lib/commonjs/BannerAd.js.map +1 -0
  26. package/lib/commonjs/EventEmitter.js +32 -0
  27. package/lib/commonjs/EventEmitter.js.map +1 -0
  28. package/lib/commonjs/InterstitialAd.js +102 -0
  29. package/lib/commonjs/InterstitialAd.js.map +1 -0
  30. package/lib/commonjs/MRecAd.js +117 -0
  31. package/lib/commonjs/MRecAd.js.map +1 -0
  32. package/lib/commonjs/Privacy.js +12 -0
  33. package/lib/commonjs/Privacy.js.map +1 -0
  34. package/lib/commonjs/RewardedAd.js +116 -0
  35. package/lib/commonjs/RewardedAd.js.map +1 -0
  36. package/lib/commonjs/TargetingData.js +179 -0
  37. package/lib/commonjs/TargetingData.js.map +1 -0
  38. package/lib/commonjs/index.js +256 -0
  39. package/lib/commonjs/index.js.map +1 -0
  40. package/lib/commonjs/nativeAd/NativeAdView.js +147 -0
  41. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -0
  42. package/lib/commonjs/nativeAd/NativeAdViewComponents.js +197 -0
  43. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -0
  44. package/lib/commonjs/nativeAd/NativeAdViewProvider.js +37 -0
  45. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -0
  46. package/lib/commonjs/types/AdEvent.js +6 -0
  47. package/lib/commonjs/types/AdEvent.js.map +1 -0
  48. package/lib/commonjs/types/AdInfo.js +48 -0
  49. package/lib/commonjs/types/AdInfo.js.map +1 -0
  50. package/lib/commonjs/types/AdProps.js +6 -0
  51. package/lib/commonjs/types/AdProps.js.map +1 -0
  52. package/lib/commonjs/types/AdViewProps.js +6 -0
  53. package/lib/commonjs/types/AdViewProps.js.map +1 -0
  54. package/lib/commonjs/types/AppLovinMAX.js +6 -0
  55. package/lib/commonjs/types/AppLovinMAX.js.map +1 -0
  56. package/lib/commonjs/types/AppOpenAd.js +6 -0
  57. package/lib/commonjs/types/AppOpenAd.js.map +1 -0
  58. package/lib/commonjs/types/BannerAd.js +6 -0
  59. package/lib/commonjs/types/BannerAd.js.map +1 -0
  60. package/lib/commonjs/types/CMPError.js +6 -0
  61. package/lib/commonjs/types/CMPError.js.map +1 -0
  62. package/lib/commonjs/types/Configuration.js +6 -0
  63. package/lib/commonjs/types/Configuration.js.map +1 -0
  64. package/lib/commonjs/types/FullscreenAd.js +6 -0
  65. package/lib/commonjs/types/FullscreenAd.js.map +1 -0
  66. package/lib/commonjs/types/InterstitialAd.js +6 -0
  67. package/lib/commonjs/types/InterstitialAd.js.map +1 -0
  68. package/lib/commonjs/types/MRecAd.js +6 -0
  69. package/lib/commonjs/types/MRecAd.js.map +1 -0
  70. package/lib/commonjs/types/NativeAd.js +2 -0
  71. package/lib/commonjs/types/NativeAd.js.map +1 -0
  72. package/lib/commonjs/types/NativeAdViewProps.js +6 -0
  73. package/lib/commonjs/types/NativeAdViewProps.js.map +1 -0
  74. package/lib/commonjs/types/Privacy.js +2 -0
  75. package/lib/commonjs/types/Privacy.js.map +1 -0
  76. package/lib/commonjs/types/RewardedAd.js +6 -0
  77. package/lib/commonjs/types/RewardedAd.js.map +1 -0
  78. package/lib/commonjs/types/TargetingData.js +6 -0
  79. package/lib/commonjs/types/TargetingData.js.map +1 -0
  80. package/lib/commonjs/types/ViewAd.js +6 -0
  81. package/lib/commonjs/types/ViewAd.js.map +1 -0
  82. package/lib/commonjs/types/index.js +61 -0
  83. package/lib/commonjs/types/index.js.map +1 -0
  84. package/lib/module/AdView.js +335 -0
  85. package/lib/module/AdView.js.map +1 -0
  86. package/lib/module/AppLovinMAX.js +48 -0
  87. package/lib/module/AppLovinMAX.js.map +1 -0
  88. package/lib/module/AppOpenAd.js +96 -0
  89. package/lib/module/AppOpenAd.js.map +1 -0
  90. package/lib/module/BannerAd.js +133 -0
  91. package/lib/module/BannerAd.js.map +1 -0
  92. package/lib/module/EventEmitter.js +24 -0
  93. package/lib/module/EventEmitter.js.map +1 -0
  94. package/lib/module/InterstitialAd.js +96 -0
  95. package/lib/module/InterstitialAd.js.map +1 -0
  96. package/lib/module/MRecAd.js +111 -0
  97. package/lib/module/MRecAd.js.map +1 -0
  98. package/lib/module/Privacy.js +6 -0
  99. package/lib/module/Privacy.js.map +1 -0
  100. package/lib/module/RewardedAd.js +110 -0
  101. package/lib/module/RewardedAd.js.map +1 -0
  102. package/lib/module/TargetingData.js +175 -0
  103. package/lib/module/TargetingData.js.map +1 -0
  104. package/lib/module/index.js +14 -0
  105. package/lib/module/index.js.map +1 -0
  106. package/lib/module/nativeAd/NativeAdView.js +139 -0
  107. package/lib/module/nativeAd/NativeAdView.js.map +1 -0
  108. package/lib/module/nativeAd/NativeAdViewComponents.js +181 -0
  109. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -0
  110. package/lib/module/nativeAd/NativeAdViewProvider.js +28 -0
  111. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -0
  112. package/lib/module/types/AdEvent.js +2 -0
  113. package/lib/module/types/AdEvent.js.map +1 -0
  114. package/lib/module/types/AdInfo.js +52 -0
  115. package/lib/module/types/AdInfo.js.map +1 -0
  116. package/lib/module/types/AdProps.js +2 -0
  117. package/lib/module/types/AdProps.js.map +1 -0
  118. package/lib/module/types/AdViewProps.js +2 -0
  119. package/lib/module/types/AdViewProps.js.map +1 -0
  120. package/lib/module/types/AppLovinMAX.js +2 -0
  121. package/lib/module/types/AppLovinMAX.js.map +1 -0
  122. package/lib/module/types/AppOpenAd.js +2 -0
  123. package/lib/module/types/AppOpenAd.js.map +1 -0
  124. package/lib/module/types/BannerAd.js +2 -0
  125. package/lib/module/types/BannerAd.js.map +1 -0
  126. package/lib/module/types/CMPError.js +2 -0
  127. package/lib/module/types/CMPError.js.map +1 -0
  128. package/lib/module/types/Configuration.js +2 -0
  129. package/lib/module/types/Configuration.js.map +1 -0
  130. package/lib/module/types/FullscreenAd.js +2 -0
  131. package/lib/module/types/FullscreenAd.js.map +1 -0
  132. package/lib/module/types/InterstitialAd.js +2 -0
  133. package/lib/module/types/InterstitialAd.js.map +1 -0
  134. package/lib/module/types/MRecAd.js +2 -0
  135. package/lib/module/types/MRecAd.js.map +1 -0
  136. package/lib/module/types/NativeAd.js +2 -0
  137. package/lib/module/types/NativeAd.js.map +1 -0
  138. package/lib/module/types/NativeAdViewProps.js +2 -0
  139. package/lib/module/types/NativeAdViewProps.js.map +1 -0
  140. package/lib/module/types/Privacy.js +2 -0
  141. package/lib/module/types/Privacy.js.map +1 -0
  142. package/lib/module/types/RewardedAd.js +2 -0
  143. package/lib/module/types/RewardedAd.js.map +1 -0
  144. package/lib/module/types/TargetingData.js +2 -0
  145. package/lib/module/types/TargetingData.js.map +1 -0
  146. package/lib/module/types/ViewAd.js +2 -0
  147. package/lib/module/types/ViewAd.js.map +1 -0
  148. package/lib/module/types/index.js +6 -0
  149. package/lib/module/types/index.js.map +1 -0
  150. package/lib/typescript/src/AdView.d.ts +115 -0
  151. package/lib/typescript/src/AdView.d.ts.map +1 -0
  152. package/lib/typescript/src/AppLovinMAX.d.ts +73 -0
  153. package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -0
  154. package/lib/typescript/src/AppOpenAd.d.ts +4 -0
  155. package/lib/typescript/src/AppOpenAd.d.ts.map +1 -0
  156. package/lib/typescript/src/BannerAd.d.ts +4 -0
  157. package/lib/typescript/src/BannerAd.d.ts.map +1 -0
  158. package/lib/typescript/src/EventEmitter.d.ts +4 -0
  159. package/lib/typescript/src/EventEmitter.d.ts.map +1 -0
  160. package/lib/typescript/src/InterstitialAd.d.ts +4 -0
  161. package/lib/typescript/src/InterstitialAd.d.ts.map +1 -0
  162. package/lib/typescript/src/MRecAd.d.ts +4 -0
  163. package/lib/typescript/src/MRecAd.d.ts.map +1 -0
  164. package/lib/typescript/src/Privacy.d.ts +3 -0
  165. package/lib/typescript/src/Privacy.d.ts.map +1 -0
  166. package/lib/typescript/src/RewardedAd.d.ts +4 -0
  167. package/lib/typescript/src/RewardedAd.d.ts.map +1 -0
  168. package/lib/typescript/src/TargetingData.d.ts +26 -0
  169. package/lib/typescript/src/TargetingData.d.ts.map +1 -0
  170. package/lib/typescript/src/index.d.ts +14 -0
  171. package/lib/typescript/src/index.d.ts.map +1 -0
  172. package/lib/typescript/src/nativeAd/NativeAdView.d.ts +42 -0
  173. package/lib/typescript/src/nativeAd/NativeAdView.d.ts.map +1 -0
  174. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts +11 -0
  175. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -0
  176. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts +16 -0
  177. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -0
  178. package/lib/typescript/src/types/AdEvent.d.ts +15 -0
  179. package/lib/typescript/src/types/AdEvent.d.ts.map +1 -0
  180. package/lib/typescript/src/types/AdInfo.d.ts +295 -0
  181. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -0
  182. package/lib/typescript/src/types/AdProps.d.ts +58 -0
  183. package/lib/typescript/src/types/AdProps.d.ts.map +1 -0
  184. package/lib/typescript/src/types/AdViewProps.d.ts +73 -0
  185. package/lib/typescript/src/types/AdViewProps.d.ts.map +1 -0
  186. package/lib/typescript/src/types/AppLovinMAX.d.ts +133 -0
  187. package/lib/typescript/src/types/AppLovinMAX.d.ts.map +1 -0
  188. package/lib/typescript/src/types/AppOpenAd.d.ts +3 -0
  189. package/lib/typescript/src/types/AppOpenAd.d.ts.map +1 -0
  190. package/lib/typescript/src/types/BannerAd.d.ts +42 -0
  191. package/lib/typescript/src/types/BannerAd.d.ts.map +1 -0
  192. package/lib/typescript/src/types/CMPError.d.ts +20 -0
  193. package/lib/typescript/src/types/CMPError.d.ts.map +1 -0
  194. package/lib/typescript/src/types/Configuration.d.ts +33 -0
  195. package/lib/typescript/src/types/Configuration.d.ts.map +1 -0
  196. package/lib/typescript/src/types/FullscreenAd.d.ts +123 -0
  197. package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -0
  198. package/lib/typescript/src/types/InterstitialAd.d.ts +3 -0
  199. package/lib/typescript/src/types/InterstitialAd.d.ts.map +1 -0
  200. package/lib/typescript/src/types/MRecAd.d.ts +12 -0
  201. package/lib/typescript/src/types/MRecAd.d.ts.map +1 -0
  202. package/lib/typescript/src/types/NativeAd.d.ts +42 -0
  203. package/lib/typescript/src/types/NativeAd.d.ts.map +1 -0
  204. package/lib/typescript/src/types/NativeAdViewProps.d.ts +15 -0
  205. package/lib/typescript/src/types/NativeAdViewProps.d.ts.map +1 -0
  206. package/lib/typescript/src/types/Privacy.d.ts +35 -0
  207. package/lib/typescript/src/types/Privacy.d.ts.map +1 -0
  208. package/lib/typescript/src/types/RewardedAd.d.ts +18 -0
  209. package/lib/typescript/src/types/RewardedAd.d.ts.map +1 -0
  210. package/lib/typescript/src/types/TargetingData.d.ts +43 -0
  211. package/lib/typescript/src/types/TargetingData.d.ts.map +1 -0
  212. package/lib/typescript/src/types/ViewAd.d.ts +141 -0
  213. package/lib/typescript/src/types/ViewAd.d.ts.map +1 -0
  214. package/lib/typescript/src/types/index.d.ts +6 -0
  215. package/lib/typescript/src/types/index.d.ts.map +1 -0
  216. package/package.json +102 -21
  217. package/react-native-applovin-max.podspec +29 -5
  218. package/src/AdView.tsx +83 -26
  219. package/src/AppLovinMAX.ts +1 -1
  220. package/src/InterstitialAd.ts +1 -3
  221. package/src/MRecAd.ts +2 -8
  222. package/src/TargetingData.ts +2 -15
  223. package/src/index.ts +9 -10
  224. package/src/nativeAd/NativeAdView.tsx +33 -49
  225. package/src/nativeAd/NativeAdViewComponents.tsx +22 -31
  226. package/src/types/AdViewProps.ts +29 -1
  227. package/android/.project +0 -17
  228. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  229. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  230. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  231. package/android/gradlew +0 -172
  232. package/android/gradlew.bat +0 -84
  233. package/ios/AppLovinMAX.xcodeproj/project.pbxproj +0 -368
  234. package/ios/AppLovinMAX.xcodeproj/xcshareddata/xcschemes/AppLovinMAX.xcscheme +0 -67
  235. package/ios/AppLovinMAX.xcworkspace/contents.xcworkspacedata +0 -10
  236. package/ios/AppLovinMAX.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  237. package/ios/Podfile +0 -40
  238. package/ios/Podfile.lock +0 -373
package/package.json CHANGED
@@ -1,39 +1,120 @@
1
1
  {
2
2
  "name": "react-native-applovin-max",
3
- "author": "AppLovin Corporation",
4
- "version": "6.5.0",
3
+ "author": "AppLovin Corporation <support@applovin.com> (https://applovin.com)",
4
+ "version": "7.0.1",
5
5
  "description": "AppLovin MAX React Native Plugin for Android and iOS",
6
- "homepage": "https://github.com/AppLovin/AppLovin-MAX-React-Native",
7
- "license": "MIT",
8
- "main": "src/index",
6
+ "main": "lib/commonjs/index",
7
+ "module": "lib/module/index",
8
+ "types": "lib/typescript/src/index.d.ts",
9
9
  "react-native": "src/index",
10
10
  "source": "src/index",
11
- "module": "lib/module/index",
12
11
  "files": [
13
12
  "src",
13
+ "lib",
14
14
  "android",
15
15
  "ios",
16
16
  "react-native-applovin-max.podspec",
17
- "package.json"
18
- ],
19
- "scripts": {},
20
- "keywords": [
21
- "react-native",
22
- "applovin",
23
- "max"
17
+ "package.json",
18
+ "!ios/build",
19
+ "!android/build",
20
+ "!android/gradle",
21
+ "!android/gradlew",
22
+ "!android/gradlew.bat",
23
+ "!android/local.properties",
24
+ "!**/__tests__",
25
+ "!**/__fixtures__",
26
+ "!**/__mocks__",
27
+ "!**/.*"
24
28
  ],
25
- "repository": "https://github.com/AppLovin/AppLovin-MAX-React-Native",
29
+ "scripts": {
30
+ "prepare": "bob build"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/AppLovin/AppLovin-MAX-React-Native.git"
35
+ },
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/AppLovin/AppLovin-MAX-React-Native/issues"
39
+ },
40
+ "homepage": "https://github.com/AppLovin/AppLovin-MAX-React-Native#readme",
26
41
  "devDependencies": {
27
- "@types/react-native": "^0.63.1",
28
- "@typescript-eslint/eslint-plugin": "^6.11.0",
29
- "@typescript-eslint/parser": "^6.11.0",
30
- "eslint": "^8.53.0",
31
- "eslint-plugin-react": "^7.33.2",
32
- "react": "^16.13.1",
33
- "react-native": "^0.63.1"
42
+ "@commitlint/config-conventional": "^17.0.2",
43
+ "@evilmartians/lefthook": "^1.5.0",
44
+ "@react-native/eslint-config": "^0.73.1",
45
+ "@types/react": "^18.2.44",
46
+ "commitlint": "^17.0.2",
47
+ "eslint": "^8.51.0",
48
+ "eslint-config-prettier": "^9.0.0",
49
+ "eslint-plugin-prettier": "^5.0.1",
50
+ "prettier": "^3.0.3",
51
+ "react": "18.2.0",
52
+ "react-native": "0.73.6",
53
+ "react-native-builder-bob": "^0.20.0",
54
+ "typescript": "^5.2.2"
55
+ },
56
+ "resolutions": {
57
+ "@types/react": "^18.2.44"
34
58
  },
35
59
  "peerDependencies": {
36
60
  "react": "*",
37
61
  "react-native": "*"
62
+ },
63
+ "workspaces": [
64
+ "example"
65
+ ],
66
+ "packageManager": "yarn@3.6.1",
67
+ "commitlint": {
68
+ "extends": [
69
+ "@commitlint/config-conventional"
70
+ ]
71
+ },
72
+ "eslintConfig": {
73
+ "root": true,
74
+ "extends": [
75
+ "@react-native",
76
+ "prettier"
77
+ ],
78
+ "rules": {
79
+ "prettier/prettier": [
80
+ "error",
81
+ {
82
+ "quoteProps": "consistent",
83
+ "singleQuote": true,
84
+ "tabWidth": 4,
85
+ "trailingComma": "es5",
86
+ "useTabs": false,
87
+ "printWidth": 180,
88
+ "endOfLine": "auto"
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ "eslintIgnore": [
94
+ "node_modules/",
95
+ "lib/"
96
+ ],
97
+ "prettier": {
98
+ "quoteProps": "consistent",
99
+ "singleQuote": true,
100
+ "tabWidth": 4,
101
+ "trailingComma": "es5",
102
+ "useTabs": false,
103
+ "printWidth": 180,
104
+ "endOfLine": "auto"
105
+ },
106
+ "react-native-builder-bob": {
107
+ "source": "src",
108
+ "output": "lib",
109
+ "targets": [
110
+ "commonjs",
111
+ "module",
112
+ [
113
+ "typescript",
114
+ {
115
+ "project": "tsconfig.build.json"
116
+ }
117
+ ]
118
+ ]
38
119
  }
39
120
  }
@@ -1,6 +1,7 @@
1
1
  require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
4
5
 
5
6
  Pod::Spec.new do |s|
6
7
  s.name = "react-native-applovin-max"
@@ -10,11 +11,34 @@ Pod::Spec.new do |s|
10
11
  s.license = package["license"]
11
12
  s.authors = package["author"]
12
13
 
13
- s.platforms = { :ios => "10.0" }
14
- s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_5_0" }
15
-
16
- s.source_files = "ios/AppLovinMAX*.{h,m}"
14
+ s.platforms = { :ios => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_7_0_1" }
16
+
17
+ s.source_files = "ios/AppLovinMAX*.{h,m}"
17
18
 
18
- s.dependency "React"
19
19
  s.dependency "AppLovinSDK", "12.5.0"
20
+
21
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
23
+ if respond_to?(:install_modules_dependencies, true)
24
+ install_modules_dependencies(s)
25
+ else
26
+ s.dependency "React-Core"
27
+
28
+ # Don't install the dependencies when we run `pod install` in the old architecture.
29
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
30
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
31
+ s.pod_target_xcconfig = {
32
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
33
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
34
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
35
+ }
36
+ s.dependency "React-RCTFabric"
37
+ s.dependency "React-Codegen"
38
+ s.dependency "RCT-Folly"
39
+ s.dependency "RCTRequired"
40
+ s.dependency "RCTTypeSafety"
41
+ s.dependency "ReactCommon/turbomodule/core"
42
+ end
43
+ end
20
44
  end
package/src/AdView.tsx CHANGED
@@ -1,17 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { useEffect, useState, useRef, useCallback, useImperativeHandle, useReducer, forwardRef } from 'react';
3
- import {
4
- NativeModules,
5
- requireNativeComponent,
6
- StyleSheet,
7
- UIManager,
8
- findNodeHandle,
9
- useWindowDimensions,
10
- } from 'react-native';
3
+ import { NativeModules, requireNativeComponent, StyleSheet, UIManager, findNodeHandle, useWindowDimensions } from 'react-native';
11
4
  import type { ViewProps, ViewStyle, StyleProp, NativeMethods, DimensionValue } from 'react-native';
12
5
  import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
13
6
  import type { AdNativeEvent } from './types/AdEvent';
14
- import type { AdViewProps, AdViewHandler } from './types/AdViewProps';
7
+ import type { AdViewProps, AdViewHandler, NativeUIComponentAdViewOptions } from './types/AdViewProps';
8
+ import { addEventListener, removeEventListener } from './EventEmitter';
15
9
 
16
10
  const { AppLovinMAX } = NativeModules;
17
11
 
@@ -28,6 +22,9 @@ const {
28
22
  BOTTOM_LEFT_POSITION,
29
23
  BOTTOM_CENTER_POSITION,
30
24
  BOTTOM_RIGHT_POSITION,
25
+
26
+ ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT,
27
+ ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT,
31
28
  } = AppLovinMAX.getConstants();
32
29
 
33
30
  /**
@@ -89,12 +86,7 @@ const getOutlineViewSize = (style: StyleProp<ViewStyle>) => {
89
86
  return [viewStyle?.width ?? 'auto', viewStyle?.height ?? 'auto'];
90
87
  };
91
88
 
92
- const sizeBannerDimensions = (
93
- sizeProps: SizeRecord,
94
- adaptiveBannerEnabled: boolean,
95
- screenWidth: number,
96
- bannerFormatSize: SizeRecord
97
- ): Promise<SizeRecord> => {
89
+ const sizeBannerDimensions = (sizeProps: SizeRecord, adaptiveBannerEnabled: boolean, screenWidth: number, bannerFormatSize: SizeRecord): Promise<SizeRecord> => {
98
90
  const sizeForBannerFormat = async () => {
99
91
  const width = sizeProps.width === 'auto' ? screenWidth : sizeProps.width;
100
92
 
@@ -207,7 +199,7 @@ export const AdView = forwardRef<AdViewHandler, AdViewProps & ViewProps>(functio
207
199
  console.warn('AdView is mounted before the initialization of the AppLovin MAX React Native module');
208
200
  }
209
201
  });
210
- }, []); // Run once when mounted
202
+ }, [adFormat]); // Run once when mounted
211
203
 
212
204
  useEffect(() => {
213
205
  if (!isInitialized) return;
@@ -219,17 +211,12 @@ export const AdView = forwardRef<AdViewHandler, AdViewProps & ViewProps>(functio
219
211
  sizeProps.current = { width: width, height: height };
220
212
 
221
213
  if (adFormat === AdFormat.BANNER) {
222
- sizeBannerDimensions(sizeProps.current, adaptiveBannerEnabled, screenWidth, adFormatSize.current).then(
223
- (adaptedSize: SizeRecord) => {
224
- if (
225
- dimensions.current.width !== adaptedSize.width ||
226
- dimensions.current.height !== adaptedSize.height
227
- ) {
228
- dimensions.current = adaptedSize;
229
- forceUpdate();
230
- }
214
+ sizeBannerDimensions(sizeProps.current, adaptiveBannerEnabled, screenWidth, adFormatSize.current).then((adaptedSize: SizeRecord) => {
215
+ if (dimensions.current.width !== adaptedSize.width || dimensions.current.height !== adaptedSize.height) {
216
+ dimensions.current = adaptedSize;
217
+ forceUpdate();
231
218
  }
232
- );
219
+ });
233
220
  } else {
234
221
  dimensions.current = {
235
222
  width: width === 'auto' ? adFormatSize.current.width : width,
@@ -303,3 +290,73 @@ export const AdView = forwardRef<AdViewHandler, AdViewProps & ViewProps>(functio
303
290
  />
304
291
  );
305
292
  });
293
+
294
+ /**
295
+ * Preloads a native UI component for {@link AdView}. When you mount {@link AdView} with the Ad Unit
296
+ * ID you preloaded, it will be constructed with the preloaded native UI component, allowing the ads
297
+ * to be displayed quickly. When you unmount {@link AdView}, the preloaded native UI component won't
298
+ * be destroyed. Instead, it will be reused for the next mount. You must manually destroy it when it
299
+ * is no longer needed.
300
+ *
301
+ * You can preload only one native UI component for a single Ad Unit ID. If you mount two of
302
+ * {@link AdView} with the same Ad Unit ID, the first {@link AdView} will be constructed with the
303
+ * preloaded native UI component, but the second {@link AdView} will create its own native UI
304
+ * component and destroy it when unmounting.
305
+ *
306
+ * @param adUnitId The Ad Unit ID to load ads for.
307
+ * @param adFormat An enum value representing the ad format to load ads for. Should be either
308
+ * {@link AdFormat.BANNER} or {@link AdFormat.MREC}.
309
+ * @param options Optional props used to construct a native UI component.
310
+ * @returns A promise that resolves when preload starts. The resolved object contains void.
311
+ * @throws Throws an error if the request fails.
312
+ */
313
+ export const preloadNativeUIComponentAdView = async (adUnitId: string, adFormat: AdFormat, options?: NativeUIComponentAdViewOptions): Promise<void> => {
314
+ return AppLovinMAX.preloadNativeUIComponentAdView(adUnitId, adFormat, options?.placement, options?.customData, options?.extraParameters, options?.localExtraParameters);
315
+ };
316
+
317
+ /**
318
+ * Destroys the native UI component.
319
+ *
320
+ * @param adUnitId The ad unit ID of the native UI component to destroy.
321
+ * @returns A promise that resolves upon the destruction of the native UI component. The resolved
322
+ * object contains void.
323
+ * @throws Throws an error if the request fails.
324
+ */
325
+ export const destroyNativeUIComponentAdView = async (adUnitId: string): Promise<void> => {
326
+ return AppLovinMAX.destroyNativeUIComponentAdView(adUnitId);
327
+ };
328
+
329
+ /**
330
+ * Adds the specified event listener to receive {@link AdInfo} when a native UI component loads a
331
+ * new ad.
332
+ *
333
+ * @param listener Listener to be notified.
334
+ */
335
+ export const addNativeUIComponentAdViewAdLoadedEventListener = (listener: (adInfo: AdInfo) => void) => {
336
+ addEventListener(ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT, (adInfo: AdInfo) => listener(adInfo));
337
+ };
338
+
339
+ /**
340
+ * Removes the event listener to receive {@link AdInfo} when a native UI component loads a new ad.
341
+ */
342
+ export const removeNativeUIComponentAdViewAdLoadedEventListener = () => {
343
+ removeEventListener(ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT);
344
+ };
345
+
346
+ /**
347
+ * Adds the specified event listener to receive {@link AdLoadFailedInfo} when a native UI component
348
+ * could not load a new ad.
349
+ *
350
+ * @param listener Listener to be notified.
351
+ */
352
+ export const addNativeUIComponentAdViewAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void) => {
353
+ addEventListener(ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT, (errorInfo: AdLoadFailedInfo) => listener(errorInfo));
354
+ };
355
+
356
+ /**
357
+ * Removes the event listener to receive {@link AdLoadFailedInfo} when a native UI component could
358
+ * not load a new ad.
359
+ */
360
+ export const removeNativeUIComponentAdViewAdLoadFailedEventListener = () => {
361
+ removeEventListener(ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT);
362
+ };
@@ -4,7 +4,7 @@ import type { Configuration } from './types/Configuration';
4
4
 
5
5
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
6
6
 
7
- const VERSION = '6.5.0';
7
+ const VERSION = '7.0.1';
8
8
 
9
9
  /**
10
10
  * This enum represents the user's geography used to determine the type of consent flow shown to the
@@ -69,9 +69,7 @@ const removeAdDisplayedEventListener = () => {
69
69
  };
70
70
 
71
71
  const addAdFailedToDisplayEventListener = (listener: (errorInfo: AdDisplayFailedInfo) => void) => {
72
- addEventListener(ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT, (errorInfo: AdDisplayFailedInfo) =>
73
- listener(errorInfo)
74
- );
72
+ addEventListener(ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT, (errorInfo: AdDisplayFailedInfo) => listener(errorInfo));
75
73
  };
76
74
 
77
75
  const removeAdFailedToDisplayEventListener = () => {
package/src/MRecAd.ts CHANGED
@@ -7,14 +7,8 @@ import type { AdViewPosition } from './AdView';
7
7
 
8
8
  const { AppLovinMAX } = NativeModules;
9
9
 
10
- const {
11
- ON_MREC_AD_LOADED_EVENT,
12
- ON_MREC_AD_LOAD_FAILED_EVENT,
13
- ON_MREC_AD_CLICKED_EVENT,
14
- ON_MREC_AD_COLLAPSED_EVENT,
15
- ON_MREC_AD_EXPANDED_EVENT,
16
- ON_MREC_AD_REVENUE_PAID,
17
- } = AppLovinMAX.getConstants();
10
+ const { ON_MREC_AD_LOADED_EVENT, ON_MREC_AD_LOAD_FAILED_EVENT, ON_MREC_AD_CLICKED_EVENT, ON_MREC_AD_COLLAPSED_EVENT, ON_MREC_AD_EXPANDED_EVENT, ON_MREC_AD_REVENUE_PAID } =
11
+ AppLovinMAX.getConstants();
18
12
 
19
13
  const createAd = (adUnitId: string, position: AdViewPosition): void => {
20
14
  AppLovinMAX.createMRec(adUnitId, position);
@@ -71,12 +71,7 @@ export const TargetingData: TargetingDataType = {
71
71
  * Sets the gender of the user. Set this to {@link UserGender.Unknown} to clear this value.
72
72
  */
73
73
  set gender(value: UserGender | Promise<UserGender>) {
74
- if (
75
- value === UserGender.UNKNOWN ||
76
- value === UserGender.FEMALE ||
77
- value === UserGender.MALE ||
78
- value === UserGender.OTHER
79
- ) {
74
+ if (value === UserGender.UNKNOWN || value === UserGender.FEMALE || value === UserGender.MALE || value === UserGender.OTHER) {
80
75
  nativeMethods.setTargetingDataGender(value);
81
76
  } else {
82
77
  printError('TargetingData.gender', 'UserGender', typeof value);
@@ -213,13 +208,5 @@ const isStringArray = (strs: object): boolean => {
213
208
  };
214
209
 
215
210
  const printError = (fieldName: string, correctType: string, wrongType: string) => {
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
- );
211
+ console.error('Cannot set value to ' + fieldName + ' with unsupported type: ' + wrongType + '. Value has to be of type ' + correctType + '.');
225
212
  };
package/src/index.ts CHANGED
@@ -7,15 +7,14 @@ export { AppOpenAd } from './AppOpenAd';
7
7
  export { BannerAd } from './BannerAd';
8
8
  export { MRecAd } from './MRecAd';
9
9
  export { AdView, AdFormat, AdViewPosition } from './AdView';
10
- export { NativeAdView } from './nativeAd/NativeAdView';
11
10
  export {
12
- TitleView,
13
- AdvertiserView,
14
- BodyView,
15
- CallToActionView,
16
- IconView,
17
- OptionsView,
18
- MediaView,
19
- StarRatingView,
20
- } from './nativeAd/NativeAdViewComponents';
11
+ preloadNativeUIComponentAdView,
12
+ destroyNativeUIComponentAdView,
13
+ addNativeUIComponentAdViewAdLoadFailedEventListener,
14
+ removeNativeUIComponentAdViewAdLoadedEventListener,
15
+ addNativeUIComponentAdViewAdLoadedEventListener,
16
+ removeNativeUIComponentAdViewAdLoadFailedEventListener,
17
+ } from './AdView';
18
+ export { NativeAdView } from './nativeAd/NativeAdView';
19
+ export { TitleView, AdvertiserView, BodyView, CallToActionView, IconView, OptionsView, MediaView, StarRatingView } from './nativeAd/NativeAdViewComponents';
21
20
  export * from './types';
@@ -18,9 +18,7 @@ type NativeAdViewNativeEvents = {
18
18
  onAdRevenuePaidEvent(event: AdNativeEvent<AdRevenueInfo>): void;
19
19
  };
20
20
 
21
- const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewProps & NativeAdViewNativeEvents>(
22
- 'AppLovinMAXNativeAdView'
23
- );
21
+ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewProps & NativeAdViewNativeEvents>('AppLovinMAXNativeAdView');
24
22
 
25
23
  /**
26
24
  * The {@link NativeAdView} component that you use building a native ad. This loads a native ad and
@@ -59,50 +57,33 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
59
57
  * </NativeAdView>
60
58
  * ```
61
59
  */
62
- export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(
63
- function NativeAdView(props, ref) {
64
- const [isInitialized, setIsInitialized] = useState<boolean>(false);
65
-
66
- useEffect(() => {
67
- // check that AppLovinMAX has been initialized
68
- AppLovinMAX.isInitialized().then((result: boolean) => {
69
- setIsInitialized(result);
70
- if (!result) {
71
- console.warn(
72
- 'NativeAdView is mounted before the initialization of the AppLovin MAX React Native module'
73
- );
74
- }
75
- });
76
- }, []);
77
-
78
- // Not ready to render NativeAdView
79
- if (!isInitialized) {
80
- return null;
81
- }
60
+ export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(function NativeAdView(props, ref) {
61
+ const [isInitialized, setIsInitialized] = useState<boolean>(false);
62
+
63
+ useEffect(() => {
64
+ // check that AppLovinMAX has been initialized
65
+ AppLovinMAX.isInitialized().then((result: boolean) => {
66
+ setIsInitialized(result);
67
+ if (!result) {
68
+ console.warn('NativeAdView is mounted before the initialization of the AppLovin MAX React Native module');
69
+ }
70
+ });
71
+ }, []);
82
72
 
83
- return (
84
- <NativeAdViewProvider>
85
- <NativeAdViewImpl {...props} ref={ref} />
86
- </NativeAdViewProvider>
87
- );
73
+ // Not ready to render NativeAdView
74
+ if (!isInitialized) {
75
+ return null;
88
76
  }
89
- );
77
+
78
+ return (
79
+ <NativeAdViewProvider>
80
+ <NativeAdViewImpl {...props} ref={ref} />
81
+ </NativeAdViewProvider>
82
+ );
83
+ });
90
84
 
91
85
  const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(function NativeAdViewImpl(
92
- {
93
- adUnitId,
94
- placement,
95
- customData,
96
- extraParameters,
97
- localExtraParameters,
98
- onAdLoaded,
99
- onAdLoadFailed,
100
- onAdClicked,
101
- onAdRevenuePaid,
102
- children,
103
- style,
104
- ...otherProps
105
- },
86
+ { adUnitId, placement, customData, extraParameters, localExtraParameters, onAdLoaded, onAdLoadFailed, onAdClicked, onAdRevenuePaid, children, style, ...otherProps },
106
87
  ref
107
88
  ) {
108
89
  // context from NativeAdViewProvider
@@ -127,12 +108,15 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
127
108
  useImperativeHandle(ref, () => ({ loadAd }), []);
128
109
 
129
110
  // save the DOM element via the ref callback
130
- const saveElement = useCallback((element: NativeAdViewType | null) => {
131
- if (element) {
132
- nativeAdViewRef.current = element;
133
- setNativeAdView(element);
134
- }
135
- }, []);
111
+ const saveElement = useCallback(
112
+ (element: NativeAdViewType | null) => {
113
+ if (element) {
114
+ nativeAdViewRef.current = element;
115
+ setNativeAdView(element);
116
+ }
117
+ },
118
+ [setNativeAdView]
119
+ );
136
120
 
137
121
  const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo } }) => {
138
122
  setNativeAd(event.nativeEvent.nativeAd);
@@ -15,7 +15,7 @@ export const TitleView = (props: TextProps) => {
15
15
  nativeAdView?.setNativeProps({
16
16
  titleView: findNodeHandle(titleRef.current),
17
17
  });
18
- }, [nativeAd]);
18
+ }, [nativeAd, nativeAdView]);
19
19
 
20
20
  return (
21
21
  <Text {...props} ref={titleRef}>
@@ -34,7 +34,7 @@ export const AdvertiserView = (props: TextProps) => {
34
34
  nativeAdView?.setNativeProps({
35
35
  advertiserView: findNodeHandle(advertiserRef.current),
36
36
  });
37
- }, [nativeAd]);
37
+ }, [nativeAd, nativeAdView]);
38
38
 
39
39
  return (
40
40
  <Text {...props} ref={advertiserRef}>
@@ -53,7 +53,7 @@ export const BodyView = (props: TextProps) => {
53
53
  nativeAdView?.setNativeProps({
54
54
  bodyView: findNodeHandle(bodyRef.current),
55
55
  });
56
- }, [nativeAd]);
56
+ }, [nativeAd, nativeAdView]);
57
57
 
58
58
  return (
59
59
  <Text {...props} ref={bodyRef}>
@@ -72,7 +72,7 @@ export const CallToActionView = (props: TextProps) => {
72
72
  nativeAdView?.setNativeProps({
73
73
  callToActionView: findNodeHandle(callToActionRef.current),
74
74
  });
75
- }, [nativeAd]);
75
+ }, [nativeAd, nativeAdView]);
76
76
 
77
77
  return (
78
78
  <TouchableOpacity>
@@ -93,7 +93,7 @@ export const IconView = (props: Omit<ImageProps, 'source'>) => {
93
93
  nativeAdView?.setNativeProps({
94
94
  iconView: findNodeHandle(imageRef.current),
95
95
  });
96
- }, [nativeAd]);
96
+ }, [nativeAd, nativeAdView]);
97
97
 
98
98
  return nativeAd.url ? (
99
99
  <Image {...props} ref={imageRef} source={{ uri: nativeAd.url }} />
@@ -113,7 +113,7 @@ export const OptionsView = (props: ViewProps) => {
113
113
  nativeAdView?.setNativeProps({
114
114
  optionsView: findNodeHandle(viewRef.current),
115
115
  });
116
- }, [nativeAd]);
116
+ }, [nativeAd, nativeAdView]);
117
117
 
118
118
  return <View {...props} ref={viewRef} />;
119
119
  };
@@ -128,7 +128,7 @@ export const MediaView = (props: ViewProps) => {
128
128
  nativeAdView?.setNativeProps({
129
129
  mediaView: findNodeHandle(viewRef.current),
130
130
  });
131
- }, [nativeAd]);
131
+ }, [nativeAd, nativeAdView]);
132
132
 
133
133
  return <View {...props} ref={viewRef} />;
134
134
  };
@@ -142,22 +142,8 @@ export const StarRatingView = (props: ViewProps) => {
142
142
 
143
143
  const { nativeAd } = useContext(NativeAdViewContext);
144
144
 
145
- const FilledStar = () => {
146
- return (
147
- // black star in unicode
148
- <Text style={{ fontSize: starSize, color: starColor }}>{String.fromCodePoint(0x2605)}</Text>
149
- );
150
- };
151
-
152
- const EmptyStar = () => {
153
- return (
154
- // white star in unicode
155
- <Text style={{ fontSize: starSize, color: starColor }}>{String.fromCodePoint(0x2606)}</Text>
156
- );
157
- };
158
-
159
145
  return (
160
- <View {...restProps} style={[style, { flexDirection: 'row', alignItems: 'center' }]}>
146
+ <View {...restProps} style={[style, styles.starRatingContainer]}>
161
147
  {(() => {
162
148
  const stars: ReactNode[] = [];
163
149
  for (let index = 0; index < maxStarCount; index++) {
@@ -165,16 +151,10 @@ export const StarRatingView = (props: ViewProps) => {
165
151
  const width = (nativeAd.starRating - index) * starSize;
166
152
  stars.push(
167
153
  <View key={index}>
168
- <EmptyStar />
154
+ <Text style={{ fontSize: starSize, color: starColor }}>{String.fromCodePoint(0x2606)}</Text>
169
155
  {nativeAd.starRating > index && (
170
- <View
171
- style={{
172
- width: width,
173
- overflow: 'hidden',
174
- position: 'absolute',
175
- }}
176
- >
177
- <FilledStar />
156
+ <View style={[{ width: width }, styles.starRating]}>
157
+ <Text style={{ fontSize: starSize, color: starColor }}>{String.fromCodePoint(0x2605)}</Text>
178
158
  </View>
179
159
  )}
180
160
  </View>
@@ -192,3 +172,14 @@ export const StarRatingView = (props: ViewProps) => {
192
172
  </View>
193
173
  );
194
174
  };
175
+
176
+ const styles = StyleSheet.create({
177
+ starRatingContainer: {
178
+ flexDirection: 'row',
179
+ alignItems: 'center',
180
+ },
181
+ starRating: {
182
+ overflow: 'hidden',
183
+ position: 'absolute',
184
+ },
185
+ });