@thealteroffice/react-native-adgeist 0.0.26-beta → 0.0.27-beta
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 +4 -11
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAdgeistSpec.java +84 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerDelegate.java +55 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerInterface.java +24 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec-generated.cpp +98 -0
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec.h +31 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.cpp +60 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.h +49 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/Props.cpp +28 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/Props.h +52 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +142 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +170 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/States.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/States.h +29 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/adgeist/components/HTML5AdViewManagerImpl.kt +11 -5
- package/android/src/main/java/com/adgeist/modules/AdgeistImpl.kt +2 -2
- package/android/src/newarch/java/com/Adgeist.kt +2 -3
- package/android/src/newarch/java/com/HTML5AdViewManager.kt +2 -5
- package/android/src/oldarch/java/com/Adgeist.kt +2 -2
- package/android/src/oldarch/java/com/HTML5AdViewManager.kt +33 -0
- package/ios/Adgeist.mm +2 -0
- package/ios/AdgeistImpl.swift +3 -1
- package/lib/module/components/HTML5AdView.js +3 -3
- package/lib/module/components/HTML5AdView.js.map +1 -1
- package/lib/module/constants.js +2 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/providers/AdgeistProvider.js +4 -3
- package/lib/module/providers/AdgeistProvider.js.map +1 -1
- package/lib/module/specs/HTML5AdNativeComponent.ts +30 -0
- package/lib/module/specs/NativeAdgeist.js.map +1 -1
- package/lib/typescript/src/constants.d.ts +2 -0
- package/lib/typescript/src/constants.d.ts.map +1 -1
- package/lib/typescript/src/providers/AdgeistProvider.d.ts.map +1 -1
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts +4 -0
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeAdgeist.d.ts +1 -1
- package/lib/typescript/src/specs/NativeAdgeist.d.ts.map +1 -1
- package/lib/typescript/src/types/Provider.d.ts +3 -3
- package/lib/typescript/src/types/Provider.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/components/HTML5AdView.tsx +3 -3
- package/src/constants.ts +3 -0
- package/src/providers/AdgeistProvider.tsx +5 -3
- package/src/specs/HTML5AdNativeComponent.ts +30 -0
- package/src/specs/NativeAdgeist.ts +4 -3
- package/src/types/Provider.ts +3 -3
|
@@ -0,0 +1,142 @@
|
|
|
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: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNAdgeistSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_initializeSdk(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->initializeSdk(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asString(rt)),
|
|
18
|
+
count <= 1 || args[1].isNull() || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asString(rt)),
|
|
19
|
+
count <= 2 || args[2].isNull() || args[2].isUndefined() ? std::nullopt : std::make_optional(args[2].asString(rt)),
|
|
20
|
+
count <= 3 || args[3].isNull() || args[3].isUndefined() ? std::nullopt : std::make_optional(args[3].asString(rt))
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_destroySdk(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
24
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->destroySdk(
|
|
25
|
+
rt
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
29
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->fetchCreative(
|
|
30
|
+
rt,
|
|
31
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
32
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
33
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asBool()
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_setUserDetails(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
37
|
+
static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->setUserDetails(
|
|
38
|
+
rt,
|
|
39
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
|
|
40
|
+
);
|
|
41
|
+
return jsi::Value::undefined();
|
|
42
|
+
}
|
|
43
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_logEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
44
|
+
static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->logEvent(
|
|
45
|
+
rt,
|
|
46
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
|
|
47
|
+
);
|
|
48
|
+
return jsi::Value::undefined();
|
|
49
|
+
}
|
|
50
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_getConsentStatus(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
51
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->getConsentStatus(
|
|
52
|
+
rt
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_updateConsentStatus(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
56
|
+
static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->updateConsentStatus(
|
|
57
|
+
rt,
|
|
58
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
|
|
59
|
+
);
|
|
60
|
+
return jsi::Value::undefined();
|
|
61
|
+
}
|
|
62
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_trackImpression(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
63
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->trackImpression(
|
|
64
|
+
rt,
|
|
65
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
66
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
67
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
68
|
+
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
69
|
+
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
|
|
70
|
+
count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asBool(),
|
|
71
|
+
count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asNumber()
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_trackView(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
75
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->trackView(
|
|
76
|
+
rt,
|
|
77
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
78
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
79
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
80
|
+
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
81
|
+
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
|
|
82
|
+
count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asBool(),
|
|
83
|
+
count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asNumber(),
|
|
84
|
+
count <= 7 ? throw jsi::JSError(rt, "Expected argument in position 7 to be passed") : args[7].asNumber(),
|
|
85
|
+
count <= 8 ? throw jsi::JSError(rt, "Expected argument in position 8 to be passed") : args[8].asNumber(),
|
|
86
|
+
count <= 9 ? throw jsi::JSError(rt, "Expected argument in position 9 to be passed") : args[9].asNumber()
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_trackTotalView(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
90
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->trackTotalView(
|
|
91
|
+
rt,
|
|
92
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
93
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
94
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
95
|
+
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
96
|
+
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
|
|
97
|
+
count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asBool(),
|
|
98
|
+
count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asNumber()
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_trackClick(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
102
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->trackClick(
|
|
103
|
+
rt,
|
|
104
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
105
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
106
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
107
|
+
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
108
|
+
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
|
|
109
|
+
count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asBool()
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_trackVideoPlayback(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
113
|
+
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->trackVideoPlayback(
|
|
114
|
+
rt,
|
|
115
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
116
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
117
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
118
|
+
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
119
|
+
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
|
|
120
|
+
count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asBool(),
|
|
121
|
+
count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asNumber()
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
NativeAdgeistCxxSpecJSI::NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
126
|
+
: TurboModule("Adgeist", jsInvoker) {
|
|
127
|
+
methodMap_["initializeSdk"] = MethodMetadata {4, __hostFunction_NativeAdgeistCxxSpecJSI_initializeSdk};
|
|
128
|
+
methodMap_["destroySdk"] = MethodMetadata {0, __hostFunction_NativeAdgeistCxxSpecJSI_destroySdk};
|
|
129
|
+
methodMap_["fetchCreative"] = MethodMetadata {3, __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative};
|
|
130
|
+
methodMap_["setUserDetails"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_setUserDetails};
|
|
131
|
+
methodMap_["logEvent"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_logEvent};
|
|
132
|
+
methodMap_["getConsentStatus"] = MethodMetadata {0, __hostFunction_NativeAdgeistCxxSpecJSI_getConsentStatus};
|
|
133
|
+
methodMap_["updateConsentStatus"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_updateConsentStatus};
|
|
134
|
+
methodMap_["trackImpression"] = MethodMetadata {7, __hostFunction_NativeAdgeistCxxSpecJSI_trackImpression};
|
|
135
|
+
methodMap_["trackView"] = MethodMetadata {10, __hostFunction_NativeAdgeistCxxSpecJSI_trackView};
|
|
136
|
+
methodMap_["trackTotalView"] = MethodMetadata {7, __hostFunction_NativeAdgeistCxxSpecJSI_trackTotalView};
|
|
137
|
+
methodMap_["trackClick"] = MethodMetadata {6, __hostFunction_NativeAdgeistCxxSpecJSI_trackClick};
|
|
138
|
+
methodMap_["trackVideoPlayback"] = MethodMetadata {7, __hostFunction_NativeAdgeistCxxSpecJSI_trackVideoPlayback};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,170 @@
|
|
|
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: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeAdgeistCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual jsi::Value initializeSdk(jsi::Runtime &rt, std::optional<jsi::String> customBidRequestBackendDomain, std::optional<jsi::String> customPackageOrBundleID, std::optional<jsi::String> customAdgeistAppID, std::optional<jsi::String> customVersioning) = 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;
|
|
26
|
+
virtual void setUserDetails(jsi::Runtime &rt, jsi::Object user) = 0;
|
|
27
|
+
virtual void logEvent(jsi::Runtime &rt, jsi::Object event) = 0;
|
|
28
|
+
virtual jsi::Value getConsentStatus(jsi::Runtime &rt) = 0;
|
|
29
|
+
virtual void updateConsentStatus(jsi::Runtime &rt, bool consent) = 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
|
+
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
template <typename T>
|
|
39
|
+
class JSI_EXPORT NativeAdgeistCxxSpec : public TurboModule {
|
|
40
|
+
public:
|
|
41
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
42
|
+
return delegate_.create(rt, propName);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
46
|
+
return delegate_.getPropertyNames(runtime);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static constexpr std::string_view kModuleName = "Adgeist";
|
|
50
|
+
|
|
51
|
+
protected:
|
|
52
|
+
NativeAdgeistCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
53
|
+
: TurboModule(std::string{NativeAdgeistCxxSpec::kModuleName}, jsInvoker),
|
|
54
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
class Delegate : public NativeAdgeistCxxSpecJSI {
|
|
59
|
+
public:
|
|
60
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
61
|
+
NativeAdgeistCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
jsi::Value initializeSdk(jsi::Runtime &rt, std::optional<jsi::String> customBidRequestBackendDomain, std::optional<jsi::String> customPackageOrBundleID, std::optional<jsi::String> customAdgeistAppID, std::optional<jsi::String> customVersioning) override {
|
|
66
|
+
static_assert(
|
|
67
|
+
bridging::getParameterCount(&T::initializeSdk) == 5,
|
|
68
|
+
"Expected initializeSdk(...) to have 5 parameters");
|
|
69
|
+
|
|
70
|
+
return bridging::callFromJs<jsi::Value>(
|
|
71
|
+
rt, &T::initializeSdk, jsInvoker_, instance_, std::move(customBidRequestBackendDomain), std::move(customPackageOrBundleID), std::move(customAdgeistAppID), std::move(customVersioning));
|
|
72
|
+
}
|
|
73
|
+
jsi::Value destroySdk(jsi::Runtime &rt) override {
|
|
74
|
+
static_assert(
|
|
75
|
+
bridging::getParameterCount(&T::destroySdk) == 1,
|
|
76
|
+
"Expected destroySdk(...) to have 1 parameters");
|
|
77
|
+
|
|
78
|
+
return bridging::callFromJs<jsi::Value>(
|
|
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));
|
|
88
|
+
}
|
|
89
|
+
void setUserDetails(jsi::Runtime &rt, jsi::Object user) override {
|
|
90
|
+
static_assert(
|
|
91
|
+
bridging::getParameterCount(&T::setUserDetails) == 2,
|
|
92
|
+
"Expected setUserDetails(...) to have 2 parameters");
|
|
93
|
+
|
|
94
|
+
return bridging::callFromJs<void>(
|
|
95
|
+
rt, &T::setUserDetails, jsInvoker_, instance_, std::move(user));
|
|
96
|
+
}
|
|
97
|
+
void logEvent(jsi::Runtime &rt, jsi::Object event) override {
|
|
98
|
+
static_assert(
|
|
99
|
+
bridging::getParameterCount(&T::logEvent) == 2,
|
|
100
|
+
"Expected logEvent(...) to have 2 parameters");
|
|
101
|
+
|
|
102
|
+
return bridging::callFromJs<void>(
|
|
103
|
+
rt, &T::logEvent, jsInvoker_, instance_, std::move(event));
|
|
104
|
+
}
|
|
105
|
+
jsi::Value getConsentStatus(jsi::Runtime &rt) override {
|
|
106
|
+
static_assert(
|
|
107
|
+
bridging::getParameterCount(&T::getConsentStatus) == 1,
|
|
108
|
+
"Expected getConsentStatus(...) to have 1 parameters");
|
|
109
|
+
|
|
110
|
+
return bridging::callFromJs<jsi::Value>(
|
|
111
|
+
rt, &T::getConsentStatus, jsInvoker_, instance_);
|
|
112
|
+
}
|
|
113
|
+
void updateConsentStatus(jsi::Runtime &rt, bool consent) override {
|
|
114
|
+
static_assert(
|
|
115
|
+
bridging::getParameterCount(&T::updateConsentStatus) == 2,
|
|
116
|
+
"Expected updateConsentStatus(...) to have 2 parameters");
|
|
117
|
+
|
|
118
|
+
return bridging::callFromJs<void>(
|
|
119
|
+
rt, &T::updateConsentStatus, jsInvoker_, instance_, std::move(consent));
|
|
120
|
+
}
|
|
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 {
|
|
122
|
+
static_assert(
|
|
123
|
+
bridging::getParameterCount(&T::trackImpression) == 8,
|
|
124
|
+
"Expected trackImpression(...) to have 8 parameters");
|
|
125
|
+
|
|
126
|
+
return bridging::callFromJs<jsi::Value>(
|
|
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));
|
|
128
|
+
}
|
|
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 {
|
|
130
|
+
static_assert(
|
|
131
|
+
bridging::getParameterCount(&T::trackView) == 11,
|
|
132
|
+
"Expected trackView(...) to have 11 parameters");
|
|
133
|
+
|
|
134
|
+
return bridging::callFromJs<jsi::Value>(
|
|
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));
|
|
136
|
+
}
|
|
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 {
|
|
138
|
+
static_assert(
|
|
139
|
+
bridging::getParameterCount(&T::trackTotalView) == 8,
|
|
140
|
+
"Expected trackTotalView(...) to have 8 parameters");
|
|
141
|
+
|
|
142
|
+
return bridging::callFromJs<jsi::Value>(
|
|
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));
|
|
144
|
+
}
|
|
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 {
|
|
146
|
+
static_assert(
|
|
147
|
+
bridging::getParameterCount(&T::trackClick) == 7,
|
|
148
|
+
"Expected trackClick(...) to have 7 parameters");
|
|
149
|
+
|
|
150
|
+
return bridging::callFromJs<jsi::Value>(
|
|
151
|
+
rt, &T::trackClick, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(bidId), std::move(bidMeta), std::move(buyType), std::move(isTestEnvironment));
|
|
152
|
+
}
|
|
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 {
|
|
154
|
+
static_assert(
|
|
155
|
+
bridging::getParameterCount(&T::trackVideoPlayback) == 8,
|
|
156
|
+
"Expected trackVideoPlayback(...) to have 8 parameters");
|
|
157
|
+
|
|
158
|
+
return bridging::callFromJs<jsi::Value>(
|
|
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
|
+
}
|
|
161
|
+
|
|
162
|
+
private:
|
|
163
|
+
friend class NativeAdgeistCxxSpec;
|
|
164
|
+
T *instance_;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
Delegate delegate_;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
} // namespace facebook::react
|
|
@@ -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 <react/renderer/components/RNAdgeistSpec/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 <react/renderer/components/RNAdgeistSpec/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/RNAdgeistSpec/Props.h>
|
|
15
|
+
#include <react/renderer/components/RNAdgeistSpec/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 <react/renderer/components/RNAdgeistSpec/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
|
package/android/build.gradle
CHANGED
|
@@ -104,7 +104,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
104
104
|
|
|
105
105
|
dependencies {
|
|
106
106
|
implementation "com.facebook.react:react-android"
|
|
107
|
-
implementation "ai.adgeist:adgeistkit:1.1.
|
|
107
|
+
implementation "ai.adgeist:adgeistkit:1.1.16-beta"
|
|
108
108
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -24,7 +24,9 @@ object HTML5AdViewManagerImpl {
|
|
|
24
24
|
const val EVENT_AD_CLICKED = "onAdClicked"
|
|
25
25
|
|
|
26
26
|
fun createViewInstance(reactContext: ThemedReactContext): AdView {
|
|
27
|
-
|
|
27
|
+
val adView = AdView(reactContext.applicationContext)
|
|
28
|
+
adView.setTag(com.facebook.react.R.id.view_tag_native_id, reactContext)
|
|
29
|
+
return adView
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
fun setAdUnitID(view: AdView, adUnitID: String?) {
|
|
@@ -117,9 +119,13 @@ object HTML5AdViewManagerImpl {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
private fun sendEvent(view: AdView, eventName: String, params: WritableMap) {
|
|
120
|
-
val reactContext = view.
|
|
121
|
-
reactContext
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
val reactContext = view.getTag(com.facebook.react.R.id.view_tag_native_id) as? ThemedReactContext
|
|
123
|
+
if (reactContext != null) {
|
|
124
|
+
reactContext
|
|
125
|
+
.getJSModule(RCTEventEmitter::class.java)
|
|
126
|
+
.receiveEvent(view.id, eventName, params)
|
|
127
|
+
} else {
|
|
128
|
+
Log.e(TAG, "Unable to send event $eventName: ThemedReactContext not found")
|
|
129
|
+
}
|
|
124
130
|
}
|
|
125
131
|
}
|
|
@@ -22,9 +22,9 @@ class AdgeistImpl internal constructor(private val context: ReactApplicationCont
|
|
|
22
22
|
private var getAd: FetchCreative? = null
|
|
23
23
|
private var postCreativeAnalytic: CreativeAnalytics? = null
|
|
24
24
|
|
|
25
|
-
fun initializeSdk(customBidRequestBackendDomain: String?, customPackageOrBundleID: String?, customAdgeistAppID: String?, promise: Promise) {
|
|
25
|
+
fun initializeSdk(customBidRequestBackendDomain: String?, customPackageOrBundleID: String?, customAdgeistAppID: String?, customVersioning: String?, promise: Promise) {
|
|
26
26
|
try {
|
|
27
|
-
adgeistInstance = AdgeistCore.initialize(context.applicationContext, customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID)
|
|
27
|
+
adgeistInstance = AdgeistCore.initialize(context.applicationContext, customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID, customVersioning)
|
|
28
28
|
getAd = adgeistInstance?.getCreative()
|
|
29
29
|
postCreativeAnalytic = adgeistInstance?.postCreativeAnalytics()
|
|
30
30
|
promise.resolve("SDK initialized with domain: ${customBidRequestBackendDomain ?: "default"}")
|
|
@@ -4,7 +4,6 @@ import com.facebook.react.bridge.Promise
|
|
|
4
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
import com.adgeist.modules.AdgeistImpl
|
|
6
6
|
import com.adgeistkit.ads.network.AnalyticsRequestDEPRECATED
|
|
7
|
-
|
|
8
7
|
import com.facebook.react.bridge.ReadableMap
|
|
9
8
|
|
|
10
9
|
class Adgeist internal constructor(reactContext: ReactApplicationContext) :
|
|
@@ -14,8 +13,8 @@ class Adgeist internal constructor(reactContext: ReactApplicationContext) :
|
|
|
14
13
|
|
|
15
14
|
override fun getName(): String = AdgeistImpl.NAME
|
|
16
15
|
|
|
17
|
-
override fun initializeSdk(customBidRequestBackendDomain: String
|
|
18
|
-
implementation.initializeSdk(customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID, promise)
|
|
16
|
+
override fun initializeSdk(customBidRequestBackendDomain: String?, customPackageOrBundleID: String?, customAdgeistAppID: String?, customVersioning: String? , promise: Promise) {
|
|
17
|
+
implementation.initializeSdk(customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID, customVersioning, promise)
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
override fun destroySdk(promise: Promise) {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
package com.adgeist.components
|
|
2
2
|
|
|
3
|
-
import android.content.res.Resources
|
|
4
3
|
import android.util.Log
|
|
5
|
-
import android.view.ViewGroup
|
|
6
4
|
import androidx.annotation.RequiresPermission
|
|
7
5
|
import com.adgeistkit.ads.AdView
|
|
8
|
-
import com.facebook.react.bridge.ReadableArray
|
|
9
6
|
import com.facebook.react.bridge.ReadableMap
|
|
10
7
|
import com.facebook.react.common.MapBuilder
|
|
11
8
|
import com.facebook.react.module.annotations.ReactModule
|
|
@@ -18,7 +15,7 @@ import com.facebook.react.viewmanagers.HTML5AdNativeComponentManagerInterface
|
|
|
18
15
|
|
|
19
16
|
@ReactModule(name = HTML5AdViewManagerImpl.NAME)
|
|
20
17
|
class HTML5AdViewManager : SimpleViewManager<AdView>(), HTML5AdNativeComponentManagerInterface<AdView> {
|
|
21
|
-
|
|
18
|
+
|
|
22
19
|
private val mDelegate: ViewManagerDelegate<AdView> = HTML5AdNativeComponentManagerDelegate(this)
|
|
23
20
|
|
|
24
21
|
override fun getDelegate(): ViewManagerDelegate<AdView> {
|
|
@@ -40,7 +37,7 @@ class HTML5AdViewManager : SimpleViewManager<AdView>(), HTML5AdNativeComponentMa
|
|
|
40
37
|
override fun setAdIsResponsive(view: AdView, adIsResponsive: Boolean) {
|
|
41
38
|
HTML5AdViewManagerImpl.setAdIsResponsive(view, adIsResponsive)
|
|
42
39
|
}
|
|
43
|
-
|
|
40
|
+
|
|
44
41
|
@ReactProp(name = "adSize")
|
|
45
42
|
override fun setAdSize(view: AdView, adSizeMap: ReadableMap?) {
|
|
46
43
|
HTML5AdViewManagerImpl.setAdSize(view, adSizeMap)
|
|
@@ -16,8 +16,8 @@ class Adgeist internal constructor(reactContext: ReactApplicationContext) :
|
|
|
16
16
|
override fun getName(): String = AdgeistImpl.NAME
|
|
17
17
|
|
|
18
18
|
@ReactMethod
|
|
19
|
-
fun initializeSdk(customBidRequestBackendDomain: String
|
|
20
|
-
implementation.initializeSdk(customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID, promise)
|
|
19
|
+
fun initializeSdk(customBidRequestBackendDomain: String?, customPackageOrBundleID: String?, customAdgeistAppID: String?, customVersioning: String?, promise: Promise) {
|
|
20
|
+
implementation.initializeSdk(customBidRequestBackendDomain, customPackageOrBundleID, customAdgeistAppID, customVersioning, promise)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@ReactMethod
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
package com.adgeist.components
|
|
2
2
|
|
|
3
|
+
import android.util.Log
|
|
3
4
|
import androidx.annotation.RequiresPermission
|
|
4
5
|
import com.adgeistkit.ads.AdView
|
|
5
6
|
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
import com.facebook.react.bridge.ReadableArray
|
|
6
8
|
import com.facebook.react.common.MapBuilder
|
|
7
9
|
import com.facebook.react.module.annotations.ReactModule
|
|
8
10
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
@@ -47,6 +49,32 @@ class HTML5AdViewManager : SimpleViewManager<AdView>() {
|
|
|
47
49
|
)
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
override fun getCommandsMap(): Map<String, Int> {
|
|
53
|
+
return MapBuilder.of(
|
|
54
|
+
"loadAd", COMMAND_LOAD_AD,
|
|
55
|
+
"destroy", COMMAND_DESTROY
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override fun receiveCommand(root: AdView, commandId: Int, args: ReadableArray?) {
|
|
60
|
+
try {
|
|
61
|
+
when (commandId) {
|
|
62
|
+
COMMAND_LOAD_AD -> {
|
|
63
|
+
val isTestMode = args?.getBoolean(0) ?: false
|
|
64
|
+
loadAd(root, isTestMode)
|
|
65
|
+
}
|
|
66
|
+
COMMAND_DESTROY -> {
|
|
67
|
+
destroy(root)
|
|
68
|
+
}
|
|
69
|
+
else -> {
|
|
70
|
+
Log.w("HTML5AdViewManager", "Unknown command received: $commandId")
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch (e: Exception) {
|
|
74
|
+
Log.e("HTML5AdViewManager", "Error in receiveCommand: ${e.message}", e)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
50
78
|
@RequiresPermission("android.permission.INTERNET")
|
|
51
79
|
fun loadAd(view: AdView, isTestMode: Boolean) {
|
|
52
80
|
HTML5AdViewManagerImpl.loadAd(view, isTestMode)
|
|
@@ -60,4 +88,9 @@ class HTML5AdViewManager : SimpleViewManager<AdView>() {
|
|
|
60
88
|
super.onDropViewInstance(view)
|
|
61
89
|
HTML5AdViewManagerImpl.destroyAd(view)
|
|
62
90
|
}
|
|
91
|
+
|
|
92
|
+
companion object {
|
|
93
|
+
private const val COMMAND_LOAD_AD = 1
|
|
94
|
+
private const val COMMAND_DESTROY = 2
|
|
95
|
+
}
|
|
63
96
|
}
|
package/ios/Adgeist.mm
CHANGED
|
@@ -23,12 +23,14 @@ RCT_EXPORT_MODULE(Adgeist)
|
|
|
23
23
|
RCT_EXPORT_METHOD(initializeSdk:(NSString *)customBidRequestBackendDomain
|
|
24
24
|
customPackageOrBundleID:(NSString *)customPackageOrBundleID
|
|
25
25
|
customAdgeistAppID:(NSString *)customAdgeistAppID
|
|
26
|
+
customVersioning:(NSString *)customVersioning
|
|
26
27
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
27
28
|
reject:(RCTPromiseRejectBlock)reject)
|
|
28
29
|
{
|
|
29
30
|
[adgeist initializeSdkWithCustomBidRequestBackendDomain:customBidRequestBackendDomain
|
|
30
31
|
customPackageOrBundleID:customPackageOrBundleID
|
|
31
32
|
customAdgeistAppID:customAdgeistAppID
|
|
33
|
+
customVersioning:customVersioning
|
|
32
34
|
resolver:resolve
|
|
33
35
|
rejecter:reject];
|
|
34
36
|
}
|
package/ios/AdgeistImpl.swift
CHANGED
|
@@ -11,13 +11,15 @@ import React
|
|
|
11
11
|
customBidRequestBackendDomain: String?,
|
|
12
12
|
customPackageOrBundleID: String?,
|
|
13
13
|
customAdgeistAppID: String?,
|
|
14
|
+
customVersioning: String?,
|
|
14
15
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
15
16
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
16
17
|
) {
|
|
17
18
|
do {
|
|
18
19
|
adgeistInstance = AdgeistCore.initialize(customBidRequestBackendDomain: customBidRequestBackendDomain,
|
|
19
20
|
customPackageOrBundleID: customPackageOrBundleID,
|
|
20
|
-
customAdgeistAppID: customAdgeistAppID
|
|
21
|
+
customAdgeistAppID: customAdgeistAppID,
|
|
22
|
+
customVersioning: customVersioning)
|
|
21
23
|
getAd = adgeistInstance?.getCreative()
|
|
22
24
|
postCreativeAnalytic = adgeistInstance?.postCreativeAnalytics()
|
|
23
25
|
resolver("SDK initialized with domain: \(customBidRequestBackendDomain ?? "default")")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useRef, useCallback, useImperativeHandle, forwardRef, useEffect, useState, useMemo } from 'react';
|
|
4
4
|
import { useAdgeistContext } from "../providers/AdgeistProvider.js";
|
|
5
|
-
import HTML5AdNativeComponent, {
|
|
5
|
+
import HTML5AdNativeComponent, { AdCommands } from '../specs/HTML5AdNativeComponent';
|
|
6
6
|
import { AdSizes } from "../constants.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
@@ -46,7 +46,7 @@ export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
|
46
46
|
isTestMode: request.isTestMode ?? isTestEnvironment
|
|
47
47
|
};
|
|
48
48
|
try {
|
|
49
|
-
|
|
49
|
+
AdCommands.loadAd(nativeRef.current, finalRequest.isTestMode);
|
|
50
50
|
} catch (error) {
|
|
51
51
|
if (__DEV__) {
|
|
52
52
|
console.warn('HTML5AdView: Error loading ad:', error);
|
|
@@ -91,7 +91,7 @@ export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
|
91
91
|
destroy: () => {
|
|
92
92
|
if (nativeRef.current) {
|
|
93
93
|
try {
|
|
94
|
-
|
|
94
|
+
AdCommands.destroy(nativeRef.current);
|
|
95
95
|
} catch (e) {
|
|
96
96
|
console.warn('Error destroying ad view:', e);
|
|
97
97
|
}
|