@thealteroffice/react-native-adgeist 0.0.19 → 0.0.22
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/Adgeist.podspec +1 -1
- package/README.md +70 -521
- package/android/build.gradle +6 -3
- package/android/generated/java/com/adgeist/NativeAdgeistSpec.java +11 -11
- package/android/generated/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerDelegate.java +55 -0
- package/android/generated/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerInterface.java +24 -0
- package/android/generated/jni/RNAdgeistSpec-generated.cpp +12 -12
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.cpp +60 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.h +49 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/Props.cpp +28 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/Props.h +52 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +14 -22
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +36 -36
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.h +32 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/States.h +29 -0
- package/android/src/main/java/com/adgeist/AdgeistPackage.kt +8 -7
- package/android/src/main/java/com/adgeist/components/HTML5AdViewManagerImpl.kt +125 -0
- package/android/src/main/java/com/adgeist/modules/AdgeistImpl.kt +114 -0
- package/android/src/main/java/com/adgeist/utils/CreativeExtensions.kt +151 -0
- package/android/src/newarch/java/com/Adgeist.kt +119 -0
- package/android/src/newarch/java/com/HTML5AdViewManager.kt +77 -0
- package/android/src/oldarch/java/com/Adgeist.kt +132 -0
- package/android/src/oldarch/java/com/HTML5AdViewManager.kt +63 -0
- package/ios/Adgeist-Bridging-Header.h +3 -0
- package/ios/Adgeist.h +1 -1
- package/ios/Adgeist.mm +154 -38
- package/ios/AdgeistImpl.swift +188 -53
- package/ios/NativeHTML5AdManager.h +9 -0
- package/ios/NativeHTML5AdManager.mm +178 -0
- package/ios/NativeHTML5AdView.swift +136 -0
- package/ios/generated/RNAdgeistSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNAdgeistSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNAdgeistSpec/EventEmitters.cpp +60 -0
- package/ios/generated/RNAdgeistSpec/EventEmitters.h +49 -0
- package/ios/generated/RNAdgeistSpec/Props.cpp +28 -0
- package/ios/generated/RNAdgeistSpec/Props.h +52 -0
- package/ios/generated/RNAdgeistSpec/RCTComponentViewHelpers.h +65 -0
- package/ios/generated/RNAdgeistSpec/RNAdgeistSpec-generated.mm +17 -17
- package/ios/generated/RNAdgeistSpec/RNAdgeistSpec.h +17 -25
- package/ios/generated/RNAdgeistSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNAdgeistSpec/ShadowNodes.h +32 -0
- package/ios/generated/RNAdgeistSpec/States.cpp +16 -0
- package/ios/generated/RNAdgeistSpec/States.h +29 -0
- package/ios/generated/RNAdgeistSpecJSI-generated.cpp +14 -22
- package/ios/generated/RNAdgeistSpecJSI.h +36 -36
- package/lib/module/cdpclient/index.js +1 -25
- package/lib/module/cdpclient/index.js.map +1 -1
- package/lib/module/components/HTML5AdView.js +128 -0
- package/lib/module/components/HTML5AdView.js.map +1 -0
- package/lib/module/components/{BannerAd.js → deprecated/BannerAdView.js} +50 -79
- package/lib/module/components/deprecated/BannerAdView.js.map +1 -0
- package/lib/module/components/{ConsentModal.js → deprecated/ConsentModal.js} +2 -2
- package/lib/module/components/deprecated/ConsentModal.js.map +1 -0
- package/lib/module/constants.js +14 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/{components → providers}/AdgeistProvider.js +10 -35
- package/lib/module/providers/AdgeistProvider.js.map +1 -0
- package/lib/module/specs/HTML5AdNativeComponent.ts +46 -0
- package/lib/module/specs/NativeAdgeist.js.map +1 -0
- package/lib/module/types/AdSize.js +2 -0
- package/lib/module/types/AdSize.js.map +1 -0
- package/lib/module/types/CPMAdResponse.js +2 -0
- package/lib/module/types/CPMAdResponse.js.map +1 -0
- package/lib/module/types/FixedAdResponse.js +2 -0
- package/lib/module/types/FixedAdResponse.js.map +1 -0
- package/lib/module/types/HTML5AdNativeComponentProps.js +4 -0
- package/lib/module/types/HTML5AdNativeComponentProps.js.map +1 -0
- package/lib/module/types/Provider.js +2 -0
- package/lib/module/types/Provider.js.map +1 -0
- package/lib/typescript/src/cdpclient/index.d.ts +1 -21
- package/lib/typescript/src/cdpclient/index.d.ts.map +1 -1
- package/lib/typescript/src/components/HTML5AdView.d.ts +3 -0
- package/lib/typescript/src/components/HTML5AdView.d.ts.map +1 -0
- package/lib/typescript/src/components/deprecated/BannerAdView.d.ts +17 -0
- package/lib/typescript/src/components/deprecated/BannerAdView.d.ts.map +1 -0
- package/lib/typescript/src/components/deprecated/ConsentModal.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +10 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/providers/AdgeistProvider.d.ts +9 -0
- package/lib/typescript/src/providers/AdgeistProvider.d.ts.map +1 -0
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts +29 -0
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAdgeist.d.ts +28 -0
- package/lib/typescript/src/specs/NativeAdgeist.d.ts.map +1 -0
- package/lib/typescript/src/types/AdSize.d.ts +5 -0
- package/lib/typescript/src/types/AdSize.d.ts.map +1 -0
- package/lib/typescript/src/types/CPMAdResponse.d.ts +25 -0
- package/lib/typescript/src/types/CPMAdResponse.d.ts.map +1 -0
- package/lib/typescript/src/types/FixedAdResponse.d.ts +50 -0
- package/lib/typescript/src/types/FixedAdResponse.d.ts.map +1 -0
- package/lib/typescript/src/types/HTML5AdNativeComponentProps.d.ts +24 -0
- package/lib/typescript/src/types/HTML5AdNativeComponentProps.d.ts.map +1 -0
- package/lib/typescript/src/types/Provider.d.ts +16 -0
- package/lib/typescript/src/types/Provider.d.ts.map +1 -0
- package/package.json +8 -3
- package/plugin/build/android/withRNAdgeistMainApplication.d.ts +3 -0
- package/plugin/build/android/withRNAdgeistMainApplication.js +65 -0
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +25 -0
- package/plugin/build/ios/withRNAdgeistAppDelegate.d.ts +4 -0
- package/plugin/build/ios/withRNAdgeistAppDelegate.js +66 -0
- package/react-native.config.js +1 -1
- package/src/cdpclient/index.ts +1 -21
- package/src/components/HTML5AdView.tsx +161 -0
- package/src/components/{BannerAd.tsx → deprecated/BannerAdView.tsx} +80 -115
- package/src/components/{ConsentModal.tsx → deprecated/ConsentModal.tsx} +2 -2
- package/src/constants.ts +8 -0
- package/src/index.tsx +4 -2
- package/src/{components → providers}/AdgeistProvider.tsx +26 -60
- package/src/specs/HTML5AdNativeComponent.ts +46 -0
- package/src/{NativeAdgeist.ts → specs/NativeAdgeist.ts} +26 -25
- package/src/types/AdSize.ts +4 -0
- package/src/types/CPMAdResponse.ts +26 -0
- package/src/types/FixedAdResponse.ts +51 -0
- package/src/types/HTML5AdNativeComponentProps.ts +28 -0
- package/src/types/Provider.ts +16 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/com/adgeist/implementation/AdgeistModuleImpl.kt +0 -252
- package/android/src/newarch/java/com/AdgeistModule.kt +0 -135
- package/android/src/oldarch/java/com/AdgeistModule.kt +0 -148
- package/ios/adgeist-Bridging-Header.h +0 -1
- package/lib/module/NativeAdgeist.js.map +0 -1
- package/lib/module/components/AdgeistProvider.js.map +0 -1
- package/lib/module/components/BannerAd.js.map +0 -1
- package/lib/module/components/ConsentModal.js.map +0 -1
- package/lib/typescript/src/NativeAdgeist.d.ts +0 -28
- package/lib/typescript/src/NativeAdgeist.d.ts.map +0 -1
- package/lib/typescript/src/components/AdgeistProvider.d.ts +0 -50
- package/lib/typescript/src/components/AdgeistProvider.d.ts.map +0 -1
- package/lib/typescript/src/components/BannerAd.d.ts +0 -64
- package/lib/typescript/src/components/BannerAd.d.ts.map +0 -1
- package/lib/typescript/src/components/ConsentModal.d.ts.map +0 -1
- /package/lib/module/{NativeAdgeist.js → specs/NativeAdgeist.js} +0 -0
- /package/lib/typescript/src/components/{ConsentModal.d.ts → deprecated/ConsentModal.d.ts} +0 -0
|
@@ -20,18 +20,18 @@ protected:
|
|
|
20
20
|
NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
21
|
|
|
22
22
|
public:
|
|
23
|
-
virtual jsi::Value initializeSdk(jsi::Runtime &rt, jsi::String
|
|
24
|
-
virtual jsi::Value
|
|
23
|
+
virtual jsi::Value initializeSdk(jsi::Runtime &rt, jsi::String customBidRequestBackendDomain, jsi::String customPackageOrBundleID, jsi::String customAdgeistAppID) = 0;
|
|
24
|
+
virtual jsi::Value destroySdk(jsi::Runtime &rt) = 0;
|
|
25
|
+
virtual jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String adSpaceId, jsi::String buyType, bool isTestEnvironment) = 0;
|
|
25
26
|
virtual void setUserDetails(jsi::Runtime &rt, jsi::Object user) = 0;
|
|
26
27
|
virtual void logEvent(jsi::Runtime &rt, jsi::Object event) = 0;
|
|
27
28
|
virtual jsi::Value getConsentStatus(jsi::Runtime &rt) = 0;
|
|
28
29
|
virtual void updateConsentStatus(jsi::Runtime &rt, bool consent) = 0;
|
|
29
|
-
virtual jsi::Value trackImpression(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
30
|
-
virtual jsi::Value trackView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
31
|
-
virtual jsi::Value trackTotalView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
32
|
-
virtual jsi::Value trackClick(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
33
|
-
virtual jsi::Value trackVideoPlayback(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
34
|
-
virtual jsi::Value trackVideoQuartile(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment, jsi::String quartile) = 0;
|
|
30
|
+
virtual jsi::Value trackImpression(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double renderTime) = 0;
|
|
31
|
+
virtual jsi::Value trackView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double viewTime, double visibilityRatio, double scrollDepth, double timeToVisible) = 0;
|
|
32
|
+
virtual jsi::Value trackTotalView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double totalViewTime) = 0;
|
|
33
|
+
virtual jsi::Value trackClick(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment) = 0;
|
|
34
|
+
virtual jsi::Value trackVideoPlayback(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double totalPlaybackTime) = 0;
|
|
35
35
|
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -62,21 +62,29 @@ private:
|
|
|
62
62
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
jsi::Value initializeSdk(jsi::Runtime &rt, jsi::String
|
|
65
|
+
jsi::Value initializeSdk(jsi::Runtime &rt, jsi::String customBidRequestBackendDomain, jsi::String customPackageOrBundleID, jsi::String customAdgeistAppID) override {
|
|
66
66
|
static_assert(
|
|
67
|
-
bridging::getParameterCount(&T::initializeSdk) ==
|
|
68
|
-
"Expected initializeSdk(...) to have
|
|
67
|
+
bridging::getParameterCount(&T::initializeSdk) == 4,
|
|
68
|
+
"Expected initializeSdk(...) to have 4 parameters");
|
|
69
69
|
|
|
70
70
|
return bridging::callFromJs<jsi::Value>(
|
|
71
|
-
rt, &T::initializeSdk, jsInvoker_, instance_, std::move(
|
|
71
|
+
rt, &T::initializeSdk, jsInvoker_, instance_, std::move(customBidRequestBackendDomain), std::move(customPackageOrBundleID), std::move(customAdgeistAppID));
|
|
72
72
|
}
|
|
73
|
-
jsi::Value
|
|
73
|
+
jsi::Value destroySdk(jsi::Runtime &rt) override {
|
|
74
74
|
static_assert(
|
|
75
|
-
bridging::getParameterCount(&T::
|
|
76
|
-
"Expected
|
|
75
|
+
bridging::getParameterCount(&T::destroySdk) == 1,
|
|
76
|
+
"Expected destroySdk(...) to have 1 parameters");
|
|
77
77
|
|
|
78
78
|
return bridging::callFromJs<jsi::Value>(
|
|
79
|
-
rt, &T::
|
|
79
|
+
rt, &T::destroySdk, jsInvoker_, instance_);
|
|
80
|
+
}
|
|
81
|
+
jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String adSpaceId, jsi::String buyType, bool isTestEnvironment) override {
|
|
82
|
+
static_assert(
|
|
83
|
+
bridging::getParameterCount(&T::fetchCreative) == 4,
|
|
84
|
+
"Expected fetchCreative(...) to have 4 parameters");
|
|
85
|
+
|
|
86
|
+
return bridging::callFromJs<jsi::Value>(
|
|
87
|
+
rt, &T::fetchCreative, jsInvoker_, instance_, std::move(adSpaceId), std::move(buyType), std::move(isTestEnvironment));
|
|
80
88
|
}
|
|
81
89
|
void setUserDetails(jsi::Runtime &rt, jsi::Object user) override {
|
|
82
90
|
static_assert(
|
|
@@ -110,53 +118,45 @@ private:
|
|
|
110
118
|
return bridging::callFromJs<void>(
|
|
111
119
|
rt, &T::updateConsentStatus, jsInvoker_, instance_, std::move(consent));
|
|
112
120
|
}
|
|
113
|
-
jsi::Value trackImpression(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
121
|
+
jsi::Value trackImpression(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double renderTime) override {
|
|
114
122
|
static_assert(
|
|
115
123
|
bridging::getParameterCount(&T::trackImpression) == 8,
|
|
116
124
|
"Expected trackImpression(...) to have 8 parameters");
|
|
117
125
|
|
|
118
126
|
return bridging::callFromJs<jsi::Value>(
|
|
119
|
-
rt, &T::trackImpression, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(
|
|
127
|
+
rt, &T::trackImpression, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(bidId), std::move(bidMeta), std::move(buyType), std::move(isTestEnvironment), std::move(renderTime));
|
|
120
128
|
}
|
|
121
|
-
jsi::Value trackView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
129
|
+
jsi::Value trackView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double viewTime, double visibilityRatio, double scrollDepth, double timeToVisible) override {
|
|
122
130
|
static_assert(
|
|
123
131
|
bridging::getParameterCount(&T::trackView) == 11,
|
|
124
132
|
"Expected trackView(...) to have 11 parameters");
|
|
125
133
|
|
|
126
134
|
return bridging::callFromJs<jsi::Value>(
|
|
127
|
-
rt, &T::trackView, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(
|
|
135
|
+
rt, &T::trackView, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(bidId), std::move(bidMeta), std::move(buyType), std::move(isTestEnvironment), std::move(viewTime), std::move(visibilityRatio), std::move(scrollDepth), std::move(timeToVisible));
|
|
128
136
|
}
|
|
129
|
-
jsi::Value trackTotalView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
137
|
+
jsi::Value trackTotalView(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double totalViewTime) override {
|
|
130
138
|
static_assert(
|
|
131
|
-
bridging::getParameterCount(&T::trackTotalView) ==
|
|
132
|
-
"Expected trackTotalView(...) to have
|
|
139
|
+
bridging::getParameterCount(&T::trackTotalView) == 8,
|
|
140
|
+
"Expected trackTotalView(...) to have 8 parameters");
|
|
133
141
|
|
|
134
142
|
return bridging::callFromJs<jsi::Value>(
|
|
135
|
-
rt, &T::trackTotalView, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(
|
|
143
|
+
rt, &T::trackTotalView, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(bidId), std::move(bidMeta), std::move(buyType), std::move(isTestEnvironment), std::move(totalViewTime));
|
|
136
144
|
}
|
|
137
|
-
jsi::Value trackClick(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
145
|
+
jsi::Value trackClick(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment) override {
|
|
138
146
|
static_assert(
|
|
139
147
|
bridging::getParameterCount(&T::trackClick) == 7,
|
|
140
148
|
"Expected trackClick(...) to have 7 parameters");
|
|
141
149
|
|
|
142
150
|
return bridging::callFromJs<jsi::Value>(
|
|
143
|
-
rt, &T::trackClick, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(
|
|
151
|
+
rt, &T::trackClick, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(bidId), std::move(bidMeta), std::move(buyType), std::move(isTestEnvironment));
|
|
144
152
|
}
|
|
145
|
-
jsi::Value trackVideoPlayback(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String
|
|
153
|
+
jsi::Value trackVideoPlayback(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String bidId, jsi::String bidMeta, jsi::String buyType, bool isTestEnvironment, double totalPlaybackTime) override {
|
|
146
154
|
static_assert(
|
|
147
155
|
bridging::getParameterCount(&T::trackVideoPlayback) == 8,
|
|
148
156
|
"Expected trackVideoPlayback(...) to have 8 parameters");
|
|
149
157
|
|
|
150
158
|
return bridging::callFromJs<jsi::Value>(
|
|
151
|
-
rt, &T::trackVideoPlayback, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(
|
|
152
|
-
}
|
|
153
|
-
jsi::Value trackVideoQuartile(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment, jsi::String quartile) override {
|
|
154
|
-
static_assert(
|
|
155
|
-
bridging::getParameterCount(&T::trackVideoQuartile) == 8,
|
|
156
|
-
"Expected trackVideoQuartile(...) to have 8 parameters");
|
|
157
|
-
|
|
158
|
-
return bridging::callFromJs<jsi::Value>(
|
|
159
|
-
rt, &T::trackVideoQuartile, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(publisherId), std::move(apiKey), std::move(bidId), std::move(isTestEnvironment), std::move(quartile));
|
|
159
|
+
rt, &T::trackVideoPlayback, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(bidId), std::move(bidMeta), std::move(buyType), std::move(isTestEnvironment), std::move(totalPlaybackTime));
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
private:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
extern const char HTML5AdNativeComponentComponentName[] = "HTML5AdNativeComponent";
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT extern const char HTML5AdNativeComponentComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <HTML5AdNativeComponent> component.
|
|
25
|
+
*/
|
|
26
|
+
using HTML5AdNativeComponentShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
HTML5AdNativeComponentComponentName,
|
|
28
|
+
HTML5AdNativeComponentProps,
|
|
29
|
+
HTML5AdNativeComponentEventEmitter,
|
|
30
|
+
HTML5AdNativeComponentState>;
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include "States.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class HTML5AdNativeComponentState {
|
|
18
|
+
public:
|
|
19
|
+
HTML5AdNativeComponentState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
HTML5AdNativeComponentState(HTML5AdNativeComponentState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
package com.adgeist
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.Nullable
|
|
4
|
+
import com.adgeist.components.HTML5AdViewManager
|
|
4
5
|
import com.facebook.react.TurboReactPackage
|
|
5
6
|
import com.facebook.react.bridge.NativeModule
|
|
6
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
8
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
8
9
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
9
10
|
import com.facebook.react.uimanager.ViewManager
|
|
10
|
-
import com.adgeist.
|
|
11
|
+
import com.adgeist.modules.AdgeistImpl
|
|
11
12
|
import java.util.HashMap
|
|
12
13
|
|
|
13
14
|
class AdgeistPackage : TurboReactPackage() {
|
|
14
15
|
|
|
15
16
|
@Nullable
|
|
16
17
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
17
|
-
return if (name ==
|
|
18
|
-
|
|
18
|
+
return if (name == AdgeistImpl.NAME) {
|
|
19
|
+
Adgeist(reactContext)
|
|
19
20
|
} else {
|
|
20
21
|
null
|
|
21
22
|
}
|
|
@@ -24,9 +25,9 @@ class AdgeistPackage : TurboReactPackage() {
|
|
|
24
25
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
25
26
|
return ReactModuleInfoProvider {
|
|
26
27
|
val moduleInfos = HashMap<String, ReactModuleInfo>()
|
|
27
|
-
moduleInfos[
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
moduleInfos[AdgeistImpl.NAME] = ReactModuleInfo(
|
|
29
|
+
AdgeistImpl.NAME,
|
|
30
|
+
AdgeistImpl.NAME,
|
|
30
31
|
false, // canOverrideExistingModule
|
|
31
32
|
false, // needsEagerInit
|
|
32
33
|
false, // isCxxModule
|
|
@@ -37,6 +38,6 @@ class AdgeistPackage : TurboReactPackage() {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
40
|
-
return
|
|
41
|
+
return listOf(HTML5AdViewManager())
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
package com.adgeist.components
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import android.view.View
|
|
5
|
+
import androidx.annotation.RequiresPermission
|
|
6
|
+
import com.adgeistkit.ads.AdListener
|
|
7
|
+
import com.adgeistkit.ads.AdSize
|
|
8
|
+
import com.adgeistkit.ads.AdView
|
|
9
|
+
import com.adgeistkit.ads.network.AdRequest
|
|
10
|
+
import com.facebook.react.bridge.Arguments
|
|
11
|
+
import com.facebook.react.bridge.ReadableMap
|
|
12
|
+
import com.facebook.react.bridge.WritableMap
|
|
13
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
14
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
15
|
+
|
|
16
|
+
object HTML5AdViewManagerImpl {
|
|
17
|
+
const val NAME = "HTML5AdNativeComponent"
|
|
18
|
+
private const val TAG = "HTML5AdViewManagerImpl"
|
|
19
|
+
|
|
20
|
+
const val EVENT_AD_LOADED = "onAdLoaded"
|
|
21
|
+
const val EVENT_AD_FAILED_TO_LOAD = "onAdFailedToLoad"
|
|
22
|
+
const val EVENT_AD_OPENED = "onAdOpened"
|
|
23
|
+
const val EVENT_AD_CLOSED = "onAdClosed"
|
|
24
|
+
const val EVENT_AD_CLICKED = "onAdClicked"
|
|
25
|
+
|
|
26
|
+
fun createViewInstance(reactContext: ThemedReactContext): AdView {
|
|
27
|
+
return AdView(reactContext)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
fun setAdUnitID(view: AdView, adUnitID: String?) {
|
|
31
|
+
if (adUnitID != null) {
|
|
32
|
+
view.adUnitId = adUnitID
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fun setAdIsResponsive(view: AdView, adIsResponsive: Boolean) {
|
|
37
|
+
view.adIsResponsive = adIsResponsive
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fun setAdSize(view: AdView, adSizeMap: ReadableMap?) {
|
|
41
|
+
if (adSizeMap != null) {
|
|
42
|
+
try {
|
|
43
|
+
val width = adSizeMap.getInt("width")
|
|
44
|
+
val height = adSizeMap.getInt("height")
|
|
45
|
+
|
|
46
|
+
val adSize = AdSize(width, height)
|
|
47
|
+
|
|
48
|
+
view.setAdDimension(adSize)
|
|
49
|
+
} catch (e: Exception) {
|
|
50
|
+
Log.e(TAG, "Error setting ad size", e)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fun setAdType(view: AdView, adType: String?) {
|
|
56
|
+
if (adType != null) {
|
|
57
|
+
view.adType = adType
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@RequiresPermission("android.permission.INTERNET")
|
|
62
|
+
fun loadAd(view: AdView, isTestMode: Boolean) {
|
|
63
|
+
try {
|
|
64
|
+
val adRequestBuilder = AdRequest.Builder()
|
|
65
|
+
adRequestBuilder.setTestMode(isTestMode)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
val adRequest = adRequestBuilder.build()
|
|
69
|
+
|
|
70
|
+
view.setAdListener(object : AdListener() {
|
|
71
|
+
override fun onAdLoaded() {
|
|
72
|
+
view.post {
|
|
73
|
+
sendEvent(view, EVENT_AD_LOADED, Arguments.createMap())
|
|
74
|
+
measureAndLayout(view)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override fun onAdFailedToLoad(error: String) {
|
|
79
|
+
val event = Arguments.createMap().apply {
|
|
80
|
+
putString("error", error)
|
|
81
|
+
}
|
|
82
|
+
sendEvent(view, EVENT_AD_FAILED_TO_LOAD, event)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override fun onAdOpened() {
|
|
86
|
+
sendEvent(view, EVENT_AD_OPENED, Arguments.createMap())
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override fun onAdClosed() {
|
|
90
|
+
sendEvent(view, EVENT_AD_CLOSED, Arguments.createMap())
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
override fun onAdClicked() {
|
|
94
|
+
sendEvent(view, EVENT_AD_CLICKED, Arguments.createMap())
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
view.loadAd(adRequest)
|
|
99
|
+
} catch (e: Exception) {
|
|
100
|
+
val event = Arguments.createMap().apply {
|
|
101
|
+
putString("error", e.message ?: "Unknown error")
|
|
102
|
+
}
|
|
103
|
+
sendEvent(view, EVENT_AD_FAILED_TO_LOAD, event)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
fun destroyAd(view: AdView) {
|
|
108
|
+
view.destroy()
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private fun measureAndLayout(view: AdView) {
|
|
112
|
+
view.measure(
|
|
113
|
+
View.MeasureSpec.makeMeasureSpec(view.width, View.MeasureSpec.EXACTLY),
|
|
114
|
+
View.MeasureSpec.makeMeasureSpec(view.height, View.MeasureSpec.EXACTLY)
|
|
115
|
+
)
|
|
116
|
+
view.layout(view.left, view.top, view.right, view.bottom)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private fun sendEvent(view: AdView, eventName: String, params: WritableMap) {
|
|
120
|
+
val reactContext = view.context as ThemedReactContext
|
|
121
|
+
reactContext
|
|
122
|
+
.getJSModule(RCTEventEmitter::class.java)
|
|
123
|
+
.receiveEvent(view.id, eventName, params)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
package com.adgeist.modules
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.adgeistkit.AdgeistCore
|
|
7
|
+
import com.adgeistkit.data.models.CPMAdResponse
|
|
8
|
+
import com.adgeistkit.data.models.Event
|
|
9
|
+
import com.adgeistkit.data.models.FixedAdResponse
|
|
10
|
+
import com.adgeistkit.data.models.UserDetails
|
|
11
|
+
import com.adgeistkit.data.network.CreativeAnalytics
|
|
12
|
+
import com.adgeistkit.data.network.FetchCreative
|
|
13
|
+
|
|
14
|
+
import com.facebook.react.bridge.ReadableMap
|
|
15
|
+
import com.adgeist.utils.toWritableMap
|
|
16
|
+
import com.adgeistkit.ads.network.AnalyticsRequest
|
|
17
|
+
import com.adgeistkit.ads.network.AnalyticsRequestDEPRECATED
|
|
18
|
+
|
|
19
|
+
class AdgeistImpl internal constructor(private val context: ReactApplicationContext) {
|
|
20
|
+
|
|
21
|
+
private var adgeistInstance: AdgeistCore? = null
|
|
22
|
+
private var getAd: FetchCreative? = null
|
|
23
|
+
private var postCreativeAnalytic: CreativeAnalytics? = null
|
|
24
|
+
|
|
25
|
+
fun initializeSdk(customBidRequestBackendDomain: String?, customPackageOrBundleID: String?, customAdgeistAppID: String?, promise: Promise) {
|
|
26
|
+
try {
|
|
27
|
+
adgeistInstance = AdgeistCore.initialize(context.applicationContext, customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID)
|
|
28
|
+
getAd = adgeistInstance?.getCreative()
|
|
29
|
+
postCreativeAnalytic = adgeistInstance?.postCreativeAnalytics()
|
|
30
|
+
promise.resolve("SDK initialized with domain: ${customBidRequestBackendDomain ?: "default"}")
|
|
31
|
+
} catch (e: Exception) {
|
|
32
|
+
promise.reject("INIT_FAILED", "SDK initialization failed", e)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fun destroySdk(promise: Promise) {
|
|
37
|
+
AdgeistCore.destroy()
|
|
38
|
+
promise.resolve("SDK destroyed")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fun fetchCreative(adSpaceId: String, buyType: String, isTestEnvironment: Boolean, promise: Promise) {
|
|
42
|
+
getAd?.fetchCreative(adSpaceId, buyType, isTestEnvironment) { adData ->
|
|
43
|
+
if (adData != null) {
|
|
44
|
+
when (adData) {
|
|
45
|
+
is CPMAdResponse -> {
|
|
46
|
+
promise.resolve(adData.toWritableMap())
|
|
47
|
+
}
|
|
48
|
+
is FixedAdResponse -> {
|
|
49
|
+
promise.resolve(adData.toWritableMap())
|
|
50
|
+
}
|
|
51
|
+
else -> {
|
|
52
|
+
promise.resolve(null)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
promise.reject("NO_AD", "Ad data not available")
|
|
57
|
+
}
|
|
58
|
+
} ?: promise.reject("NOT_INITIALIZED", "SDK not initialized")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fun sendCreativeAnalytics(analyticsRequestDEPRECATED : AnalyticsRequestDEPRECATED, promise: Promise) {
|
|
62
|
+
postCreativeAnalytic?.sendTrackingData(analyticsRequestDEPRECATED)
|
|
63
|
+
promise.resolve("Event sent successfully")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
fun setUserDetails(userDetailsMap: ReadableMap) {
|
|
67
|
+
val userDetails = UserDetails(
|
|
68
|
+
userId = userDetailsMap.getStringSafe("userId"),
|
|
69
|
+
userName = userDetailsMap.getStringSafe("userName"),
|
|
70
|
+
email = userDetailsMap.getStringSafe("email"),
|
|
71
|
+
phone = userDetailsMap.getStringSafe("phone")
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
adgeistInstance?.setUserDetails(userDetails)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
fun logEvent(eventMap: ReadableMap) {
|
|
78
|
+
val eventType = eventMap.getStringSafe("eventType")
|
|
79
|
+
|
|
80
|
+
if (eventType.isNullOrEmpty()) {
|
|
81
|
+
throw IllegalArgumentException("Event must have a non-empty eventType")
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
val props = if (eventMap.hasKey("eventProperties")) eventMap.getMap("eventProperties") else null
|
|
85
|
+
val eventProps = props?.toHashMap() ?: emptyMap<String, Any>()
|
|
86
|
+
|
|
87
|
+
val event = Event(
|
|
88
|
+
eventType = eventType,
|
|
89
|
+
eventProperties = eventProps
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
adgeistInstance?.logEvent(event)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
fun getConsentStatus(promise: Promise) {
|
|
96
|
+
try {
|
|
97
|
+
val consent = adgeistInstance?.getConsentStatus() ?: false
|
|
98
|
+
promise.resolve(consent)
|
|
99
|
+
} catch (e: Exception) {
|
|
100
|
+
promise.reject("CONSENT_ERROR", "Failed to get consent status", e)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
fun updateConsentStatus(consent: Boolean) {
|
|
105
|
+
adgeistInstance?.updateConsentStatus(consent)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
companion object {
|
|
109
|
+
const val NAME = "Adgeist"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
fun ReadableMap.getStringSafe(key: String): String? =
|
|
114
|
+
if (this.hasKey(key) && !this.isNull(key)) this.getString(key) else null
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
package com.adgeist.utils
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.WritableMap
|
|
5
|
+
import com.adgeistkit.data.models.*
|
|
6
|
+
|
|
7
|
+
fun CPMAdResponse.toWritableMap(): WritableMap {
|
|
8
|
+
val map = Arguments.createMap()
|
|
9
|
+
|
|
10
|
+
map.putBoolean("success", success)
|
|
11
|
+
map.putString("message", message)
|
|
12
|
+
|
|
13
|
+
val dataMap = Arguments.createMap()
|
|
14
|
+
val d = data
|
|
15
|
+
|
|
16
|
+
if (d != null) {
|
|
17
|
+
dataMap.putString("id", d.id)
|
|
18
|
+
dataMap.putString("bidId", d.bidId)
|
|
19
|
+
dataMap.putString("cur", d.cur)
|
|
20
|
+
|
|
21
|
+
val seatBidArray = Arguments.createArray()
|
|
22
|
+
d.seatBid.forEach { seatBid ->
|
|
23
|
+
val seatMap = Arguments.createMap()
|
|
24
|
+
seatMap.putString("bidId", seatBid.bidId)
|
|
25
|
+
|
|
26
|
+
val bidArr = Arguments.createArray()
|
|
27
|
+
seatBid.bid.forEach { bid ->
|
|
28
|
+
val bidMap = Arguments.createMap()
|
|
29
|
+
bidMap.putString("id", bid.id)
|
|
30
|
+
bidMap.putString("impId", bid.impId)
|
|
31
|
+
bidMap.putDouble("price", bid.price)
|
|
32
|
+
|
|
33
|
+
val extMap = Arguments.createMap()
|
|
34
|
+
extMap.putString("creativeUrl", bid.ext.creativeUrl)
|
|
35
|
+
extMap.putString("ctaUrl", bid.ext.ctaUrl)
|
|
36
|
+
extMap.putString("creativeTitle", bid.ext.creativeTitle)
|
|
37
|
+
extMap.putString("creativeDescription", bid.ext.creativeDescription)
|
|
38
|
+
|
|
39
|
+
bidMap.putMap("ext", extMap)
|
|
40
|
+
bidArr.pushMap(bidMap)
|
|
41
|
+
}
|
|
42
|
+
seatMap.putArray("bid", bidArr)
|
|
43
|
+
seatBidArray.pushMap(seatMap)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
dataMap.putArray("seatBid", seatBidArray)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
map.putMap("data", dataMap)
|
|
50
|
+
return map
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
fun FixedAdResponse.toWritableMap(): WritableMap {
|
|
54
|
+
val map = Arguments.createMap()
|
|
55
|
+
|
|
56
|
+
map.putString("metaData", metaData)
|
|
57
|
+
map.putString("id", id)
|
|
58
|
+
map.putString("generatedAt", generatedAt)
|
|
59
|
+
map.putString("campaignId", campaignId)
|
|
60
|
+
map.putString("type", type)
|
|
61
|
+
map.putString("loadType", loadType)
|
|
62
|
+
map.putInt("frontendCacheDurationSeconds", frontendCacheDurationSeconds ?: 0)
|
|
63
|
+
|
|
64
|
+
advertiser?.let {
|
|
65
|
+
val advMap = Arguments.createMap()
|
|
66
|
+
advMap.putString("id", it.id)
|
|
67
|
+
advMap.putString("name", it.name)
|
|
68
|
+
advMap.putString("logoUrl", it.logoUrl)
|
|
69
|
+
map.putMap("advertiser", advMap)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
campaignValidity?.let {
|
|
73
|
+
val cvMap = Arguments.createMap()
|
|
74
|
+
cvMap.putString("startTime", it.startTime)
|
|
75
|
+
cvMap.putString("endTime", it.endTime)
|
|
76
|
+
map.putMap("campaignValidity", cvMap)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
creatives?.let { list ->
|
|
80
|
+
val arr = Arguments.createArray()
|
|
81
|
+
list.forEach { creative ->
|
|
82
|
+
val cMap = Arguments.createMap()
|
|
83
|
+
cMap.putString("ctaUrl", creative.ctaUrl)
|
|
84
|
+
cMap.putString("description", creative.description)
|
|
85
|
+
cMap.putString("fileName", creative.fileName)
|
|
86
|
+
cMap.putInt("fileSize", creative.fileSize ?: 0)
|
|
87
|
+
cMap.putString("fileUrl", creative.fileUrl)
|
|
88
|
+
cMap.putString("thumbnailUrl", creative.thumbnailUrl)
|
|
89
|
+
cMap.putString("title", creative.title)
|
|
90
|
+
cMap.putString("type", creative.type)
|
|
91
|
+
|
|
92
|
+
creative.contentModerationResult?.let {
|
|
93
|
+
val cm = Arguments.createMap()
|
|
94
|
+
cm.putString("\$oid", it.`$oid`)
|
|
95
|
+
cMap.putMap("contentModerationResult", cm)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
creative.createdAt?.let {
|
|
99
|
+
val cm = Arguments.createMap()
|
|
100
|
+
cm.putDouble("\$date", it.`$date`?.toDouble() ?: 0.0)
|
|
101
|
+
cMap.putMap("createdAt", cm)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
creative.updatedAt?.let {
|
|
105
|
+
val cm = Arguments.createMap()
|
|
106
|
+
cm.putDouble("\$date", it.`$date`?.toDouble() ?: 0.0)
|
|
107
|
+
cMap.putMap("updatedAt", cm)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
arr.pushMap(cMap)
|
|
111
|
+
}
|
|
112
|
+
map.putArray("creatives", arr)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
displayOptions?.let { opt ->
|
|
116
|
+
val opMap = Arguments.createMap()
|
|
117
|
+
opMap.putBoolean("isResponsive", opt.isResponsive ?: false)
|
|
118
|
+
opMap.putString("responsiveType", opt.responsiveType)
|
|
119
|
+
|
|
120
|
+
opt.dimensions?.let {
|
|
121
|
+
val dim = Arguments.createMap()
|
|
122
|
+
dim.putInt("height", it.height ?: 0)
|
|
123
|
+
dim.putInt("width", it.width ?: 0)
|
|
124
|
+
opMap.putMap("dimensions", dim)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
opt.styleOptions?.let {
|
|
128
|
+
val st = Arguments.createMap()
|
|
129
|
+
st.putString("fontColor", it.fontColor)
|
|
130
|
+
st.putString("fontFamily", it.fontFamily)
|
|
131
|
+
opMap.putMap("styleOptions", st)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
opt.allowedFormats?.let { list ->
|
|
135
|
+
val arr = Arguments.createArray()
|
|
136
|
+
list.forEach { arr.pushString(it) }
|
|
137
|
+
opMap.putArray("allowedFormats", arr)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
map.putMap("displayOptions", opMap)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
impressionRequirements?.let {
|
|
144
|
+
val ir = Arguments.createMap()
|
|
145
|
+
ir.putString("impressionType", it.impressionType)
|
|
146
|
+
ir.putInt("minViewDurationSeconds", it.minViewDurationSeconds ?: 0)
|
|
147
|
+
map.putMap("impressionRequirements", ir)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return map
|
|
151
|
+
}
|