@thealteroffice/react-native-adgeist 0.0.5 → 0.0.6
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 +249 -40
- package/ios/AdgeistImpl.swift +14 -4
- package/package.json +1 -1
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAdgeistSpec.java +0 -42
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec-generated.cpp +0 -38
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +0 -45
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +0 -80
package/Adgeist.podspec
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
17
17
|
s.private_header_files = "ios/**/*.h"
|
|
18
18
|
|
|
19
|
-
s.dependency "AdgeistKit", '= 0.0.
|
|
19
|
+
s.dependency "AdgeistKit", '= 0.0.3'
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/README.md
CHANGED
|
@@ -4,72 +4,281 @@
|
|
|
4
4
|
|
|
5
5
|
# @thealteroffice/react-native-adgeist
|
|
6
6
|
|
|
7
|
-
A React Native
|
|
8
|
-
Written in Kotlin, Swift and Typescript. It supports both the Old and New React Native architecture.
|
|
7
|
+
A React Native SDK that enables publishers to seamlessly integrate their ad spaces with the AdGeist marketplace. Built with TypeScript, Kotlin, and Swift, supporting both Old and New React Native architectures with TurboModule support.
|
|
9
8
|
|
|
10
|
-
##
|
|
9
|
+
## 🚀 Features
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- ✅ **Cross-platform**: iOS and Android support
|
|
12
|
+
- ✅ **Modern Architecture**: Support for both legacy and new React Native architectures
|
|
13
|
+
- ✅ **TurboModule**: Enhanced performance with TurboModule implementation
|
|
14
|
+
- ✅ **TypeScript**: Full TypeScript support with type definitions
|
|
15
|
+
- ✅ **Expo Compatible**: Config plugin for seamless Expo integration
|
|
16
|
+
- ✅ **Analytics**: Built-in impression and click tracking
|
|
17
|
+
- ✅ **Customizable**: Flexible ad display options
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
## 📦 Installation
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
npm install @thealteroffice/react-native-adgeist
|
|
18
|
-
```
|
|
21
|
+
### React Native CLI
|
|
19
22
|
|
|
20
|
-
```
|
|
23
|
+
```bash
|
|
24
|
+
npm install @thealteroffice/react-native-adgeist
|
|
25
|
+
# or
|
|
21
26
|
yarn add @thealteroffice/react-native-adgeist
|
|
22
27
|
```
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
For iOS, run pod install:
|
|
30
|
+
```bash
|
|
31
|
+
cd ios && pod install
|
|
32
|
+
```
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
### Expo Managed Workflow
|
|
29
35
|
|
|
30
|
-
```
|
|
36
|
+
```bash
|
|
31
37
|
npx expo install @thealteroffice/react-native-adgeist
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
Rebuild your app:
|
|
41
|
+
```bash
|
|
42
|
+
npx expo prebuild --clean
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> **Note**: Requires Expo SDK 50+ and Kotlin template support.
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
## 🔧 Setup & Configuration
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
### Basic Setup
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
Wrap your app with `AdgeistProvider` to configure global settings:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import React from 'react';
|
|
55
|
+
import { AdgeistProvider, BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
56
|
+
|
|
57
|
+
export default function App() {
|
|
58
|
+
return (
|
|
59
|
+
<AdgeistProvider
|
|
60
|
+
publisherId="your-publisher-id"
|
|
61
|
+
apiKey="your-api-key"
|
|
62
|
+
domain="your-domain"
|
|
63
|
+
isTestEnvironment="your-environment"
|
|
64
|
+
>
|
|
65
|
+
<YourAppContent />
|
|
66
|
+
</AdgeistProvider>
|
|
67
|
+
);
|
|
45
68
|
}
|
|
46
69
|
```
|
|
47
70
|
|
|
48
|
-
|
|
71
|
+
### Environment Configuration
|
|
49
72
|
|
|
50
|
-
|
|
51
|
-
|
|
73
|
+
Set `isTestEnvironment` based on your app's environment:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
const isTestMode = __DEV__ || process.env.NODE_ENV === 'development';
|
|
77
|
+
|
|
78
|
+
<AdgeistProvider
|
|
79
|
+
publisherId="your-publisher-id"
|
|
80
|
+
apiKey="your-api-key"
|
|
81
|
+
domain="your-domain"
|
|
82
|
+
isTestEnvironment={isTestMode}
|
|
83
|
+
>
|
|
52
84
|
```
|
|
53
85
|
|
|
54
|
-
|
|
86
|
+
## 📱 Components
|
|
87
|
+
|
|
88
|
+
### AdgeistProvider
|
|
89
|
+
|
|
90
|
+
The root provider component that configures the SDK globally.
|
|
91
|
+
|
|
92
|
+
#### Props
|
|
55
93
|
|
|
56
|
-
|
|
94
|
+
| Prop | Type | Required | Default | Description |
|
|
95
|
+
|------|------|----------|---------|-------------|
|
|
96
|
+
| `children` | `React.ReactNode` | ✅ | - | Child components |
|
|
97
|
+
| `publisherId` | `string` | ✅ | - | Your publisher ID from AdGeist dashboard |
|
|
98
|
+
| `apiKey` | `string` | ✅ | - | Your API key from AdGeist dashboard |
|
|
99
|
+
| `domain` | `string` | ✅ | - | Your registered domain (e.g., "https://adgeist.ai") |
|
|
100
|
+
| `isTestEnvironment` | `boolean` | ✅ | - | Enable test mode for development |
|
|
57
101
|
|
|
58
|
-
|
|
102
|
+
#### Example
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<AdgeistProvider
|
|
106
|
+
publisherId="67f8ad1350ff1e0870da3f5b"
|
|
107
|
+
apiKey="7f6b3361bd6d804edfb40cecf3f42e5ebc0b11bd88d96c8a6d64188b93447ad9"
|
|
108
|
+
domain="https://adgeist.ai"
|
|
109
|
+
isTestEnvironment={false}
|
|
110
|
+
>
|
|
111
|
+
<App />
|
|
112
|
+
</AdgeistProvider>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### BannerAd
|
|
116
|
+
|
|
117
|
+
Display banner advertisements in your app.
|
|
118
|
+
|
|
119
|
+
#### Props
|
|
120
|
+
|
|
121
|
+
| Prop | Type | Required | Default | Description |
|
|
122
|
+
|------|------|----------|---------|-------------|
|
|
123
|
+
| `dataAdSlot` | `string` | ✅ | - | Ad slot ID from your AdGeist dashboard |
|
|
124
|
+
| `width` | `number` | ❌ | Device width | Width of the ad banner |
|
|
125
|
+
| `height` | `number` | ❌ | `300` | Height of the ad banner |
|
|
126
|
+
|
|
127
|
+
#### Example
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
59
130
|
import { BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
60
|
-
import { BottomBannerAd } from '@thealteroffice/react-native-adgeist';
|
|
61
131
|
|
|
62
|
-
|
|
132
|
+
function MyScreen() {
|
|
133
|
+
return (
|
|
134
|
+
<View>
|
|
135
|
+
<BannerAd
|
|
136
|
+
dataAdSlot="686149fac1fd09fff371e53c"
|
|
137
|
+
width={350}
|
|
138
|
+
height={250}
|
|
139
|
+
/>
|
|
140
|
+
</View>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 🔧 Native Module API
|
|
146
|
+
|
|
147
|
+
For advanced use cases, you can directly use the native module:
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import Adgeist from '@thealteroffice/react-native-adgeist/src/NativeAdgeist';
|
|
151
|
+
|
|
152
|
+
// Fetch creative data
|
|
153
|
+
const adData = await Adgeist.fetchCreative(
|
|
154
|
+
apiKey,
|
|
155
|
+
origin,
|
|
156
|
+
adSpaceId,
|
|
157
|
+
publisherId,
|
|
158
|
+
isTestEnvironment
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// Send analytics
|
|
162
|
+
await Adgeist.sendCreativeAnalytic(
|
|
163
|
+
campaignId,
|
|
164
|
+
adSpaceId,
|
|
165
|
+
publisherId,
|
|
166
|
+
eventType, // 'IMPRESSION' | 'CLICK'
|
|
167
|
+
origin,
|
|
168
|
+
apiKey,
|
|
169
|
+
bidId,
|
|
170
|
+
isTestEnvironment
|
|
171
|
+
);
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Native Module Methods
|
|
175
|
+
|
|
176
|
+
#### `fetchCreative`
|
|
177
|
+
|
|
178
|
+
Fetches ad creative data from the AdGeist API.
|
|
179
|
+
|
|
180
|
+
| Parameter | Type | Required | Description |
|
|
181
|
+
|-----------|------|----------|-------------|
|
|
182
|
+
| `apiKey` | `string` | ✅ | Your API key |
|
|
183
|
+
| `origin` | `string` | ✅ | App domain/origin |
|
|
184
|
+
| `adSpaceId` | `string` | ✅ | Ad space identifier |
|
|
185
|
+
| `publisherId` | `string` | ✅ | Publisher identifier |
|
|
186
|
+
| `isTestEnvironment` | `boolean` | ✅ | Test mode flag |
|
|
187
|
+
|
|
188
|
+
**Returns**: `Promise<AdData>`
|
|
189
|
+
|
|
190
|
+
#### `sendCreativeAnalytic`
|
|
191
|
+
|
|
192
|
+
Sends analytics data for ad interactions.
|
|
193
|
+
|
|
194
|
+
| Parameter | Type | Required | Description |
|
|
195
|
+
|-----------|------|----------|-------------|
|
|
196
|
+
| `campaignId` | `string` | ✅ | Campaign identifier |
|
|
197
|
+
| `adSpaceId` | `string` | ✅ | Ad space identifier |
|
|
198
|
+
| `publisherId` | `string` | ✅ | Publisher identifier |
|
|
199
|
+
| `eventType` | `string` | ✅ | Event type ('IMPRESSION' or 'CLICK') |
|
|
200
|
+
| `origin` | `string` | ✅ | App domain/origin |
|
|
201
|
+
| `apiKey` | `string` | ✅ | Your API key |
|
|
202
|
+
| `bidId` | `string` | ✅ | Bid identifier |
|
|
203
|
+
| `isTestEnvironment` | `boolean` | ✅ | Test mode flag |
|
|
204
|
+
|
|
205
|
+
**Returns**: `Promise<Object>`
|
|
206
|
+
|
|
207
|
+
## 📊 Data Types
|
|
208
|
+
|
|
209
|
+
### AdData Interface
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
interface AdData {
|
|
213
|
+
id: string;
|
|
214
|
+
bidId: string;
|
|
215
|
+
cur: string;
|
|
216
|
+
seatBid: SeatBid[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface SeatBid {
|
|
220
|
+
bidId: string;
|
|
221
|
+
bid: Bid[];
|
|
222
|
+
}
|
|
63
223
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
224
|
+
interface Bid {
|
|
225
|
+
id: string;
|
|
226
|
+
impId: string;
|
|
227
|
+
price: number;
|
|
228
|
+
ext: BidExtension;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface BidExtension {
|
|
232
|
+
creativeUrl: string;
|
|
233
|
+
ctaUrl: string;
|
|
234
|
+
creativeTitle: string;
|
|
235
|
+
creativeDescription: string;
|
|
236
|
+
creativeBrandName?: string;
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## 🎨 Customization
|
|
241
|
+
|
|
242
|
+
### Custom Ad Loader
|
|
243
|
+
|
|
244
|
+
Create your own ad loading component:
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
import React, { useState, useEffect } from 'react';
|
|
248
|
+
import { useAdgeistContext } from '@thealteroffice/react-native-adgeist';
|
|
249
|
+
import Adgeist from '@thealteroffice/react-native-adgeist/src/NativeAdgeist';
|
|
250
|
+
|
|
251
|
+
function CustomAdLoader({ adSlotId }) {
|
|
252
|
+
const [adData, setAdData] = useState(null);
|
|
253
|
+
const [loading, setLoading] = useState(true);
|
|
254
|
+
const { publisherId, apiKey, domain, isTestEnvironment } = useAdgeistContext();
|
|
255
|
+
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
loadAd();
|
|
258
|
+
}, []);
|
|
259
|
+
|
|
260
|
+
const loadAd = async () => {
|
|
261
|
+
try {
|
|
262
|
+
const response = await Adgeist.fetchCreative(
|
|
263
|
+
apiKey,
|
|
264
|
+
domain,
|
|
265
|
+
adSlotId,
|
|
266
|
+
publisherId,
|
|
267
|
+
isTestEnvironment
|
|
268
|
+
);
|
|
269
|
+
setAdData(response.data);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error('Failed to load ad:', error);
|
|
272
|
+
} finally {
|
|
273
|
+
setLoading(false);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
if (loading) return <LoadingSpinner />;
|
|
278
|
+
if (!adData) return null;
|
|
279
|
+
|
|
280
|
+
return <YourCustomAdDisplay data={adData} />;
|
|
281
|
+
}
|
|
282
|
+
```
|
|
70
283
|
|
|
71
|
-
<BottomBannerAd
|
|
72
|
-
dataPublisherId={PUBLISHER_ID}
|
|
73
|
-
dataAdSlot={ADSPACE_ID}
|
|
74
|
-
/>
|
|
75
284
|
```
|
package/ios/AdgeistImpl.swift
CHANGED
|
@@ -9,11 +9,17 @@ import React
|
|
|
9
9
|
origin: String,
|
|
10
10
|
adSpaceId: String,
|
|
11
11
|
publisherId: String,
|
|
12
|
-
isTestEnvironment:
|
|
12
|
+
isTestEnvironment: Bool,
|
|
13
13
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
14
14
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
15
15
|
) {
|
|
16
|
-
AdgeistImpl.adGeist.getCreative().fetchCreative(
|
|
16
|
+
AdgeistImpl.adGeist.getCreative().fetchCreative(
|
|
17
|
+
apiKey: apiKey,
|
|
18
|
+
origin: origin,
|
|
19
|
+
adSpaceId: adSpaceId,
|
|
20
|
+
companyId: publisherId,
|
|
21
|
+
isTestEnvironment: isTestEnvironment
|
|
22
|
+
) { creativeData in
|
|
17
23
|
if let creativeData = creativeData {
|
|
18
24
|
do {
|
|
19
25
|
let encoder = JSONEncoder()
|
|
@@ -40,7 +46,7 @@ import React
|
|
|
40
46
|
origin: String,
|
|
41
47
|
apiKey: String,
|
|
42
48
|
bidId: String,
|
|
43
|
-
isTestEnvironment:
|
|
49
|
+
isTestEnvironment: Bool,
|
|
44
50
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
45
51
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
46
52
|
) {
|
|
@@ -48,7 +54,11 @@ import React
|
|
|
48
54
|
campaignId: campaignId,
|
|
49
55
|
adSpaceId: adSpaceId,
|
|
50
56
|
publisherId: publisherId,
|
|
51
|
-
eventType: eventType
|
|
57
|
+
eventType: eventType,
|
|
58
|
+
origin: origin,
|
|
59
|
+
apiKey: apiKey,
|
|
60
|
+
bidId: bidId,
|
|
61
|
+
isTestEnvironment: isTestEnvironment
|
|
52
62
|
) { response in
|
|
53
63
|
if let response = response {
|
|
54
64
|
resolver(response)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thealteroffice/react-native-adgeist",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Publishers can integrate our SDK to connect their ad spaces to the AdGeist marketplace.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -1,42 +0,0 @@
|
|
|
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: GenerateModuleJavaSpec.js
|
|
9
|
-
*
|
|
10
|
-
* @nolint
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
package com.facebook.fbreact.specs;
|
|
14
|
-
|
|
15
|
-
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
-
import com.facebook.react.bridge.Promise;
|
|
17
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
-
import javax.annotation.Nonnull;
|
|
22
|
-
|
|
23
|
-
public abstract class NativeAdgeistSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
-
public static final String NAME = "Adgeist";
|
|
25
|
-
|
|
26
|
-
public NativeAdgeistSpec(ReactApplicationContext reactContext) {
|
|
27
|
-
super(reactContext);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public @Nonnull String getName() {
|
|
32
|
-
return NAME;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@ReactMethod
|
|
36
|
-
@DoNotStrip
|
|
37
|
-
public abstract void fetchCreative(String apiKey, String origin, String adSpaceId, String publisherId, boolean isTestEnvironment, Promise promise);
|
|
38
|
-
|
|
39
|
-
@ReactMethod
|
|
40
|
-
@DoNotStrip
|
|
41
|
-
public abstract void sendCreativeAnalytic(String campaignId, String adSpaceId, String publisherId, String eventType, String origin, String apiKey, String bidId, boolean isTestEnvironment, Promise promise);
|
|
42
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
#
|
|
3
|
-
# This source code is licensed under the MIT license found in the
|
|
4
|
-
# LICENSE file in the root directory of this source tree.
|
|
5
|
-
|
|
6
|
-
cmake_minimum_required(VERSION 3.13)
|
|
7
|
-
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
-
|
|
9
|
-
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNAdgeistSpec/*.cpp)
|
|
10
|
-
|
|
11
|
-
add_library(
|
|
12
|
-
react_codegen_RNAdgeistSpec
|
|
13
|
-
OBJECT
|
|
14
|
-
${react_codegen_SRCS}
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
target_include_directories(react_codegen_RNAdgeistSpec PUBLIC . react/renderer/components/RNAdgeistSpec)
|
|
18
|
-
|
|
19
|
-
target_link_libraries(
|
|
20
|
-
react_codegen_RNAdgeistSpec
|
|
21
|
-
fbjni
|
|
22
|
-
jsi
|
|
23
|
-
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
-
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
-
reactnative
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
target_compile_options(
|
|
29
|
-
react_codegen_RNAdgeistSpec
|
|
30
|
-
PRIVATE
|
|
31
|
-
-DLOG_TAG=\"ReactNative\"
|
|
32
|
-
-fexceptions
|
|
33
|
-
-frtti
|
|
34
|
-
-std=c++20
|
|
35
|
-
-Wall
|
|
36
|
-
)
|
|
@@ -1,38 +0,0 @@
|
|
|
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: GenerateModuleJniCpp.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include "RNAdgeistSpec.h"
|
|
12
|
-
|
|
13
|
-
namespace facebook::react {
|
|
14
|
-
|
|
15
|
-
static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_fetchCreative(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
-
static jmethodID cachedMethodId = nullptr;
|
|
17
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "fetchCreative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
-
static jmethodID cachedMethodId = nullptr;
|
|
22
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "sendCreativeAnalytic", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
NativeAdgeistSpecJSI::NativeAdgeistSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
26
|
-
: JavaTurboModule(params) {
|
|
27
|
-
methodMap_["fetchCreative"] = MethodMetadata {5, __hostFunction_NativeAdgeistSpecJSI_fetchCreative};
|
|
28
|
-
methodMap_["sendCreativeAnalytic"] = MethodMetadata {8, __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
std::shared_ptr<TurboModule> RNAdgeistSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
32
|
-
if (moduleName == "Adgeist") {
|
|
33
|
-
return std::make_shared<NativeAdgeistSpecJSI>(params);
|
|
34
|
-
}
|
|
35
|
-
return nullptr;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
} // namespace facebook::react
|
|
@@ -1,31 +0,0 @@
|
|
|
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: GenerateModuleJniH.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#pragma once
|
|
12
|
-
|
|
13
|
-
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
-
#include <ReactCommon/TurboModule.h>
|
|
15
|
-
#include <jsi/jsi.h>
|
|
16
|
-
|
|
17
|
-
namespace facebook::react {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* JNI C++ class for module 'NativeAdgeist'
|
|
21
|
-
*/
|
|
22
|
-
class JSI_EXPORT NativeAdgeistSpecJSI : public JavaTurboModule {
|
|
23
|
-
public:
|
|
24
|
-
NativeAdgeistSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSI_EXPORT
|
|
29
|
-
std::shared_ptr<TurboModule> RNAdgeistSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
-
|
|
31
|
-
} // namespace facebook::react
|
|
@@ -1,45 +0,0 @@
|
|
|
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_fetchCreative(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
-
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->fetchCreative(
|
|
16
|
-
rt,
|
|
17
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
18
|
-
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
19
|
-
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
20
|
-
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
21
|
-
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asBool()
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
25
|
-
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->sendCreativeAnalytic(
|
|
26
|
-
rt,
|
|
27
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
28
|
-
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
29
|
-
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
30
|
-
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
|
|
31
|
-
count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
|
|
32
|
-
count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asString(rt),
|
|
33
|
-
count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asString(rt),
|
|
34
|
-
count <= 7 ? throw jsi::JSError(rt, "Expected argument in position 7 to be passed") : args[7].asBool()
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
NativeAdgeistCxxSpecJSI::NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
39
|
-
: TurboModule("Adgeist", jsInvoker) {
|
|
40
|
-
methodMap_["fetchCreative"] = MethodMetadata {5, __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative};
|
|
41
|
-
methodMap_["sendCreativeAnalytic"] = MethodMetadata {8, __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} // namespace facebook::react
|
|
@@ -1,80 +0,0 @@
|
|
|
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 fetchCreative(jsi::Runtime &rt, jsi::String apiKey, jsi::String origin, jsi::String adSpaceId, jsi::String publisherId, bool isTestEnvironment) = 0;
|
|
24
|
-
virtual jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType, jsi::String origin, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment) = 0;
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
template <typename T>
|
|
29
|
-
class JSI_EXPORT NativeAdgeistCxxSpec : public TurboModule {
|
|
30
|
-
public:
|
|
31
|
-
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
32
|
-
return delegate_.create(rt, propName);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
36
|
-
return delegate_.getPropertyNames(runtime);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static constexpr std::string_view kModuleName = "Adgeist";
|
|
40
|
-
|
|
41
|
-
protected:
|
|
42
|
-
NativeAdgeistCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
43
|
-
: TurboModule(std::string{NativeAdgeistCxxSpec::kModuleName}, jsInvoker),
|
|
44
|
-
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
private:
|
|
48
|
-
class Delegate : public NativeAdgeistCxxSpecJSI {
|
|
49
|
-
public:
|
|
50
|
-
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
51
|
-
NativeAdgeistCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String apiKey, jsi::String origin, jsi::String adSpaceId, jsi::String publisherId, bool isTestEnvironment) override {
|
|
56
|
-
static_assert(
|
|
57
|
-
bridging::getParameterCount(&T::fetchCreative) == 6,
|
|
58
|
-
"Expected fetchCreative(...) to have 6 parameters");
|
|
59
|
-
|
|
60
|
-
return bridging::callFromJs<jsi::Value>(
|
|
61
|
-
rt, &T::fetchCreative, jsInvoker_, instance_, std::move(apiKey), std::move(origin), std::move(adSpaceId), std::move(publisherId), std::move(isTestEnvironment));
|
|
62
|
-
}
|
|
63
|
-
jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType, jsi::String origin, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment) override {
|
|
64
|
-
static_assert(
|
|
65
|
-
bridging::getParameterCount(&T::sendCreativeAnalytic) == 9,
|
|
66
|
-
"Expected sendCreativeAnalytic(...) to have 9 parameters");
|
|
67
|
-
|
|
68
|
-
return bridging::callFromJs<jsi::Value>(
|
|
69
|
-
rt, &T::sendCreativeAnalytic, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(publisherId), std::move(eventType), std::move(origin), std::move(apiKey), std::move(bidId), std::move(isTestEnvironment));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private:
|
|
73
|
-
friend class NativeAdgeistCxxSpec;
|
|
74
|
-
T *instance_;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Delegate delegate_;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
} // namespace facebook::react
|