react-native-daro 1.0.13 → 1.0.15

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 (164) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +30 -30
  3. package/android/build.gradle +42 -59
  4. package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +23 -0
  5. package/android/src/main/AndroidManifest.xml +1 -2
  6. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdBannerViewManager.kt +4 -4
  7. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMAdNativeViewManager.kt +4 -4
  8. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMModule.kt +44 -45
  9. package/android/src/main/java/com/{darom → daro/reactnative}/DaroMPackage.kt +1 -1
  10. package/android/src/main/java/com/{darom → daro/reactnative}/constants/InternalDaroMBannerSize.kt +1 -1
  11. package/android/src/main/java/com/{darom → daro/reactnative}/event/DaroMEvent.kt +1 -1
  12. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMBannerViewModuleImpl.kt +2 -2
  13. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMInterstitialModuleImpl.kt +26 -26
  14. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMLightPopupModuleImpl.kt +30 -29
  15. package/android/src/main/java/com/{darom → daro/reactnative}/impl/DaroMRewardedAdModuleImpl.kt +27 -27
  16. package/android/src/main/java/com/{darom → daro/reactnative}/util/AdInfoUtil.kt +25 -1
  17. package/android/src/main/java/com/{darom → daro/reactnative}/util/EventEmitterUtil.kt +2 -2
  18. package/android/src/main/java/com/daro/reactnative/view/DaroMAdBannerViewContainer.kt +417 -0
  19. package/android/src/main/java/com/{darom → daro/reactnative}/view/DaroMAdNativeViewContainer.kt +4 -4
  20. package/app.plugin.js +1 -0
  21. package/ios/DaroMAdBannerViewManager.swift +1 -1
  22. package/ios/DaroMModule+AppOpen.swift +34 -31
  23. package/ios/DaroMModule+Interstitial.swift +29 -26
  24. package/ios/DaroMModule+LightPopup.swift +40 -33
  25. package/ios/DaroMModule+Rewarded.swift +35 -27
  26. package/ios/DaroMModule.mm +13 -13
  27. package/ios/DaroMModule.swift +20 -13
  28. package/ios/DaroMNativeAdViewManager.swift +1 -1
  29. package/ios/mediation/admob/DaroMediationDebugger.swift +11 -0
  30. package/ios/mediation/admob/DaroMediationTypes.swift +22 -0
  31. package/lib/commonjs/AdBannerView.js +6 -1
  32. package/lib/commonjs/AdBannerView.js.map +1 -1
  33. package/lib/commonjs/AppOpenAd.js +43 -17
  34. package/lib/commonjs/AppOpenAd.js.map +1 -1
  35. package/lib/commonjs/ErrorCode.js.map +1 -1
  36. package/lib/commonjs/EventEmitter.js.map +1 -1
  37. package/lib/commonjs/InterstitialAd.js +45 -17
  38. package/lib/commonjs/InterstitialAd.js.map +1 -1
  39. package/lib/commonjs/LightPopupAd.js +62 -43
  40. package/lib/commonjs/LightPopupAd.js.map +1 -1
  41. package/lib/commonjs/RewardedAd.js +44 -18
  42. package/lib/commonjs/RewardedAd.js.map +1 -1
  43. package/lib/commonjs/index.js +1 -1
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/commonjs/nativeAd/NativeAdView.js +5 -1
  46. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  47. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
  48. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
  49. package/lib/commonjs/package.json +1 -0
  50. package/lib/module/AdBannerView.js +6 -1
  51. package/lib/module/AdBannerView.js.map +1 -1
  52. package/lib/module/AppOpenAd.js +43 -17
  53. package/lib/module/AppOpenAd.js.map +1 -1
  54. package/lib/module/ErrorCode.js.map +1 -1
  55. package/lib/module/EventEmitter.js.map +1 -1
  56. package/lib/module/InterstitialAd.js +45 -17
  57. package/lib/module/InterstitialAd.js.map +1 -1
  58. package/lib/module/LightPopupAd.js +63 -43
  59. package/lib/module/LightPopupAd.js.map +1 -1
  60. package/lib/module/RewardedAd.js +44 -18
  61. package/lib/module/RewardedAd.js.map +1 -1
  62. package/lib/module/index.js +1 -1
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/nativeAd/NativeAdView.js +5 -1
  65. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  66. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
  67. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
  68. package/lib/module/package.json +1 -0
  69. package/lib/typescript/commonjs/plugin/src/index.d.ts +19 -0
  70. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts +6 -0
  72. package/lib/typescript/commonjs/plugin/src/skAdNetworkIds.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +8 -0
  74. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/plugin/src/withIos.d.ts +8 -0
  76. package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/AdBannerView.d.ts +124 -2
  78. package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/src/AppOpenAd.d.ts +6 -0
  80. package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/src/ErrorCode.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/src/InterstitialAd.d.ts +6 -0
  84. package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/LightPopupAd.d.ts +6 -0
  86. package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/src/RewardedAd.d.ts +6 -0
  88. package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +124 -2
  90. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts +2 -2
  94. package/lib/typescript/commonjs/src/types/AdBannerViewProps.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/src/types/AdProps.d.ts +2 -2
  97. package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
  100. package/lib/typescript/module/plugin/src/index.d.ts +19 -0
  101. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
  102. package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts +6 -0
  103. package/lib/typescript/module/plugin/src/skAdNetworkIds.d.ts.map +1 -0
  104. package/lib/typescript/module/plugin/src/withAndroid.d.ts +8 -0
  105. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
  106. package/lib/typescript/module/plugin/src/withIos.d.ts +8 -0
  107. package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -0
  108. package/lib/typescript/module/src/AdBannerView.d.ts +124 -2
  109. package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
  110. package/lib/typescript/module/src/AppOpenAd.d.ts +6 -0
  111. package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
  112. package/lib/typescript/module/src/ErrorCode.d.ts.map +1 -1
  113. package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
  114. package/lib/typescript/module/src/InterstitialAd.d.ts +6 -0
  115. package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
  116. package/lib/typescript/module/src/LightPopupAd.d.ts +6 -0
  117. package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
  118. package/lib/typescript/module/src/RewardedAd.d.ts +6 -0
  119. package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
  120. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +124 -2
  121. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
  122. package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  123. package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  124. package/lib/typescript/module/src/types/AdBannerViewProps.d.ts +2 -2
  125. package/lib/typescript/module/src/types/AdBannerViewProps.d.ts.map +1 -1
  126. package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
  127. package/lib/typescript/module/src/types/AdProps.d.ts +2 -2
  128. package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
  129. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +1 -1
  130. package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
  131. package/package.json +88 -105
  132. package/plugin/build/index.d.ts +18 -0
  133. package/plugin/build/index.js +71 -0
  134. package/plugin/build/skAdNetworkIds.d.ts +5 -0
  135. package/plugin/build/skAdNetworkIds.js +205 -0
  136. package/plugin/build/withAndroid.d.ts +7 -0
  137. package/plugin/build/withAndroid.js +140 -0
  138. package/plugin/build/withIos.d.ts +7 -0
  139. package/plugin/build/withIos.js +83 -0
  140. package/react-native-daro.podspec +25 -0
  141. package/src/AdBannerView.tsx +54 -17
  142. package/src/AppOpenAd.ts +59 -15
  143. package/src/ErrorCode.ts +1 -2
  144. package/src/EventEmitter.ts +5 -2
  145. package/src/InterstitialAd.ts +73 -17
  146. package/src/LightPopupAd.ts +86 -46
  147. package/src/RewardedAd.ts +70 -18
  148. package/src/index.tsx +1 -1
  149. package/src/nativeAd/NativeAdView.tsx +65 -14
  150. package/src/nativeAd/NativeAdViewComponents.tsx +54 -27
  151. package/src/nativeAd/NativeAdViewProvider.tsx +17 -7
  152. package/src/types/AdBannerViewProps.ts +11 -11
  153. package/src/types/AdInfo.ts +17 -17
  154. package/src/types/AdProps.ts +8 -9
  155. package/src/types/DaroMMobileAds.ts +3 -6
  156. package/src/types/NativeAdViewProps.ts +5 -5
  157. package/src/types/index.ts +1 -1
  158. package/android/gradle.properties +0 -5
  159. package/android/src/main/AndroidManifestNew.xml +0 -7
  160. package/android/src/main/java/com/darom/view/DaroMAdBannerViewContainer.kt +0 -163
  161. package/android/src/main/res/layout/layout_activity_transparent.xml +0 -7
  162. package/android/src/main/res/values/styles.xml +0 -11
  163. package/ios/DaroM-Bridging-Header.h +0 -6
  164. package/react-native-daro-m.podspec +0 -44
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Lion
3
+ Copyright (c) 2026 Delightroom
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
6
6
  in the Software without restriction, including without limitation the rights
package/README.md CHANGED
@@ -1,47 +1,47 @@
1
- # react-native-daro-m
1
+ # react-native-daro
2
2
 
3
- DaroM React Native Module for Android and iOS
3
+ React Native module for the Daro SDK on Android and iOS.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```sh
8
- yarn install
8
+ npm install react-native-daro
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
-
14
13
  ```js
15
- import { DaroMView } from "react-native-daro-m";
16
-
17
- // ...
18
-
19
- <DaroMView color="tomato" />
20
- ```
14
+ import { initialize, InterstitialAd } from 'react-native-daro';
21
15
 
22
- ## Example
16
+ await initialize();
23
17
 
24
- ```sh
25
- cd example
18
+ const interstitialAd = InterstitialAd.createForAdRequest('AD_UNIT_ID');
19
+ interstitialAd.load();
26
20
  ```
27
21
 
28
- ### Android
29
-
30
- ```sh
31
- yarn run android
32
- ```
22
+ ## Expo Config Plugin
33
23
 
34
- ### iOS
24
+ For Expo apps, add `react-native-daro` to `plugins`.
35
25
 
36
- ```sh
37
- yarn run ios --simulator "iPhone 16"
26
+ ```js
27
+ module.exports = {
28
+ expo: {
29
+ plugins: [
30
+ [
31
+ 'react-native-daro',
32
+ {
33
+ ios: {
34
+ daroAppKey: 'DARO_IOS_APP_KEY',
35
+ daroKeyFile: './ios-daro-key.txt',
36
+ admobAppId: 'ca-app-pub-0000000000000000~0000000000',
37
+ },
38
+ android: {
39
+ daroAppKey: 'DARO_ANDROID_APP_KEY',
40
+ daroKeyFile: './android-daro-key.txt',
41
+ },
42
+ },
43
+ ],
44
+ ],
45
+ },
46
+ };
38
47
  ```
39
-
40
-
41
- ## License
42
-
43
- MIT
44
-
45
- ---
46
-
47
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -1,6 +1,20 @@
1
+ import groovy.json.JsonSlurper
2
+
1
3
  buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["DaroM_kotlinVersion"]
4
+ ext.DaroReactNative = [
5
+ kotlinVersion: "2.0.21",
6
+ minSdkVersion: 24,
7
+ compileSdkVersion: 36,
8
+ targetSdkVersion: 36
9
+ ]
10
+
11
+ ext.getExtOrDefault = { prop ->
12
+ if (rootProject.ext.has(prop)) {
13
+ return rootProject.ext.get(prop)
14
+ }
15
+
16
+ return DaroReactNative[prop]
17
+ }
4
18
 
5
19
  repositories {
6
20
  google()
@@ -8,62 +22,37 @@ buildscript {
8
22
  }
9
23
 
10
24
  dependencies {
11
- classpath "com.android.tools.build:gradle:8.2.0"
25
+ classpath "com.android.tools.build:gradle:8.7.2"
12
26
  // noinspection DifferentKotlinGradleVersion
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
27
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
14
28
  }
15
29
  }
16
30
 
17
- def reactNativeArchitectures() {
18
- def value = rootProject.getProperties().get("reactNativeArchitectures")
19
- return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
20
- }
21
-
22
- def isNewArchitectureEnabled() {
23
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
24
- }
25
31
 
26
32
  apply plugin: "com.android.library"
27
33
  apply plugin: "kotlin-android"
28
34
 
29
- if (isNewArchitectureEnabled()) {
30
- apply plugin: "com.facebook.react"
31
- }
32
-
33
- def getExtOrDefault(name) {
34
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["DaroM_" + name]
35
- }
36
-
37
- def getExtOrIntegerDefault(name) {
38
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["DaroM_" + name]).toInteger()
39
- }
40
-
41
- def supportsNamespace() {
42
- def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
43
- def major = parsed[0].toInteger()
44
- def minor = parsed[1].toInteger()
35
+ apply plugin: "com.facebook.react"
45
36
 
46
- // Namespace support was added in 7.3.0
47
- return (major == 7 && minor >= 3) || major >= 8
48
- }
37
+ def packageJson = new JsonSlurper().parse(file("$projectDir/../package.json"))
38
+ def packageName = packageJson.name
39
+ def localMediation = (
40
+ project.findProperty("daroMediation") ?: System.getenv("DARO_MEDIATION")
41
+ )?.toString()?.toLowerCase()
42
+ def mediation =
43
+ packageName == "react-native-daro-m" ? "max" :
44
+ packageName == "react-native-daro" ? "admob" :
45
+ localMediation == "max" ? "max" : "admob"
46
+ def daroSdkDependency = mediation == "max" ? "so.daro:daro-m:1.3.8" : "so.daro:daro-a:1.5.5"
49
47
 
50
48
  android {
51
- if (supportsNamespace()) {
52
- namespace "com.darom"
53
-
54
- sourceSets {
55
- main {
56
- manifest.srcFile "src/main/AndroidManifestNew.xml"
57
- }
58
- }
59
- }
49
+ namespace "com.daro.reactnative"
60
50
 
61
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
51
+ compileSdkVersion getExtOrDefault("compileSdkVersion")
62
52
 
63
53
  defaultConfig {
64
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
65
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
66
-
54
+ minSdkVersion getExtOrDefault("minSdkVersion")
55
+ targetSdkVersion getExtOrDefault("targetSdkVersion")
67
56
  }
68
57
 
69
58
  buildTypes {
@@ -72,7 +61,13 @@ android {
72
61
  }
73
62
  }
74
63
 
75
- lintOptions {
64
+ sourceSets {
65
+ main {
66
+ java.srcDirs += "src/${mediation}/java"
67
+ }
68
+ }
69
+
70
+ lint {
76
71
  disable "GradleCompatible"
77
72
  }
78
73
 
@@ -82,19 +77,7 @@ android {
82
77
  }
83
78
  }
84
79
 
85
- repositories {
86
- mavenCentral()
87
- google()
88
- maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
89
- }
90
-
91
- def kotlin_version = getExtOrDefault("kotlinVersion")
92
-
93
80
  dependencies {
94
- // For < 0.71, this will be from the local maven repo
95
- // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
96
- //noinspection GradleDynamicVersion
97
- implementation "com.facebook.react:react-android:+"
98
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
99
- compileOnly "so.daro:daro-a:1.5.5"
81
+ implementation "com.facebook.react:react-android"
82
+ compileOnly daroSdkDependency
100
83
  }
@@ -0,0 +1,23 @@
1
+ package com.daro.reactnative
2
+
3
+ import android.app.Application
4
+ import android.content.Context
5
+ import droom.daro.SDKConfig
6
+ import droom.daro.a.Daro
7
+
8
+ internal object DaroSdkBridge {
9
+ fun initialize(application: Application, sdkConfig: SDKConfig) {
10
+ Daro.init(
11
+ application = application,
12
+ sdkConfig = sdkConfig,
13
+ )
14
+ }
15
+
16
+ fun openDebugger(context: Context) {
17
+ Daro.openDebugger(context)
18
+ }
19
+
20
+ fun setUserId(context: Context, userId: String) {
21
+ Daro.setUserId(context, userId)
22
+ }
23
+ }
@@ -1,3 +1,2 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.darom">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
  </manifest>
@@ -1,8 +1,8 @@
1
- package com.darom
1
+ package com.daro.reactnative
2
2
 
3
- import com.darom.constants.InternalDaroMBannerSize
4
- import com.darom.event.AdViewEvent
5
- import com.darom.view.DaroMAdBannerViewContainer
3
+ import com.daro.reactnative.constants.InternalDaroMBannerSize
4
+ import com.daro.reactnative.event.AdViewEvent
5
+ import com.daro.reactnative.view.DaroMAdBannerViewContainer
6
6
  import com.facebook.react.bridge.ReadableArray
7
7
  import com.facebook.react.uimanager.ReactStylesDiffMap
8
8
  import com.facebook.react.uimanager.SimpleViewManager
@@ -1,8 +1,8 @@
1
- package com.darom
1
+ package com.daro.reactnative
2
2
 
3
- import com.darom.event.AdViewEvent
4
- import com.darom.view.DaroMAdBannerViewContainer
5
- import com.darom.view.DaroMAdNativeViewContainer
3
+ import com.daro.reactnative.event.AdViewEvent
4
+ import com.daro.reactnative.view.DaroMAdBannerViewContainer
5
+ import com.daro.reactnative.view.DaroMAdNativeViewContainer
6
6
  import com.facebook.react.bridge.ReadableArray
7
7
  import com.facebook.react.uimanager.ReactStylesDiffMap
8
8
  import com.facebook.react.uimanager.StateWrapper
@@ -1,17 +1,17 @@
1
- package com.darom
1
+ package com.daro.reactnative
2
2
 
3
3
  import android.app.Application
4
4
  import android.content.Context
5
- import com.darom.constants.InternalDaroMBannerSize
6
- import com.darom.event.DaroMEvent
7
- import com.darom.event.InterstitialEvent
8
- import com.darom.event.LightPopupEvent
9
- import com.darom.event.RewardedEvent
10
- import com.darom.impl.DaroMBannerViewModuleImpl
11
- import com.darom.impl.DaroMInterstitialModuleImpl
12
- import com.darom.impl.DaroMLightPopupModuleImpl
13
- import com.darom.impl.DaroMRewardedAdModuleImpl
14
- import com.darom.util.EventEmitterUtil
5
+ import com.daro.reactnative.constants.InternalDaroMBannerSize
6
+ import com.daro.reactnative.event.DaroMEvent
7
+ import com.daro.reactnative.event.InterstitialEvent
8
+ import com.daro.reactnative.event.LightPopupEvent
9
+ import com.daro.reactnative.event.RewardedEvent
10
+ import com.daro.reactnative.impl.DaroMBannerViewModuleImpl
11
+ import com.daro.reactnative.impl.DaroMInterstitialModuleImpl
12
+ import com.daro.reactnative.impl.DaroMLightPopupModuleImpl
13
+ import com.daro.reactnative.impl.DaroMRewardedAdModuleImpl
14
+ import com.daro.reactnative.util.EventEmitterUtil
15
15
  import com.facebook.react.bridge.Promise
16
16
  import com.facebook.react.bridge.ReactApplicationContext
17
17
  import com.facebook.react.bridge.ReactContext
@@ -20,7 +20,6 @@ import com.facebook.react.bridge.ReactMethod
20
20
  import com.facebook.react.bridge.ReadableMap
21
21
  import com.facebook.react.bridge.WritableMap
22
22
  import droom.daro.SDKConfig
23
- import droom.daro.a.Daro
24
23
 
25
24
  class DaroMModule(reactContext: ReactApplicationContext) :
26
25
  ReactContextBaseJavaModule(reactContext) {
@@ -39,7 +38,7 @@ class DaroMModule(reactContext: ReactApplicationContext) :
39
38
 
40
39
  @ReactMethod
41
40
  fun initializeSdk() {
42
- Daro.init(
41
+ DaroSdkBridge.initialize(
43
42
  application = context.applicationContext as Application,
44
43
  sdkConfig = SDKConfig.Builder()
45
44
  .setDebugMode(false)
@@ -56,12 +55,12 @@ class DaroMModule(reactContext: ReactApplicationContext) :
56
55
 
57
56
  @ReactMethod
58
57
  fun showMediationDebugger() {
59
- Daro.openDebugger(context)
58
+ DaroSdkBridge.openDebugger(context)
60
59
  }
61
60
 
62
61
  @ReactMethod
63
62
  fun setUserId(userId: String) {
64
- Daro.setUserId(context, userId)
63
+ DaroSdkBridge.setUserId(context, userId)
65
64
  }
66
65
 
67
66
  override fun getConstants(): MutableMap<String, Any>? {
@@ -89,9 +88,9 @@ class DaroMModule(reactContext: ReactApplicationContext) :
89
88
  @OptIn(ExperimentalStdlibApi::class)
90
89
  internal abstract class DaroMInterstitialModule(context: ReactContext) :
91
90
  DaroMComponentModule(context) {
92
- abstract fun isInterstitialReady(adUnitId: String, promise: Promise)
93
- abstract fun loadInterstitial(adUnitId: String)
94
- abstract fun showInterstitial(adUnitId: String)
91
+ abstract fun isInterstitialReady(requestId: Int, adUnitId: String, promise: Promise)
92
+ abstract fun loadInterstitial(requestId: Int, adUnitId: String)
93
+ abstract fun showInterstitial(requestId: Int, adUnitId: String)
95
94
 
96
95
  override fun getComponents(): MutableMap<String, Any> {
97
96
  return InterstitialEvent.entries.associate { it.value to it.value }.toMutableMap()
@@ -105,26 +104,26 @@ class DaroMModule(reactContext: ReactApplicationContext) :
105
104
  )
106
105
 
107
106
  @ReactMethod
108
- fun isInterstitialReady(adUnitId: String, promise: Promise) {
109
- daroMInterstitialModule.isInterstitialReady(adUnitId, promise)
107
+ fun isInterstitialReady(requestId: Double, adUnitId: String, promise: Promise) {
108
+ daroMInterstitialModule.isInterstitialReady(requestId.toInt(), adUnitId, promise)
110
109
  }
111
110
 
112
111
  @ReactMethod
113
- fun loadInterstitial(adUnitId: String) {
114
- daroMInterstitialModule.loadInterstitial(adUnitId)
112
+ fun loadInterstitial(requestId: Double, adUnitId: String) {
113
+ daroMInterstitialModule.loadInterstitial(requestId.toInt(), adUnitId)
115
114
  }
116
115
 
117
116
  @ReactMethod
118
- fun showInterstitial(adUnitId: String) {
119
- daroMInterstitialModule.showInterstitial(adUnitId)
117
+ fun showInterstitial(requestId: Double, adUnitId: String) {
118
+ daroMInterstitialModule.showInterstitial(requestId.toInt(), adUnitId)
120
119
  }
121
120
 
122
121
  @OptIn(ExperimentalStdlibApi::class)
123
122
  internal abstract class DaroMRewardedModule(context: ReactContext) :
124
123
  DaroMComponentModule(context) {
125
- abstract fun isRewardedAdReady(adUnitId: String, promise: Promise)
126
- abstract fun loadRewardedAd(adUnitId: String)
127
- abstract fun showRewardedAd(adUnitId: String, customData: String?)
124
+ abstract fun isRewardedAdReady(requestId: Int, adUnitId: String, promise: Promise)
125
+ abstract fun loadRewardedAd(requestId: Int, adUnitId: String)
126
+ abstract fun showRewardedAd(requestId: Int, adUnitId: String, customData: String?)
128
127
 
129
128
  override fun getComponents(): MutableMap<String, Any> {
130
129
  return RewardedEvent.entries.associate { it.value to it.value }.toMutableMap()
@@ -138,28 +137,28 @@ class DaroMModule(reactContext: ReactApplicationContext) :
138
137
  )
139
138
 
140
139
  @ReactMethod
141
- fun isRewardedAdReady(adUnitId: String, promise: Promise) {
142
- daroMRewardedModule.isRewardedAdReady(adUnitId, promise)
140
+ fun isRewardedAdReady(requestId: Double, adUnitId: String, promise: Promise) {
141
+ daroMRewardedModule.isRewardedAdReady(requestId.toInt(), adUnitId, promise)
143
142
  }
144
143
 
145
144
  @ReactMethod
146
- fun loadRewardedAd(adUnitId: String) {
147
- daroMRewardedModule.loadRewardedAd(adUnitId)
145
+ fun loadRewardedAd(requestId: Double, adUnitId: String) {
146
+ daroMRewardedModule.loadRewardedAd(requestId.toInt(), adUnitId)
148
147
  }
149
148
 
150
149
  @ReactMethod
151
- fun showRewardedAd(adUnitId: String, customData: String?) {
152
- daroMRewardedModule.showRewardedAd(adUnitId, customData)
150
+ fun showRewardedAd(requestId: Double, adUnitId: String, customData: String?) {
151
+ daroMRewardedModule.showRewardedAd(requestId.toInt(), adUnitId, customData)
153
152
  }
154
153
 
155
154
  @OptIn(ExperimentalStdlibApi::class)
156
155
  internal abstract class DaroMLightPopupModule(context: ReactContext) :
157
156
  DaroMComponentModule(context) {
158
- abstract fun isLightPopupReady(adUnitId: String, promise: Promise)
159
- abstract fun loadLightPopup(adUnitId: String)
160
- abstract fun showLightPopup(adUnitId: String)
157
+ abstract fun isLightPopupReady(requestId: Int, adUnitId: String, promise: Promise)
158
+ abstract fun loadLightPopup(requestId: Int, adUnitId: String)
159
+ abstract fun showLightPopup(requestId: Int, adUnitId: String)
161
160
 
162
- abstract fun setLightPopupAdConfiguration(adUnitId: String, parameterMap: ReadableMap)
161
+ abstract fun setLightPopupAdConfiguration(requestId: Int, adUnitId: String, parameterMap: ReadableMap)
163
162
 
164
163
  override fun getComponents(): MutableMap<String, Any> {
165
164
  return LightPopupEvent.entries.associate { it.value to it.value }.toMutableMap()
@@ -172,23 +171,23 @@ class DaroMModule(reactContext: ReactApplicationContext) :
172
171
  )
173
172
 
174
173
  @ReactMethod
175
- fun isLightPopupReady(adUnitId: String, promise: Promise) {
176
- daroMLightPopupModule.isLightPopupReady(adUnitId, promise)
174
+ fun isLightPopupReady(requestId: Double, adUnitId: String, promise: Promise) {
175
+ daroMLightPopupModule.isLightPopupReady(requestId.toInt(), adUnitId, promise)
177
176
  }
178
177
 
179
178
  @ReactMethod
180
- fun loadLightPopup(adUnitId: String) {
181
- daroMLightPopupModule.loadLightPopup(adUnitId)
179
+ fun loadLightPopup(requestId: Double, adUnitId: String) {
180
+ daroMLightPopupModule.loadLightPopup(requestId.toInt(), adUnitId)
182
181
  }
183
182
 
184
183
  @ReactMethod
185
- fun showLightPopup(adUnitId: String) {
186
- daroMLightPopupModule.showLightPopup(adUnitId)
184
+ fun showLightPopup(requestId: Double, adUnitId: String) {
185
+ daroMLightPopupModule.showLightPopup(requestId.toInt(), adUnitId)
187
186
  }
188
187
 
189
188
  @ReactMethod
190
- fun setLightPopupAdConfiguration(adUnitId: String, configurationMap: ReadableMap) {
191
- daroMLightPopupModule.setLightPopupAdConfiguration(adUnitId, configurationMap)
189
+ fun setLightPopupAdConfiguration(requestId: Double, adUnitId: String, configurationMap: ReadableMap) {
190
+ daroMLightPopupModule.setLightPopupAdConfiguration(requestId.toInt(), adUnitId, configurationMap)
192
191
  }
193
192
 
194
193
  @OptIn(ExperimentalStdlibApi::class)
@@ -1,4 +1,4 @@
1
- package com.darom
1
+ package com.daro.reactnative
2
2
 
3
3
  import com.facebook.react.ReactPackage
4
4
  import com.facebook.react.bridge.NativeModule
@@ -1,4 +1,4 @@
1
- package com.darom.constants
1
+ package com.daro.reactnative.constants
2
2
 
3
3
  import droom.daro.core.model.DaroBannerSize
4
4
 
@@ -1,4 +1,4 @@
1
- package com.darom.event
1
+ package com.daro.reactnative.event
2
2
 
3
3
  internal interface DaroMEvent{
4
4
  val value: String
@@ -1,6 +1,6 @@
1
- package com.darom.impl
1
+ package com.daro.reactnative.impl
2
2
 
3
- import com.darom.DaroMModule
3
+ import com.daro.reactnative.DaroMModule
4
4
  import com.facebook.react.bridge.ReactApplicationContext
5
5
 
6
6
  internal class DaroMBannerViewModuleImpl(
@@ -1,9 +1,9 @@
1
- package com.darom.impl
1
+ package com.daro.reactnative.impl
2
2
 
3
3
  import android.app.Activity
4
- import com.darom.DaroMModule
5
- import com.darom.event.InterstitialEvent
6
- import com.darom.util.AdInfoUtil
4
+ import com.daro.reactnative.DaroMModule
5
+ import com.daro.reactnative.event.InterstitialEvent
6
+ import com.daro.reactnative.util.AdInfoUtil
7
7
  import com.facebook.react.bridge.Promise
8
8
  import com.facebook.react.bridge.ReactApplicationContext
9
9
  import droom.daro.core.adunit.DaroInterstitialAdUnit
@@ -23,56 +23,56 @@ internal class DaroMInterstitialModuleImpl(
23
23
  private val currentActivity: Activity?
24
24
  get() = getCurrentActivity()
25
25
 
26
- private val loaderMap: MutableMap<String, DaroInterstitialAdLoader> = mutableMapOf()
27
- private val interstitialAdMap: MutableMap<String, DaroInterstitialAd> = mutableMapOf()
26
+ private val loaderMap: MutableMap<Int, DaroInterstitialAdLoader> = mutableMapOf()
27
+ private val interstitialAdMap: MutableMap<Int, DaroInterstitialAd> = mutableMapOf()
28
28
 
29
29
 
30
- override fun isInterstitialReady(adUnitId: String, promise: Promise) {
31
- promise.resolve(retrieveAd(adUnitId) != null)
30
+ override fun isInterstitialReady(requestId: Int, adUnitId: String, promise: Promise) {
31
+ promise.resolve(retrieveAd(requestId) != null)
32
32
  }
33
33
 
34
- override fun loadInterstitial(adUnitId: String) {
35
- retrieveLoader(adUnitId).load()
34
+ override fun loadInterstitial(requestId: Int, adUnitId: String) {
35
+ retrieveLoader(requestId, adUnitId).load()
36
36
  }
37
37
 
38
- override fun showInterstitial(adUnitId: String) {
38
+ override fun showInterstitial(requestId: Int, adUnitId: String) {
39
39
  currentActivity?.let {
40
- retrieveAd(adUnitId)?.apply {
40
+ retrieveAd(requestId)?.apply {
41
41
  setListener(object : DaroInterstitialAdListener {
42
42
  override fun onDismiss(ad: DaroAdInfo) {
43
43
  sendNativeEvent(
44
44
  event = InterstitialEvent.ON_INTERSTITIAL_HIDDEN_EVENT,
45
- params = AdInfoUtil.getAdInfo(adUnitId, ad),
45
+ params = AdInfoUtil.getAdInfo(requestId, adUnitId, ad),
46
46
  )
47
47
  }
48
48
 
49
49
  override fun onFailedToShow(ad: DaroAdInfo, error: DaroAdDisplayFailError) {
50
50
  sendNativeEvent(
51
51
  event = InterstitialEvent.ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT,
52
- params = AdInfoUtil.getAdDisplayFailedInfo(adUnitId, ad, error),
52
+ params = AdInfoUtil.getAdDisplayFailedInfo(requestId, adUnitId, ad, error),
53
53
  )
54
54
  }
55
55
 
56
56
  override fun onShown(ad: DaroAdInfo) {
57
57
  sendNativeEvent(
58
58
  event = InterstitialEvent.ON_INTERSTITIAL_DISPLAYED_EVENT,
59
- params = AdInfoUtil.getAdInfo(adUnitId, ad),
59
+ params = AdInfoUtil.getAdInfo(requestId, adUnitId, ad),
60
60
  )
61
61
 
62
- interstitialAdMap.remove(adUnitId)
62
+ interstitialAdMap.remove(requestId)
63
63
  }
64
64
 
65
65
  override fun onAdClicked(responseInfo: DaroAdInfo) {
66
66
  sendNativeEvent(
67
67
  event = InterstitialEvent.ON_INTERSTITIAL_CLICKED_EVENT,
68
- params = AdInfoUtil.getAdInfo(adUnitId, responseInfo),
68
+ params = AdInfoUtil.getAdInfo(requestId, adUnitId, responseInfo),
69
69
  )
70
70
  }
71
71
 
72
72
  override fun onAdImpression(responseInfo: DaroAdInfo) {
73
73
  sendNativeEvent(
74
74
  event = InterstitialEvent.ON_INTERSTITIAL_AD_IMPRESSION_RECORDED,
75
- params = AdInfoUtil.getAdInfo(adUnitId, responseInfo),
75
+ params = AdInfoUtil.getAdInfo(requestId, adUnitId, responseInfo),
76
76
  )
77
77
  }
78
78
  })
@@ -82,32 +82,32 @@ internal class DaroMInterstitialModuleImpl(
82
82
  }
83
83
  }
84
84
 
85
- private fun retrieveLoader(adUnitId: String): DaroInterstitialAdLoader {
86
- return loaderMap[adUnitId] ?: DaroInterstitialAdLoader(
85
+ private fun retrieveLoader(requestId: Int, adUnitId: String): DaroInterstitialAdLoader {
86
+ return loaderMap[requestId] ?: DaroInterstitialAdLoader(
87
87
  context,
88
88
  DaroInterstitialAdUnit(adUnitId, adUnitId)
89
89
  ).also {
90
- loaderMap[adUnitId] = it
90
+ loaderMap[requestId] = it
91
91
  it.setListener(object : DaroInterstitialAdLoaderListener {
92
92
  override fun onAdLoadSuccess(ad: DaroInterstitialAd, responseInfo: DaroAdInfo) {
93
- interstitialAdMap[adUnitId] = ad
93
+ interstitialAdMap[requestId] = ad
94
94
  sendNativeEvent(
95
95
  event = InterstitialEvent.ON_INTERSTITIAL_LOADED_EVENT,
96
- params = AdInfoUtil.getAdInfo(adUnitId, responseInfo),
96
+ params = AdInfoUtil.getAdInfo(requestId, adUnitId, responseInfo),
97
97
  )
98
98
  }
99
99
 
100
100
  override fun onAdLoadFail(err: DaroAdLoadError) {
101
101
  sendNativeEvent(
102
102
  event = InterstitialEvent.ON_INTERSTITIAL_LOAD_FAILED_EVENT,
103
- params = AdInfoUtil.getAdLoadFailedInfo(adUnitId, err),
103
+ params = AdInfoUtil.getAdLoadFailedInfo(requestId, adUnitId, err),
104
104
  )
105
105
  }
106
106
  })
107
107
  }
108
108
  }
109
109
 
110
- private fun retrieveAd(adUnitId: String): DaroInterstitialAd? {
111
- return interstitialAdMap[adUnitId]
110
+ private fun retrieveAd(requestId: Int): DaroInterstitialAd? {
111
+ return interstitialAdMap[requestId]
112
112
  }
113
113
  }