cloudx-react-native 3.10.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/cloudxreactnative/CloudXAdEvents.kt +10 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXAdInfo.kt +40 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXNativeAdView.kt +718 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXNativeAdViewManagerImpl.kt +119 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXPackage.kt +4 -1
- package/android/src/main/res/layout/cloudx_rn_native_media_banner_template.xml +100 -0
- package/android/src/main/res/layout/cloudx_rn_native_medium_template.xml +99 -0
- package/android/src/main/res/layout/cloudx_rn_native_small_template.xml +72 -0
- package/android/src/main/res/layout/cloudx_rn_native_vertical_media_template.xml +117 -0
- package/android/src/newarch/com/cloudxreactnative/CloudXModule.kt +1 -0
- package/android/src/newarch/com/cloudxreactnative/CloudXNativeAdViewManager.kt +86 -0
- package/android/src/oldarch/com/cloudxreactnative/CloudXModule.kt +1 -0
- package/android/src/oldarch/com/cloudxreactnative/CloudXNativeAdViewManager.kt +118 -0
- package/cloudx-react-native.podspec +1 -1
- package/ios/CloudX.h +8 -0
- package/ios/CloudX.mm +159 -29
- package/ios/CloudXNativeAdView.h +75 -0
- package/ios/CloudXNativeAdView.mm +979 -0
- package/ios/CloudXNativeAdViewManager.h +12 -0
- package/ios/CloudXNativeAdViewManager.mm +119 -0
- package/lib/commonjs/CloudXAdViewBase.js +8 -97
- package/lib/commonjs/CloudXAdViewBase.js.map +1 -1
- package/lib/commonjs/CloudXNativeAdView.js +331 -0
- package/lib/commonjs/CloudXNativeAdView.js.map +1 -0
- package/lib/commonjs/CloudXNativeAdViewComponents.js +252 -0
- package/lib/commonjs/CloudXNativeAdViewComponents.js.map +1 -0
- package/lib/commonjs/CloudXNativeAdViewProvider.js +117 -0
- package/lib/commonjs/CloudXNativeAdViewProvider.js.map +1 -0
- package/lib/commonjs/extraParameters.js +52 -0
- package/lib/commonjs/extraParameters.js.map +1 -0
- package/lib/commonjs/hooks.js +34 -0
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js +72 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/CloudXNativeAdViewNativeComponent.js +41 -0
- package/lib/commonjs/specs/CloudXNativeAdViewNativeComponent.js.map +1 -0
- package/lib/commonjs/types/NativeAd.js +70 -0
- package/lib/commonjs/types/NativeAd.js.map +1 -0
- package/lib/commonjs/types/index.js +13 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/useCloudXSdkInitialization.js +75 -0
- package/lib/commonjs/useCloudXSdkInitialization.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/CloudXAdViewBase.js +7 -96
- package/lib/module/CloudXAdViewBase.js.map +1 -1
- package/lib/module/CloudXNativeAdView.js +324 -0
- package/lib/module/CloudXNativeAdView.js.map +1 -0
- package/lib/module/CloudXNativeAdViewComponents.js +240 -0
- package/lib/module/CloudXNativeAdViewComponents.js.map +1 -0
- package/lib/module/CloudXNativeAdViewProvider.js +110 -0
- package/lib/module/CloudXNativeAdViewProvider.js.map +1 -0
- package/lib/module/extraParameters.js +45 -0
- package/lib/module/extraParameters.js.map +1 -0
- package/lib/module/hooks.js +34 -0
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/CloudXNativeAdViewNativeComponent.js +35 -0
- package/lib/module/specs/CloudXNativeAdViewNativeComponent.js.map +1 -0
- package/lib/module/types/NativeAd.js +68 -0
- package/lib/module/types/NativeAd.js.map +1 -0
- package/lib/module/types/index.js +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/useCloudXSdkInitialization.js +68 -0
- package/lib/module/useCloudXSdkInitialization.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/CloudXAdViewBase.d.ts.map +1 -1
- package/lib/typescript/src/CloudXNativeAdView.d.ts +24 -0
- package/lib/typescript/src/CloudXNativeAdView.d.ts.map +1 -0
- package/lib/typescript/src/CloudXNativeAdViewComponents.d.ts +67 -0
- package/lib/typescript/src/CloudXNativeAdViewComponents.d.ts.map +1 -0
- package/lib/typescript/src/CloudXNativeAdViewProvider.d.ts +72 -0
- package/lib/typescript/src/CloudXNativeAdViewProvider.d.ts.map +1 -0
- package/lib/typescript/src/extraParameters.d.ts +4 -0
- package/lib/typescript/src/extraParameters.d.ts.map +1 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/CloudXNativeAdViewNativeComponent.d.ts +103 -0
- package/lib/typescript/src/specs/CloudXNativeAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/AdInfo.d.ts +4 -1
- package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
- package/lib/typescript/src/types/NativeAd.d.ts +114 -0
- package/lib/typescript/src/types/NativeAd.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +2 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/useCloudXSdkInitialization.d.ts +16 -0
- package/lib/typescript/src/useCloudXSdkInitialization.d.ts.map +1 -0
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/CloudXAdViewBase.tsx +8 -125
- package/src/CloudXNativeAdView.tsx +419 -0
- package/src/CloudXNativeAdViewComponents.tsx +203 -0
- package/src/CloudXNativeAdViewProvider.tsx +149 -0
- package/src/extraParameters.ts +65 -0
- package/src/hooks.ts +38 -0
- package/src/index.ts +24 -0
- package/src/specs/CloudXNativeAdViewNativeComponent.ts +137 -0
- package/src/types/AdInfo.ts +5 -1
- package/src/types/NativeAd.ts +125 -0
- package/src/types/index.ts +7 -0
- package/src/useCloudXSdkInitialization.ts +73 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
package com.cloudxreactnative
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.facebook.react.common.MapBuilder
|
|
5
|
+
import com.facebook.react.bridge.ReadableArray
|
|
6
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Shared logic for the CloudXNativeAdView view manager, used by both the Old
|
|
10
|
+
* (Paper) and New (Fabric) architecture manager variants under src/oldarch and
|
|
11
|
+
* src/newarch. Mirrors CloudXAdViewManagerImpl's structure; the extra child-shadow
|
|
12
|
+
* accessors and command implementations exist because, unlike the in-tree
|
|
13
|
+
* banner/MREC component, this view is a ViewGroupManager that can host
|
|
14
|
+
* React-declared children (manual-mode asset views).
|
|
15
|
+
*/
|
|
16
|
+
object CloudXNativeAdViewManagerImpl {
|
|
17
|
+
|
|
18
|
+
const val NAME = "CloudXNativeAdView"
|
|
19
|
+
|
|
20
|
+
fun createViewInstance(reactContext: ThemedReactContext): CloudXNativeAdView = CloudXNativeAdView(reactContext)
|
|
21
|
+
|
|
22
|
+
fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> =
|
|
23
|
+
mutableMapOf(
|
|
24
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_LOADED_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_LOADED_EVENT),
|
|
25
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_LOAD_FAILED_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_LOAD_FAILED_EVENT),
|
|
26
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_DISPLAY_FAILED_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_DISPLAY_FAILED_EVENT),
|
|
27
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_CLICKED_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_CLICKED_EVENT),
|
|
28
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_EXPIRED_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_EXPIRED_EVENT),
|
|
29
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_CLOSED_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_CLOSED_EVENT),
|
|
30
|
+
CloudXAdEvents.ON_NATIVE_AD_VIEW_REVENUE_PAID_EVENT to eventRegistration(CloudXAdEvents.ON_NATIVE_AD_VIEW_REVENUE_PAID_EVENT),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
private fun eventRegistration(name: String): Map<String, String> = MapBuilder.of("registrationName", name)
|
|
34
|
+
|
|
35
|
+
fun setAdUnitId(view: CloudXNativeAdView, adUnitId: String?) {
|
|
36
|
+
view.adUnitId = adUnitId
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fun setTemplateName(view: CloudXNativeAdView, templateName: String?) {
|
|
40
|
+
view.templateName = templateName
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fun setPlacement(view: CloudXNativeAdView, placement: String?) {
|
|
44
|
+
view.placement = placement
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fun setCustomData(view: CloudXNativeAdView, customData: String?) {
|
|
48
|
+
view.customData = customData
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
fun setExtraParameters(view: CloudXNativeAdView, extraParameters: ReadableArray?) {
|
|
52
|
+
view.extraParameters = CloudXExtraParameters.entryArrayToMap(extraParameters)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fun setLocalExtraParameters(view: CloudXNativeAdView, localExtraParameters: ReadableArray?) {
|
|
56
|
+
view.localExtraParameters = CloudXExtraParameters.entryArrayToMap(localExtraParameters)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fun setDisableVideoFullScreen(view: CloudXNativeAdView, disabled: Boolean) {
|
|
60
|
+
view.disableVideoFullScreen = disabled
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fun setStartVideoUnmuted(view: CloudXNativeAdView, startUnmuted: Boolean) {
|
|
64
|
+
view.startVideoUnmuted = startUnmuted
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
fun setHideVideoMediaControls(view: CloudXNativeAdView, hidden: Boolean) {
|
|
68
|
+
view.hideVideoMediaControls = hidden
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fun setManualRender(view: CloudXNativeAdView, manual: Boolean) {
|
|
72
|
+
view.manualRender = manual
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// The SDK-supplied ad view is attached to CloudXNativeAdView as a private,
|
|
76
|
+
// physical child via `ViewGroup.addView`, but React's view-hierarchy
|
|
77
|
+
// reconciler doesn't know about it and would try to remove or re-order it
|
|
78
|
+
// during `manageChildren`. Shadow the ViewGroupManager child accessors so
|
|
79
|
+
// React only ever sees the views it declared in JS (e.g. asset-view
|
|
80
|
+
// children in manual mode). The SDK ad view continues to participate in
|
|
81
|
+
// layout, drawing, and touch dispatch because it remains a real `ViewGroup`
|
|
82
|
+
// child.
|
|
83
|
+
|
|
84
|
+
fun getChildCount(view: CloudXNativeAdView): Int = view.reactChildCount()
|
|
85
|
+
|
|
86
|
+
fun getChildAt(view: CloudXNativeAdView, index: Int): View? = view.reactChildAt(index)
|
|
87
|
+
|
|
88
|
+
fun addView(view: CloudXNativeAdView, child: View, index: Int) {
|
|
89
|
+
view.addReactChild(child, index)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
fun removeViewAt(view: CloudXNativeAdView, index: Int) {
|
|
93
|
+
view.removeReactChildAt(index)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
fun removeAllViews(view: CloudXNativeAdView) {
|
|
97
|
+
view.removeAllReactChildren()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fun loadAd(view: CloudXNativeAdView) {
|
|
101
|
+
view.commandLoadAd()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
fun destroyAd(view: CloudXNativeAdView) {
|
|
105
|
+
view.commandDestroyAd()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
fun updateAssetView(view: CloudXNativeAdView, assetViewTag: Int, assetName: String) {
|
|
109
|
+
view.commandUpdateAssetView(assetViewTag, assetName)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
fun renderNativeAd(view: CloudXNativeAdView) {
|
|
113
|
+
view.commandRenderNativeAd()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
fun onDropViewInstance(view: CloudXNativeAdView) {
|
|
117
|
+
view.teardown()
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -9,7 +9,10 @@ import com.facebook.react.uimanager.ViewManager
|
|
|
9
9
|
|
|
10
10
|
class CloudXPackage : TurboReactPackage() {
|
|
11
11
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
12
|
-
return listOf(
|
|
12
|
+
return listOf(
|
|
13
|
+
CloudXAdViewManager(),
|
|
14
|
+
CloudXNativeAdViewManager(),
|
|
15
|
+
)
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Media-forward 320x300 layout bundled with <CloudXNativeAdView/> when
|
|
4
|
+
publishers pass template={CloudXNativeTemplate.MEDIA_BANNER}. Same
|
|
5
|
+
structure as the medium template but the media container takes the extra
|
|
6
|
+
vertical space, matching the iOS media_banner_template proportions. Uses
|
|
7
|
+
the same resource IDs as the other bundled templates so
|
|
8
|
+
CloudXNativeAdViewManager only swaps the layout resource.
|
|
9
|
+
-->
|
|
10
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
11
|
+
android:layout_width="match_parent"
|
|
12
|
+
android:layout_height="match_parent"
|
|
13
|
+
android:orientation="vertical"
|
|
14
|
+
android:background="#FFFFFFFF"
|
|
15
|
+
android:padding="8dp">
|
|
16
|
+
|
|
17
|
+
<LinearLayout
|
|
18
|
+
android:layout_width="match_parent"
|
|
19
|
+
android:layout_height="wrap_content"
|
|
20
|
+
android:orientation="horizontal"
|
|
21
|
+
android:gravity="center_vertical">
|
|
22
|
+
|
|
23
|
+
<ImageView
|
|
24
|
+
android:id="@+id/cloudx_rn_native_icon"
|
|
25
|
+
android:layout_width="40dp"
|
|
26
|
+
android:layout_height="40dp"
|
|
27
|
+
android:contentDescription="@null" />
|
|
28
|
+
|
|
29
|
+
<LinearLayout
|
|
30
|
+
android:layout_width="0dp"
|
|
31
|
+
android:layout_height="wrap_content"
|
|
32
|
+
android:layout_weight="1"
|
|
33
|
+
android:layout_marginStart="8dp"
|
|
34
|
+
android:orientation="vertical">
|
|
35
|
+
|
|
36
|
+
<TextView
|
|
37
|
+
android:id="@+id/cloudx_rn_native_title"
|
|
38
|
+
android:layout_width="match_parent"
|
|
39
|
+
android:layout_height="wrap_content"
|
|
40
|
+
android:textSize="14sp"
|
|
41
|
+
android:textStyle="bold"
|
|
42
|
+
android:maxLines="1"
|
|
43
|
+
android:ellipsize="end"
|
|
44
|
+
android:textColor="#FF000000" />
|
|
45
|
+
|
|
46
|
+
<TextView
|
|
47
|
+
android:id="@+id/cloudx_rn_native_advertiser"
|
|
48
|
+
android:layout_width="match_parent"
|
|
49
|
+
android:layout_height="wrap_content"
|
|
50
|
+
android:textSize="11sp"
|
|
51
|
+
android:textColor="#99000000"
|
|
52
|
+
android:maxLines="1"
|
|
53
|
+
android:ellipsize="end" />
|
|
54
|
+
</LinearLayout>
|
|
55
|
+
|
|
56
|
+
<FrameLayout
|
|
57
|
+
android:id="@+id/cloudx_rn_native_options"
|
|
58
|
+
android:layout_width="wrap_content"
|
|
59
|
+
android:layout_height="wrap_content"
|
|
60
|
+
android:minWidth="20dp"
|
|
61
|
+
android:minHeight="20dp" />
|
|
62
|
+
</LinearLayout>
|
|
63
|
+
|
|
64
|
+
<FrameLayout
|
|
65
|
+
android:id="@+id/cloudx_rn_native_media"
|
|
66
|
+
android:layout_width="match_parent"
|
|
67
|
+
android:layout_height="0dp"
|
|
68
|
+
android:layout_weight="1"
|
|
69
|
+
android:minHeight="170dp"
|
|
70
|
+
android:layout_marginTop="8dp" />
|
|
71
|
+
|
|
72
|
+
<TextView
|
|
73
|
+
android:id="@+id/cloudx_rn_native_body"
|
|
74
|
+
android:layout_width="match_parent"
|
|
75
|
+
android:layout_height="wrap_content"
|
|
76
|
+
android:layout_marginTop="6dp"
|
|
77
|
+
android:textSize="12sp"
|
|
78
|
+
android:textColor="#CC000000"
|
|
79
|
+
android:maxLines="1"
|
|
80
|
+
android:ellipsize="end" />
|
|
81
|
+
|
|
82
|
+
<FrameLayout
|
|
83
|
+
android:id="@+id/cloudx_rn_native_rating"
|
|
84
|
+
android:layout_width="match_parent"
|
|
85
|
+
android:layout_height="wrap_content"
|
|
86
|
+
android:layout_marginTop="2dp" />
|
|
87
|
+
|
|
88
|
+
<TextView
|
|
89
|
+
android:id="@+id/cloudx_rn_native_cta"
|
|
90
|
+
android:layout_width="match_parent"
|
|
91
|
+
android:layout_height="wrap_content"
|
|
92
|
+
android:layout_marginTop="6dp"
|
|
93
|
+
android:background="#FF007AFF"
|
|
94
|
+
android:gravity="center"
|
|
95
|
+
android:paddingTop="10dp"
|
|
96
|
+
android:paddingBottom="10dp"
|
|
97
|
+
android:textColor="#FFFFFFFF"
|
|
98
|
+
android:textStyle="bold"
|
|
99
|
+
android:textSize="14sp" />
|
|
100
|
+
</LinearLayout>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Bundled default layout used by <CloudXNativeAdView/> on Android when a
|
|
4
|
+
publisher does not supply their own layout. Mirrors the iOS "medium_template"
|
|
5
|
+
visual hierarchy so cross-platform rendering stays consistent. The CloudX
|
|
6
|
+
Android SDK resolves views by their numeric resource IDs through
|
|
7
|
+
CloudXNativeAdViewBinder; these IDs are referenced by CloudXNativeAdViewManager.
|
|
8
|
+
-->
|
|
9
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
10
|
+
android:layout_width="match_parent"
|
|
11
|
+
android:layout_height="wrap_content"
|
|
12
|
+
android:orientation="vertical"
|
|
13
|
+
android:background="#FFFFFFFF"
|
|
14
|
+
android:padding="8dp">
|
|
15
|
+
|
|
16
|
+
<LinearLayout
|
|
17
|
+
android:layout_width="match_parent"
|
|
18
|
+
android:layout_height="wrap_content"
|
|
19
|
+
android:orientation="horizontal"
|
|
20
|
+
android:gravity="center_vertical">
|
|
21
|
+
|
|
22
|
+
<ImageView
|
|
23
|
+
android:id="@+id/cloudx_rn_native_icon"
|
|
24
|
+
android:layout_width="48dp"
|
|
25
|
+
android:layout_height="48dp"
|
|
26
|
+
android:contentDescription="@null" />
|
|
27
|
+
|
|
28
|
+
<LinearLayout
|
|
29
|
+
android:layout_width="0dp"
|
|
30
|
+
android:layout_height="wrap_content"
|
|
31
|
+
android:layout_weight="1"
|
|
32
|
+
android:layout_marginStart="8dp"
|
|
33
|
+
android:orientation="vertical">
|
|
34
|
+
|
|
35
|
+
<TextView
|
|
36
|
+
android:id="@+id/cloudx_rn_native_title"
|
|
37
|
+
android:layout_width="match_parent"
|
|
38
|
+
android:layout_height="wrap_content"
|
|
39
|
+
android:textSize="14sp"
|
|
40
|
+
android:textStyle="bold"
|
|
41
|
+
android:maxLines="1"
|
|
42
|
+
android:ellipsize="end"
|
|
43
|
+
android:textColor="#FF000000" />
|
|
44
|
+
|
|
45
|
+
<TextView
|
|
46
|
+
android:id="@+id/cloudx_rn_native_advertiser"
|
|
47
|
+
android:layout_width="match_parent"
|
|
48
|
+
android:layout_height="wrap_content"
|
|
49
|
+
android:textSize="11sp"
|
|
50
|
+
android:textColor="#99000000"
|
|
51
|
+
android:maxLines="1"
|
|
52
|
+
android:ellipsize="end" />
|
|
53
|
+
</LinearLayout>
|
|
54
|
+
|
|
55
|
+
<FrameLayout
|
|
56
|
+
android:id="@+id/cloudx_rn_native_options"
|
|
57
|
+
android:layout_width="wrap_content"
|
|
58
|
+
android:layout_height="wrap_content"
|
|
59
|
+
android:minWidth="20dp"
|
|
60
|
+
android:minHeight="20dp" />
|
|
61
|
+
</LinearLayout>
|
|
62
|
+
|
|
63
|
+
<FrameLayout
|
|
64
|
+
android:id="@+id/cloudx_rn_native_media"
|
|
65
|
+
android:layout_width="match_parent"
|
|
66
|
+
android:layout_height="0dp"
|
|
67
|
+
android:layout_weight="1"
|
|
68
|
+
android:minHeight="120dp"
|
|
69
|
+
android:layout_marginTop="8dp" />
|
|
70
|
+
|
|
71
|
+
<TextView
|
|
72
|
+
android:id="@+id/cloudx_rn_native_body"
|
|
73
|
+
android:layout_width="match_parent"
|
|
74
|
+
android:layout_height="wrap_content"
|
|
75
|
+
android:layout_marginTop="8dp"
|
|
76
|
+
android:textSize="12sp"
|
|
77
|
+
android:textColor="#CC000000"
|
|
78
|
+
android:maxLines="2"
|
|
79
|
+
android:ellipsize="end" />
|
|
80
|
+
|
|
81
|
+
<FrameLayout
|
|
82
|
+
android:id="@+id/cloudx_rn_native_rating"
|
|
83
|
+
android:layout_width="match_parent"
|
|
84
|
+
android:layout_height="wrap_content"
|
|
85
|
+
android:layout_marginTop="4dp" />
|
|
86
|
+
|
|
87
|
+
<TextView
|
|
88
|
+
android:id="@+id/cloudx_rn_native_cta"
|
|
89
|
+
android:layout_width="match_parent"
|
|
90
|
+
android:layout_height="wrap_content"
|
|
91
|
+
android:layout_marginTop="8dp"
|
|
92
|
+
android:background="#FF007AFF"
|
|
93
|
+
android:gravity="center"
|
|
94
|
+
android:paddingTop="10dp"
|
|
95
|
+
android:paddingBottom="10dp"
|
|
96
|
+
android:textColor="#FFFFFFFF"
|
|
97
|
+
android:textStyle="bold"
|
|
98
|
+
android:textSize="14sp" />
|
|
99
|
+
</LinearLayout>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Compact 320x90 layout bundled with <CloudXNativeAdView/> when publishers
|
|
4
|
+
pass template={CloudXNativeTemplate.SMALL}. Mirrors the iOS small_template
|
|
5
|
+
hierarchy: icon + title/advertiser on the left, CTA pinned to the trailing
|
|
6
|
+
edge, no body or media. Uses the same resource IDs as the other bundled
|
|
7
|
+
templates so CloudXNativeAdViewManager only swaps the layout resource;
|
|
8
|
+
roles absent from this layout (body, media, rating) resolve to null in the
|
|
9
|
+
binder and the SDK skips them.
|
|
10
|
+
-->
|
|
11
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
12
|
+
android:layout_width="match_parent"
|
|
13
|
+
android:layout_height="match_parent"
|
|
14
|
+
android:orientation="horizontal"
|
|
15
|
+
android:gravity="center_vertical"
|
|
16
|
+
android:background="#FFFFFFFF"
|
|
17
|
+
android:padding="8dp">
|
|
18
|
+
|
|
19
|
+
<ImageView
|
|
20
|
+
android:id="@+id/cloudx_rn_native_icon"
|
|
21
|
+
android:layout_width="40dp"
|
|
22
|
+
android:layout_height="40dp"
|
|
23
|
+
android:contentDescription="@null" />
|
|
24
|
+
|
|
25
|
+
<LinearLayout
|
|
26
|
+
android:layout_width="0dp"
|
|
27
|
+
android:layout_height="wrap_content"
|
|
28
|
+
android:layout_weight="1"
|
|
29
|
+
android:layout_marginStart="8dp"
|
|
30
|
+
android:layout_marginEnd="8dp"
|
|
31
|
+
android:orientation="vertical">
|
|
32
|
+
|
|
33
|
+
<TextView
|
|
34
|
+
android:id="@+id/cloudx_rn_native_title"
|
|
35
|
+
android:layout_width="match_parent"
|
|
36
|
+
android:layout_height="wrap_content"
|
|
37
|
+
android:textSize="14sp"
|
|
38
|
+
android:textStyle="bold"
|
|
39
|
+
android:maxLines="1"
|
|
40
|
+
android:ellipsize="end"
|
|
41
|
+
android:textColor="#FF000000" />
|
|
42
|
+
|
|
43
|
+
<TextView
|
|
44
|
+
android:id="@+id/cloudx_rn_native_advertiser"
|
|
45
|
+
android:layout_width="match_parent"
|
|
46
|
+
android:layout_height="wrap_content"
|
|
47
|
+
android:textSize="11sp"
|
|
48
|
+
android:textColor="#99000000"
|
|
49
|
+
android:maxLines="1"
|
|
50
|
+
android:ellipsize="end" />
|
|
51
|
+
</LinearLayout>
|
|
52
|
+
|
|
53
|
+
<FrameLayout
|
|
54
|
+
android:id="@+id/cloudx_rn_native_options"
|
|
55
|
+
android:layout_width="wrap_content"
|
|
56
|
+
android:layout_height="wrap_content"
|
|
57
|
+
android:minWidth="20dp"
|
|
58
|
+
android:minHeight="20dp"
|
|
59
|
+
android:layout_marginEnd="8dp" />
|
|
60
|
+
|
|
61
|
+
<TextView
|
|
62
|
+
android:id="@+id/cloudx_rn_native_cta"
|
|
63
|
+
android:layout_width="100dp"
|
|
64
|
+
android:layout_height="34dp"
|
|
65
|
+
android:background="#FF007AFF"
|
|
66
|
+
android:gravity="center"
|
|
67
|
+
android:textColor="#FFFFFFFF"
|
|
68
|
+
android:textStyle="bold"
|
|
69
|
+
android:textSize="13sp"
|
|
70
|
+
android:maxLines="1"
|
|
71
|
+
android:ellipsize="end" />
|
|
72
|
+
</LinearLayout>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Full-bleed reel layout bundled with <CloudXNativeAdView/> when publishers pass
|
|
4
|
+
template={CloudXNativeTemplate.VERTICAL_MEDIA}. Uses the same resource IDs as
|
|
5
|
+
the medium template so CloudXNativeAdViewManager only needs to switch the
|
|
6
|
+
layout resource — binder setters stay identical across templates.
|
|
7
|
+
-->
|
|
8
|
+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
9
|
+
android:layout_width="match_parent"
|
|
10
|
+
android:layout_height="match_parent"
|
|
11
|
+
android:background="#FF000000">
|
|
12
|
+
|
|
13
|
+
<!--
|
|
14
|
+
Full-bleed media container: the SDK media view letterboxes the creative
|
|
15
|
+
at its intrinsic aspect ratio within the available bounds. Constraining
|
|
16
|
+
width to wrap_content squeezes the video into a distorted center strip,
|
|
17
|
+
so both dimensions must be match_parent.
|
|
18
|
+
-->
|
|
19
|
+
<FrameLayout
|
|
20
|
+
android:id="@+id/cloudx_rn_native_media"
|
|
21
|
+
android:layout_width="match_parent"
|
|
22
|
+
android:layout_height="match_parent" />
|
|
23
|
+
|
|
24
|
+
<FrameLayout
|
|
25
|
+
android:id="@+id/cloudx_rn_native_options"
|
|
26
|
+
android:layout_width="30dp"
|
|
27
|
+
android:layout_height="30dp"
|
|
28
|
+
android:layout_gravity="top|end"
|
|
29
|
+
android:layout_marginTop="16dp"
|
|
30
|
+
android:layout_marginEnd="16dp" />
|
|
31
|
+
|
|
32
|
+
<View
|
|
33
|
+
android:layout_width="match_parent"
|
|
34
|
+
android:layout_height="220dp"
|
|
35
|
+
android:layout_gravity="bottom"
|
|
36
|
+
android:background="#99000000" />
|
|
37
|
+
|
|
38
|
+
<LinearLayout
|
|
39
|
+
android:layout_width="match_parent"
|
|
40
|
+
android:layout_height="wrap_content"
|
|
41
|
+
android:layout_gravity="bottom"
|
|
42
|
+
android:orientation="vertical"
|
|
43
|
+
android:paddingStart="16dp"
|
|
44
|
+
android:paddingEnd="16dp"
|
|
45
|
+
android:paddingTop="12dp"
|
|
46
|
+
android:paddingBottom="24dp">
|
|
47
|
+
|
|
48
|
+
<LinearLayout
|
|
49
|
+
android:layout_width="match_parent"
|
|
50
|
+
android:layout_height="wrap_content"
|
|
51
|
+
android:orientation="horizontal"
|
|
52
|
+
android:gravity="center_vertical"
|
|
53
|
+
android:layout_marginBottom="10dp">
|
|
54
|
+
|
|
55
|
+
<ImageView
|
|
56
|
+
android:id="@+id/cloudx_rn_native_icon"
|
|
57
|
+
android:layout_width="40dp"
|
|
58
|
+
android:layout_height="40dp"
|
|
59
|
+
android:scaleType="centerCrop"
|
|
60
|
+
android:contentDescription="@null" />
|
|
61
|
+
|
|
62
|
+
<LinearLayout
|
|
63
|
+
android:layout_width="0dp"
|
|
64
|
+
android:layout_height="wrap_content"
|
|
65
|
+
android:layout_weight="1"
|
|
66
|
+
android:orientation="vertical"
|
|
67
|
+
android:paddingStart="10dp"
|
|
68
|
+
android:paddingEnd="8dp">
|
|
69
|
+
|
|
70
|
+
<TextView
|
|
71
|
+
android:id="@+id/cloudx_rn_native_title"
|
|
72
|
+
android:layout_width="wrap_content"
|
|
73
|
+
android:layout_height="wrap_content"
|
|
74
|
+
android:textSize="17sp"
|
|
75
|
+
android:textStyle="bold"
|
|
76
|
+
android:textColor="#FFFFFFFF"
|
|
77
|
+
android:maxLines="2"
|
|
78
|
+
android:ellipsize="end" />
|
|
79
|
+
|
|
80
|
+
<TextView
|
|
81
|
+
android:id="@+id/cloudx_rn_native_advertiser"
|
|
82
|
+
android:layout_width="wrap_content"
|
|
83
|
+
android:layout_height="wrap_content"
|
|
84
|
+
android:textSize="13sp"
|
|
85
|
+
android:textColor="#B3FFFFFF"
|
|
86
|
+
android:maxLines="1"
|
|
87
|
+
android:ellipsize="end" />
|
|
88
|
+
</LinearLayout>
|
|
89
|
+
</LinearLayout>
|
|
90
|
+
|
|
91
|
+
<TextView
|
|
92
|
+
android:id="@+id/cloudx_rn_native_body"
|
|
93
|
+
android:layout_width="match_parent"
|
|
94
|
+
android:layout_height="wrap_content"
|
|
95
|
+
android:textSize="14sp"
|
|
96
|
+
android:textColor="#E6FFFFFF"
|
|
97
|
+
android:maxLines="2"
|
|
98
|
+
android:ellipsize="end"
|
|
99
|
+
android:layout_marginBottom="12dp" />
|
|
100
|
+
|
|
101
|
+
<FrameLayout
|
|
102
|
+
android:id="@+id/cloudx_rn_native_rating"
|
|
103
|
+
android:layout_width="match_parent"
|
|
104
|
+
android:layout_height="wrap_content"
|
|
105
|
+
android:layout_marginBottom="8dp" />
|
|
106
|
+
|
|
107
|
+
<TextView
|
|
108
|
+
android:id="@+id/cloudx_rn_native_cta"
|
|
109
|
+
android:layout_width="match_parent"
|
|
110
|
+
android:layout_height="44dp"
|
|
111
|
+
android:background="#FFFFFFFF"
|
|
112
|
+
android:gravity="center"
|
|
113
|
+
android:textColor="#FF000000"
|
|
114
|
+
android:textStyle="bold"
|
|
115
|
+
android:textSize="15sp" />
|
|
116
|
+
</LinearLayout>
|
|
117
|
+
</FrameLayout>
|
|
@@ -80,6 +80,7 @@ class CloudXModule(reactContext: ReactApplicationContext) :
|
|
|
80
80
|
@ReactMethod override fun showRewarded(adUnitId: String, placement: String?, customData: String?) = impl.showRewarded(adUnitId, placement, customData)
|
|
81
81
|
@ReactMethod override fun destroyRewarded(adUnitId: String) = impl.destroyRewarded(adUnitId)
|
|
82
82
|
|
|
83
|
+
|
|
83
84
|
@ReactMethod override fun addListener(eventName: String) {}
|
|
84
85
|
@ReactMethod override fun removeListeners(count: Double) {}
|
|
85
86
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
package com.cloudxreactnative
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.facebook.react.bridge.ReadableArray
|
|
5
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
8
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
9
|
+
import com.facebook.react.viewmanagers.CloudXNativeAdViewManagerDelegate
|
|
10
|
+
import com.facebook.react.viewmanagers.CloudXNativeAdViewManagerInterface
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* New-Architecture (Fabric) view manager for CloudXNativeAdView. Props and
|
|
14
|
+
* commands are routed through the codegen-generated delegate/interface; all
|
|
15
|
+
* logic delegates to the shared CloudXNativeAdViewManagerImpl.
|
|
16
|
+
*/
|
|
17
|
+
@ReactModule(name = CloudXNativeAdViewManagerImpl.NAME)
|
|
18
|
+
class CloudXNativeAdViewManager :
|
|
19
|
+
ViewGroupManager<CloudXNativeAdView>(),
|
|
20
|
+
CloudXNativeAdViewManagerInterface<CloudXNativeAdView> {
|
|
21
|
+
|
|
22
|
+
private val delegate = CloudXNativeAdViewManagerDelegate(this)
|
|
23
|
+
|
|
24
|
+
override fun getDelegate(): ViewManagerDelegate<CloudXNativeAdView> = delegate
|
|
25
|
+
|
|
26
|
+
override fun getName(): String = CloudXNativeAdViewManagerImpl.NAME
|
|
27
|
+
|
|
28
|
+
override fun createViewInstance(reactContext: ThemedReactContext): CloudXNativeAdView =
|
|
29
|
+
CloudXNativeAdViewManagerImpl.createViewInstance(reactContext)
|
|
30
|
+
|
|
31
|
+
// Opt out of Fabric view recycling: each view instance owns per-ad mutable
|
|
32
|
+
// state and a dedicated SDK loader tied to one ad's lifecycle, so a
|
|
33
|
+
// recycled instance would leak the previous ad into the next mount.
|
|
34
|
+
// Returning null tells Fabric to discard the view instead of reusing it.
|
|
35
|
+
override fun prepareToRecycleView(reactContext: ThemedReactContext, view: CloudXNativeAdView): CloudXNativeAdView? = null
|
|
36
|
+
|
|
37
|
+
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> =
|
|
38
|
+
CloudXNativeAdViewManagerImpl.getExportedCustomDirectEventTypeConstants()
|
|
39
|
+
|
|
40
|
+
override fun setAdUnitId(view: CloudXNativeAdView, value: String?) = CloudXNativeAdViewManagerImpl.setAdUnitId(view, value)
|
|
41
|
+
|
|
42
|
+
override fun setTemplateName(view: CloudXNativeAdView, value: String?) = CloudXNativeAdViewManagerImpl.setTemplateName(view, value)
|
|
43
|
+
|
|
44
|
+
override fun setPlacement(view: CloudXNativeAdView, value: String?) = CloudXNativeAdViewManagerImpl.setPlacement(view, value)
|
|
45
|
+
|
|
46
|
+
override fun setCustomData(view: CloudXNativeAdView, value: String?) = CloudXNativeAdViewManagerImpl.setCustomData(view, value)
|
|
47
|
+
|
|
48
|
+
override fun setExtraParameters(view: CloudXNativeAdView, value: ReadableArray?) = CloudXNativeAdViewManagerImpl.setExtraParameters(view, value)
|
|
49
|
+
|
|
50
|
+
override fun setLocalExtraParameters(view: CloudXNativeAdView, value: ReadableArray?) = CloudXNativeAdViewManagerImpl.setLocalExtraParameters(view, value)
|
|
51
|
+
|
|
52
|
+
override fun setDisableVideoFullScreen(view: CloudXNativeAdView, value: Boolean) = CloudXNativeAdViewManagerImpl.setDisableVideoFullScreen(view, value)
|
|
53
|
+
|
|
54
|
+
override fun setStartVideoUnmuted(view: CloudXNativeAdView, value: Boolean) = CloudXNativeAdViewManagerImpl.setStartVideoUnmuted(view, value)
|
|
55
|
+
|
|
56
|
+
override fun setHideVideoMediaControls(view: CloudXNativeAdView, value: Boolean) = CloudXNativeAdViewManagerImpl.setHideVideoMediaControls(view, value)
|
|
57
|
+
|
|
58
|
+
override fun setManualRender(view: CloudXNativeAdView, value: Boolean) = CloudXNativeAdViewManagerImpl.setManualRender(view, value)
|
|
59
|
+
|
|
60
|
+
override fun loadAd(view: CloudXNativeAdView) = CloudXNativeAdViewManagerImpl.loadAd(view)
|
|
61
|
+
|
|
62
|
+
override fun destroyAd(view: CloudXNativeAdView) = CloudXNativeAdViewManagerImpl.destroyAd(view)
|
|
63
|
+
|
|
64
|
+
override fun updateAssetView(view: CloudXNativeAdView, assetViewTag: Int, assetName: String) =
|
|
65
|
+
CloudXNativeAdViewManagerImpl.updateAssetView(view, assetViewTag, assetName)
|
|
66
|
+
|
|
67
|
+
override fun renderNativeAd(view: CloudXNativeAdView) = CloudXNativeAdViewManagerImpl.renderNativeAd(view)
|
|
68
|
+
|
|
69
|
+
// React-children shadow accessors: see CloudXNativeAdViewManagerImpl for why
|
|
70
|
+
// the SDK-owned ad view must stay invisible to React's manageChildren.
|
|
71
|
+
|
|
72
|
+
override fun getChildCount(parent: CloudXNativeAdView): Int = CloudXNativeAdViewManagerImpl.getChildCount(parent)
|
|
73
|
+
|
|
74
|
+
override fun getChildAt(parent: CloudXNativeAdView, index: Int): View? = CloudXNativeAdViewManagerImpl.getChildAt(parent, index)
|
|
75
|
+
|
|
76
|
+
override fun addView(parent: CloudXNativeAdView, child: View, index: Int) = CloudXNativeAdViewManagerImpl.addView(parent, child, index)
|
|
77
|
+
|
|
78
|
+
override fun removeViewAt(parent: CloudXNativeAdView, index: Int) = CloudXNativeAdViewManagerImpl.removeViewAt(parent, index)
|
|
79
|
+
|
|
80
|
+
override fun removeAllViews(parent: CloudXNativeAdView) = CloudXNativeAdViewManagerImpl.removeAllViews(parent)
|
|
81
|
+
|
|
82
|
+
override fun onDropViewInstance(view: CloudXNativeAdView) {
|
|
83
|
+
CloudXNativeAdViewManagerImpl.onDropViewInstance(view)
|
|
84
|
+
super.onDropViewInstance(view)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -95,6 +95,7 @@ class CloudXModule(reactContext: ReactApplicationContext) :
|
|
|
95
95
|
@ReactMethod fun showRewarded(adUnitId: String, placement: String?, customData: String?) = impl.showRewarded(adUnitId, placement, customData)
|
|
96
96
|
@ReactMethod fun destroyRewarded(adUnitId: String) = impl.destroyRewarded(adUnitId)
|
|
97
97
|
|
|
98
|
+
|
|
98
99
|
@ReactMethod fun addListener(eventName: String) {}
|
|
99
100
|
@ReactMethod fun removeListeners(count: Double) {}
|
|
100
101
|
|