@thealteroffice/react-native-adgeist 0.0.1 → 0.0.2
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 +6 -5
- package/README.md +12 -2
- package/android/build.gradle +21 -8
- package/android/src/main/java/com/adgeist/AdgeistPackage.kt +5 -4
- package/android/src/main/java/com/adgeist/{AdgeistModule.kt → implementation/AdgeistModuleImpl.kt} +8 -18
- package/android/src/newarch/java/com/AdgeistModule.kt +22 -0
- package/android/src/oldarch/java/com/AdgeistModule.kt +26 -0
- package/app.plugin.js +1 -0
- package/ios/Adgeist.h +1 -3
- package/ios/Adgeist.mm +24 -19
- package/ios/adgeist-Bridging-Header.h +1 -2
- package/lib/typescript/plugin/src/android/withRNAdgeistMainApplication.d.ts +4 -0
- package/lib/typescript/plugin/src/android/withRNAdgeistMainApplication.d.ts.map +1 -0
- package/lib/typescript/plugin/src/index.d.ts +4 -0
- package/lib/typescript/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/plugin/src/ios/withRNAdgeistAppDelegate.d.ts +5 -0
- package/lib/typescript/plugin/src/ios/withRNAdgeistAppDelegate.d.ts.map +1 -0
- package/package.json +18 -17
- 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/plugin/tsconfig.json +9 -0
- package/react-native.config.js +1 -1
- package/android/generated/java/com/adgeist/NativeAdgeistSpec.java +0 -42
- package/android/generated/jni/CMakeLists.txt +0 -36
- package/android/generated/jni/RNAdgeistSpec-generated.cpp +0 -38
- package/android/generated/jni/RNAdgeistSpec.h +0 -31
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +0 -38
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +0 -80
- package/ios/generated/RNAdgeistSpec/RNAdgeistSpec-generated.mm +0 -46
- package/ios/generated/RNAdgeistSpec/RNAdgeistSpec.h +0 -71
- package/ios/generated/RNAdgeistSpecJSI-generated.cpp +0 -38
- package/ios/generated/RNAdgeistSpecJSI.h +0 -80
package/Adgeist.podspec
CHANGED
|
@@ -18,11 +18,12 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
|
|
19
19
|
s.dependency "AdgeistKit", '= 0.0.1'
|
|
20
20
|
|
|
21
|
-
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
|
-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
23
|
-
if respond_to?(:install_modules_dependencies, true)
|
|
24
|
-
|
|
25
|
-
else
|
|
21
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
23
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
24
|
+
install_modules_dependencies(s)
|
|
25
|
+
else
|
|
26
26
|
s.dependency "React-Core"
|
|
27
|
+
|
|
27
28
|
end
|
|
28
29
|
end
|
package/README.md
CHANGED
|
@@ -45,7 +45,11 @@ Simply add the library plugin to your `app.json` file:
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
This way, Expo will handle the native setup for you during `prebuild`.
|
|
48
|
+
This way, Expo will handle the native setup for you during `prebuild`. You can prebuild using
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npx expo prebuild --clean
|
|
52
|
+
```
|
|
49
53
|
|
|
50
54
|
> Note: only SDK 50 and above are supported, the plugin is configured to handle only the kotlin template.
|
|
51
55
|
|
|
@@ -53,6 +57,7 @@ This way, Expo will handle the native setup for you during `prebuild`.
|
|
|
53
57
|
|
|
54
58
|
```js
|
|
55
59
|
import { BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
60
|
+
import { BottomBannerAd } from '@thealteroffice/react-native-adgeist';
|
|
56
61
|
|
|
57
62
|
// ...
|
|
58
63
|
|
|
@@ -61,5 +66,10 @@ import { BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
|
61
66
|
dataAdSlot={ADSPACE_ID}
|
|
62
67
|
width={400}
|
|
63
68
|
height={300}
|
|
64
|
-
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<BottomBannerAd
|
|
72
|
+
dataPublisherId={PUBLISHER_ID}
|
|
73
|
+
dataAdSlot={ADSPACE_ID}
|
|
74
|
+
/>
|
|
65
75
|
```
|
package/android/build.gradle
CHANGED
|
@@ -15,6 +15,9 @@ buildscript {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
def isNewArchitectureEnabled() {
|
|
19
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
apply plugin: "com.android.library"
|
|
20
23
|
apply plugin: "kotlin-android"
|
|
@@ -50,6 +53,7 @@ android {
|
|
|
50
53
|
defaultConfig {
|
|
51
54
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
52
55
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
56
|
+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
buildFeatures {
|
|
@@ -73,10 +77,17 @@ android {
|
|
|
73
77
|
|
|
74
78
|
sourceSets {
|
|
75
79
|
main {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
if(isNewArchitectureEnabled()){
|
|
81
|
+
java.srcDirs += [
|
|
82
|
+
"src/newarch",
|
|
83
|
+
|
|
84
|
+
// This is needed to build Kotlin project with NewArch enabled
|
|
85
|
+
"${project.buildDir}/generated/source/codegen/java",
|
|
86
|
+
"${project.buildDir}/generated/source/codegen/jni"
|
|
87
|
+
]
|
|
88
|
+
}else{
|
|
89
|
+
java.srcDirs += ["src/oldarch"]
|
|
90
|
+
}
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
}
|
|
@@ -94,8 +105,10 @@ dependencies {
|
|
|
94
105
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
if (isNewArchitectureEnabled()) {
|
|
109
|
+
react {
|
|
110
|
+
jsRootDir = file("../src/")
|
|
111
|
+
libraryName = "Adgeist"
|
|
112
|
+
codegenJavaPackageName = "com.adgeist"
|
|
113
|
+
}
|
|
101
114
|
}
|
|
@@ -5,11 +5,12 @@ import com.facebook.react.bridge.NativeModule
|
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
7
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import com.adgeist.implementation.AdgeistModuleImpl
|
|
8
9
|
import java.util.HashMap
|
|
9
10
|
|
|
10
11
|
class AdgeistPackage : BaseReactPackage() {
|
|
11
12
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
-
return if (name ==
|
|
13
|
+
return if (name == AdgeistModuleImpl.NAME) {
|
|
13
14
|
AdgeistModule(reactContext)
|
|
14
15
|
} else {
|
|
15
16
|
null
|
|
@@ -19,9 +20,9 @@ class AdgeistPackage : BaseReactPackage() {
|
|
|
19
20
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
20
21
|
return ReactModuleInfoProvider {
|
|
21
22
|
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
22
|
-
moduleInfos[
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
moduleInfos[AdgeistModuleImpl.NAME] = ReactModuleInfo(
|
|
24
|
+
AdgeistModuleImpl.NAME,
|
|
25
|
+
AdgeistModuleImpl.NAME,
|
|
25
26
|
false, // canOverrideExistingModule
|
|
26
27
|
false, // needsEagerInit
|
|
27
28
|
false, // isCxxModule
|
package/android/src/main/java/com/adgeist/{AdgeistModule.kt → implementation/AdgeistModuleImpl.kt}
RENAMED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
package com.adgeist
|
|
1
|
+
package com.adgeist.implementation
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
-
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule
|
|
6
3
|
import com.facebook.react.bridge.Promise
|
|
7
|
-
import
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
5
|
import com.facebook.react.bridge.Arguments
|
|
9
6
|
import com.facebook.react.bridge.WritableMap
|
|
10
7
|
import com.adgeistkit.AdgeistCore
|
|
@@ -13,20 +10,13 @@ import com.adgeistkit.Campaign
|
|
|
13
10
|
import com.adgeistkit.Creative
|
|
14
11
|
import com.adgeistkit.BudgetSettings
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
class AdgeistModule(reactContext: ReactApplicationContext) :
|
|
18
|
-
NativeAdgeistSpec(reactContext), TurboModule {
|
|
13
|
+
class AdgeistModuleImpl internal constructor(private val context: ReactApplicationContext) {
|
|
19
14
|
|
|
20
|
-
private val adgeistInstanceFromLibrary = AdgeistCore.initialize(
|
|
15
|
+
private val adgeistInstanceFromLibrary = AdgeistCore.initialize(context.applicationContext)
|
|
21
16
|
private val getAd = adgeistInstanceFromLibrary.getCreative()
|
|
22
17
|
private val postCreativeAnalytic = adgeistInstanceFromLibrary.postCreativeAnalytics()
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
override fun getName(): String {
|
|
26
|
-
return NAME
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
override fun fetchCreative(adSpaceId: String, publisherId: String, promise: Promise) {
|
|
19
|
+
fun fetchCreative(adSpaceId: String, publisherId: String, promise: Promise) {
|
|
30
20
|
getAd.fetchCreative(adSpaceId, publisherId) { adData ->
|
|
31
21
|
if (adData != null) {
|
|
32
22
|
promise.resolve(adData.toWritableMap())
|
|
@@ -36,10 +26,9 @@ class AdgeistModule(reactContext: ReactApplicationContext) :
|
|
|
36
26
|
}
|
|
37
27
|
}
|
|
38
28
|
|
|
39
|
-
|
|
29
|
+
fun sendCreativeAnalytic(campaignId: String, adSpaceId: String, publisherId: String, eventType: String, promise: Promise) {
|
|
40
30
|
postCreativeAnalytic.sendTrackingData(campaignId, adSpaceId, publisherId, eventType) { adData ->
|
|
41
31
|
if (adData != null) {
|
|
42
|
-
Log.d("MyActivity of app module", adData)
|
|
43
32
|
promise.resolve(adData)
|
|
44
33
|
} else {
|
|
45
34
|
promise.reject("NO_AD", "Couldn't find the campaign to update analytics")
|
|
@@ -49,6 +38,7 @@ class AdgeistModule(reactContext: ReactApplicationContext) :
|
|
|
49
38
|
|
|
50
39
|
companion object {
|
|
51
40
|
const val NAME = "Adgeist"
|
|
41
|
+
|
|
52
42
|
}
|
|
53
43
|
}
|
|
54
44
|
|
|
@@ -86,4 +76,4 @@ fun CreativeDataModel.toWritableMap(): WritableMap {
|
|
|
86
76
|
|
|
87
77
|
map.putMap("data", dataMap)
|
|
88
78
|
return map
|
|
89
|
-
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.adgeist
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.adgeist.implementation.AdgeistModuleImpl
|
|
6
|
+
|
|
7
|
+
class AdgeistModule internal constructor(reactContext: ReactApplicationContext) :
|
|
8
|
+
NativeAdgeistSpec(reactContext) {
|
|
9
|
+
|
|
10
|
+
private var implementation: AdgeistModuleImpl = AdgeistModuleImpl(reactContext)
|
|
11
|
+
|
|
12
|
+
override fun getName(): String = AdgeistModuleImpl.NAME
|
|
13
|
+
|
|
14
|
+
override fun fetchCreative(adSpaceId: String, publisherId: String, promise: Promise) {
|
|
15
|
+
implementation.fetchCreative(adSpaceId, publisherId, promise)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override fun sendCreativeAnalytic(campaignId: String, adSpaceId: String, publisherId: String, eventType: String, promise: Promise) {
|
|
19
|
+
implementation.sendCreativeAnalytic(campaignId, adSpaceId, publisherId, eventType, promise)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.adgeist
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.adgeist.implementation.AdgeistModuleImpl
|
|
8
|
+
|
|
9
|
+
class AdgeistModule internal constructor(reactContext: ReactApplicationContext) :
|
|
10
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
11
|
+
|
|
12
|
+
private var implementation: AdgeistModuleImpl = AdgeistModuleImpl(reactContext)
|
|
13
|
+
|
|
14
|
+
override fun getName(): String = AdgeistModuleImpl.NAME
|
|
15
|
+
|
|
16
|
+
@ReactMethod
|
|
17
|
+
fun fetchCreative(adSpaceId: String, publisherId: String, promise: Promise) {
|
|
18
|
+
implementation.fetchCreative(adSpaceId, publisherId, promise)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@ReactMethod
|
|
22
|
+
fun sendCreativeAnalytic(campaignId: String, adSpaceId: String, publisherId: String, eventType: String, promise: Promise) {
|
|
23
|
+
implementation.sendCreativeAnalytic(campaignId, adSpaceId, publisherId, eventType, promise)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build');
|
package/ios/Adgeist.h
CHANGED
package/ios/Adgeist.mm
CHANGED
|
@@ -10,43 +10,48 @@
|
|
|
10
10
|
AdgeistImpl *adgeist;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Export the module for both old and new architectures
|
|
14
|
+
RCT_EXPORT_MODULE(Adgeist)
|
|
15
|
+
|
|
16
|
+
- (instancetype)init {
|
|
14
17
|
if (self = [super init]) {
|
|
15
18
|
adgeist = [AdgeistImpl new];
|
|
16
19
|
}
|
|
17
20
|
return self;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
+ (NSString *)moduleName {
|
|
21
|
-
return @"Adgeist";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
// Exported methods for JS
|
|
25
|
+
RCT_EXPORT_METHOD(fetchCreative:(NSString *)adSpaceId
|
|
26
|
+
publisherId:(NSString *)publisherId
|
|
27
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
28
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
29
|
+
{
|
|
30
|
+
[adgeist fetchCreativeWithAdSpaceId:adSpaceId publisherId:publisherId resolver:resolve rejecter:reject];
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
RCT_EXPORT_METHOD(sendCreativeAnalytic:(NSString *)campaignId
|
|
33
34
|
adSpaceId:(NSString *)adSpaceId
|
|
34
35
|
publisherId:(NSString *)publisherId
|
|
35
36
|
eventType:(NSString *)eventType
|
|
36
37
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
37
|
-
reject:(RCTPromiseRejectBlock)reject
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
39
|
+
{
|
|
40
|
+
[adgeist sendCreativeAnalyticWithCampaignId:campaignId
|
|
41
|
+
adSpaceId:adSpaceId
|
|
42
|
+
publisherId:publisherId
|
|
43
|
+
eventType:eventType
|
|
44
|
+
resolver:resolve
|
|
45
|
+
rejecter:reject];
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
// TurboModule support for the new architecture
|
|
49
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
46
50
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
47
51
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
48
52
|
{
|
|
49
53
|
return std::make_shared<facebook::react::NativeAdgeistSpecJSI>(params);
|
|
50
54
|
}
|
|
55
|
+
#endif
|
|
51
56
|
|
|
52
|
-
@end
|
|
57
|
+
@end
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
#import "React/RCTBridgeModule.h"
|
|
2
|
-
#import "React/RCTEventEmitter.h"
|
|
1
|
+
#import "React/RCTBridgeModule.h"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRNAdgeistMainApplication.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withRNAdgeistMainApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAO9B,eAAO,MAAM,4BAA4B,EAAE,YAK1C,CAAC;AA2CF,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAqC9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;;AA0B9B,wBAAyE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
export declare const withRNAdgeistAppDelegate: ConfigPlugin;
|
|
3
|
+
export declare function swiftFileUpdater(originalContents: string): string;
|
|
4
|
+
export declare function objCFileUpdater(originalContents: string): string;
|
|
5
|
+
//# sourceMappingURL=withRNAdgeistAppDelegate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRNAdgeistAppDelegate.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/ios/withRNAdgeistAppDelegate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAI9B,eAAO,MAAM,wBAAwB,EAAE,YAEtC,CAAC;AA8BF,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAiBjE;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CA0BhE"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thealteroffice/react-native-adgeist",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Publishers can integrate our SDK to connect their ad spaces to the AdGeist marketplace.",
|
|
5
|
-
"source": "./src/index.tsx",
|
|
6
5
|
"main": "./lib/module/index.js",
|
|
6
|
+
"module": "./lib/module/index.js",
|
|
7
7
|
"types": "./lib/typescript/src/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
-
"default": "./lib/module/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./package.json": "./package.json"
|
|
14
|
-
},
|
|
15
8
|
"files": [
|
|
16
9
|
"src",
|
|
17
10
|
"lib",
|
|
18
11
|
"android",
|
|
19
12
|
"ios",
|
|
20
13
|
"cpp",
|
|
14
|
+
"plugin/build",
|
|
15
|
+
"plugin/tsconfig.json",
|
|
16
|
+
"app.plugin.js",
|
|
21
17
|
"*.podspec",
|
|
22
18
|
"react-native.config.js",
|
|
23
19
|
"!ios/build",
|
|
@@ -33,6 +29,7 @@
|
|
|
33
29
|
],
|
|
34
30
|
"scripts": {
|
|
35
31
|
"example": "yarn workspace react-native-adgeist-example",
|
|
32
|
+
"expo-plugin": "yarn workspace react-native-adgeist-expo-plugin",
|
|
36
33
|
"test": "jest",
|
|
37
34
|
"typecheck": "tsc",
|
|
38
35
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
@@ -70,11 +67,14 @@
|
|
|
70
67
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
71
68
|
"@types/jest": "^29.5.5",
|
|
72
69
|
"@types/react": "^19.0.0",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
|
73
71
|
"commitlint": "^19.6.1",
|
|
74
72
|
"del-cli": "^5.1.0",
|
|
75
73
|
"eslint": "^9.22.0",
|
|
76
74
|
"eslint-config-prettier": "^10.1.1",
|
|
75
|
+
"eslint-plugin-jest": "latest",
|
|
77
76
|
"eslint-plugin-prettier": "^5.2.3",
|
|
77
|
+
"expo": "^52.0.35",
|
|
78
78
|
"jest": "^29.7.0",
|
|
79
79
|
"prettier": "^3.0.3",
|
|
80
80
|
"react": "19.0.0",
|
|
@@ -85,11 +85,18 @@
|
|
|
85
85
|
"typescript": "^5.2.2"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
+
"expo": ">=47.0.0",
|
|
88
89
|
"react": "*",
|
|
89
90
|
"react-native": "*"
|
|
90
91
|
},
|
|
92
|
+
"peerDependenciesMeta": {
|
|
93
|
+
"expo": {
|
|
94
|
+
"optional": true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
91
97
|
"workspaces": [
|
|
92
|
-
"example"
|
|
98
|
+
"example",
|
|
99
|
+
"plugin"
|
|
93
100
|
],
|
|
94
101
|
"packageManager": "yarn@3.6.1",
|
|
95
102
|
"jest": {
|
|
@@ -134,7 +141,6 @@
|
|
|
134
141
|
"source": "src",
|
|
135
142
|
"output": "lib",
|
|
136
143
|
"targets": [
|
|
137
|
-
"codegen",
|
|
138
144
|
[
|
|
139
145
|
"module",
|
|
140
146
|
{
|
|
@@ -153,14 +159,9 @@
|
|
|
153
159
|
"name": "RNAdgeistSpec",
|
|
154
160
|
"type": "modules",
|
|
155
161
|
"jsSrcsDir": "src",
|
|
156
|
-
"outputDir": {
|
|
157
|
-
"ios": "ios/generated",
|
|
158
|
-
"android": "android/generated"
|
|
159
|
-
},
|
|
160
162
|
"android": {
|
|
161
163
|
"javaPackageName": "com.adgeist"
|
|
162
|
-
}
|
|
163
|
-
"includesGeneratedCode": true
|
|
164
|
+
}
|
|
164
165
|
},
|
|
165
166
|
"create-react-native-library": {
|
|
166
167
|
"type": "turbo-module",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRNAdgeistMainApplication = void 0;
|
|
4
|
+
exports.ktFileUpdater = ktFileUpdater;
|
|
5
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
7
|
+
const withRNAdgeistMainApplication = (config) => {
|
|
8
|
+
return (0, config_plugins_1.withAppBuildGradle)((0, config_plugins_1.withMainApplication)(config, readMainApplicationFileAndUpdateContents), readBuildGradleFileAndUpdateContents);
|
|
9
|
+
};
|
|
10
|
+
exports.withRNAdgeistMainApplication = withRNAdgeistMainApplication;
|
|
11
|
+
// 1. MainActivity Modifications
|
|
12
|
+
async function readMainApplicationFileAndUpdateContents(config) {
|
|
13
|
+
const { modResults: mainApplicationFile } = config;
|
|
14
|
+
const worker = getCompatibleFileUpdater(mainApplicationFile.language);
|
|
15
|
+
mainApplicationFile.contents = worker(mainApplicationFile.contents);
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
18
|
+
function readBuildGradleFileAndUpdateContents(config) {
|
|
19
|
+
const { modResults } = config;
|
|
20
|
+
if (!modResults.contents.includes('implementation "ai.adgeist:adgeistkit:')) {
|
|
21
|
+
modResults.contents = modResults.contents.replace(/dependencies\s*{/, `dependencies {
|
|
22
|
+
implementation "ai.adgeist:adgeistkit:0.0.1" // AdgeistKit Dependency`);
|
|
23
|
+
}
|
|
24
|
+
return config;
|
|
25
|
+
}
|
|
26
|
+
function getCompatibleFileUpdater(language) {
|
|
27
|
+
switch (language) {
|
|
28
|
+
case 'kt':
|
|
29
|
+
return ktFileUpdater;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Cannot add React Native Orientation Director code to MainActivity of language "${language}"`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function ktFileUpdater(originalContents) {
|
|
35
|
+
// Safer anchor detection
|
|
36
|
+
const anchors = [
|
|
37
|
+
/super\.onCreate\(/,
|
|
38
|
+
/@Override\s+fun onCreate\(/,
|
|
39
|
+
/class \w+ : ReactActivity/,
|
|
40
|
+
].find((anchor) => anchor.test(originalContents));
|
|
41
|
+
if (!anchors) {
|
|
42
|
+
throw new Error('Could not find suitable insertion point in MainActivity');
|
|
43
|
+
}
|
|
44
|
+
const packageImportCodeBlock = 'import com.adgeist.AdgeistPackage';
|
|
45
|
+
const rightBeforeClassDeclaration = /import com.facebook.react.ReactPackage/;
|
|
46
|
+
const importMergeResults = (0, generateCode_1.mergeContents)({
|
|
47
|
+
tag: '@react-native-adgeist/package-import',
|
|
48
|
+
src: originalContents,
|
|
49
|
+
newSrc: packageImportCodeBlock,
|
|
50
|
+
anchor: rightBeforeClassDeclaration,
|
|
51
|
+
offset: 0,
|
|
52
|
+
comment: '// React Native Adgeist',
|
|
53
|
+
});
|
|
54
|
+
const onConfigurationChangedCodeBlock = `packages.add(AdgeistPackage())`;
|
|
55
|
+
const rightBeforeOnReturnStatement = /return packages/;
|
|
56
|
+
const implementationMergeResults = (0, generateCode_1.mergeContents)({
|
|
57
|
+
tag: '@react-native-adgeist/package-initialization',
|
|
58
|
+
src: importMergeResults.contents,
|
|
59
|
+
newSrc: onConfigurationChangedCodeBlock,
|
|
60
|
+
anchor: rightBeforeOnReturnStatement,
|
|
61
|
+
offset: 0,
|
|
62
|
+
comment: '// Package Initialization',
|
|
63
|
+
});
|
|
64
|
+
return implementationMergeResults.contents;
|
|
65
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const withRNAdgeistMainApplication_1 = require("./android/withRNAdgeistMainApplication");
|
|
5
|
+
const withRNAdgeistAppDelegate_1 = require("./ios/withRNAdgeistAppDelegate");
|
|
6
|
+
/**
|
|
7
|
+
* So, expo config plugin are awesome and the documentation is well written, but I still needed to look around to see
|
|
8
|
+
* how other projects actually modify the AppDelegate. I've found react-native-firebase to implement a plugin config
|
|
9
|
+
* that changes the AppDelegate, so I'll leave their link as reference:
|
|
10
|
+
* https://github.com/invertase/react-native-firebase/blob/main/packages/app/plugin/src/ios/appDelegate.ts
|
|
11
|
+
*
|
|
12
|
+
* Kudos to them, because this stuff is hard!
|
|
13
|
+
*
|
|
14
|
+
* @param config
|
|
15
|
+
*/
|
|
16
|
+
const withRNAdgeist = (config) => {
|
|
17
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
18
|
+
//Android
|
|
19
|
+
withRNAdgeistMainApplication_1.withRNAdgeistMainApplication,
|
|
20
|
+
//iOS
|
|
21
|
+
withRNAdgeistAppDelegate_1.withRNAdgeistAppDelegate,
|
|
22
|
+
]);
|
|
23
|
+
};
|
|
24
|
+
const pak = require('react-native-adgeist/package.json');
|
|
25
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withRNAdgeist, pak.name, pak.version);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
export declare const withRNAdgeistAppDelegate: ConfigPlugin;
|
|
3
|
+
export declare function swiftFileUpdater(originalContents: string): string;
|
|
4
|
+
export declare function objCFileUpdater(originalContents: string): string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withRNAdgeistAppDelegate = void 0;
|
|
4
|
+
exports.swiftFileUpdater = swiftFileUpdater;
|
|
5
|
+
exports.objCFileUpdater = objCFileUpdater;
|
|
6
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
8
|
+
const withRNAdgeistAppDelegate = (config) => {
|
|
9
|
+
return (0, config_plugins_1.withAppDelegate)(config, readAppDelegateFileAndUpdateContents);
|
|
10
|
+
};
|
|
11
|
+
exports.withRNAdgeistAppDelegate = withRNAdgeistAppDelegate;
|
|
12
|
+
async function readAppDelegateFileAndUpdateContents(config) {
|
|
13
|
+
const { modResults: appDelegateFile } = config;
|
|
14
|
+
const worker = getCompatibleFileUpdater(appDelegateFile.language);
|
|
15
|
+
appDelegateFile.contents = worker(appDelegateFile.contents);
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
18
|
+
function getCompatibleFileUpdater(language) {
|
|
19
|
+
switch (language) {
|
|
20
|
+
case 'objc':
|
|
21
|
+
case 'objcpp': {
|
|
22
|
+
return objCFileUpdater;
|
|
23
|
+
}
|
|
24
|
+
case 'swift':
|
|
25
|
+
return swiftFileUpdater;
|
|
26
|
+
default:
|
|
27
|
+
throw new Error(`Cannot add React Native Adgeist code to AppDelegate of language "${language}"`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function swiftFileUpdater(originalContents) {
|
|
31
|
+
const wantsToAddAnyCodeBlock = ``;
|
|
32
|
+
const rightBeforeLastClosingBrace = /didFinishLaunchingWithOptions:\s*launchOptions\)/g;
|
|
33
|
+
const pasteInTheListJustAfterTheClosingBracket = 2;
|
|
34
|
+
const results = (0, generateCode_1.mergeContents)({
|
|
35
|
+
tag: '@react-native-adgeist/implementation',
|
|
36
|
+
src: originalContents,
|
|
37
|
+
newSrc: wantsToAddAnyCodeBlock,
|
|
38
|
+
anchor: rightBeforeLastClosingBrace,
|
|
39
|
+
offset: pasteInTheListJustAfterTheClosingBracket,
|
|
40
|
+
comment: '// React Native Ageist',
|
|
41
|
+
});
|
|
42
|
+
return results.contents;
|
|
43
|
+
}
|
|
44
|
+
function objCFileUpdater(originalContents) {
|
|
45
|
+
const libraryHeaderImportCodeBlock = '#import "Adgeist.h"\n';
|
|
46
|
+
const rightBeforeAppDelegateImplementation = /@implementation\s+\w+/g;
|
|
47
|
+
const headerImportMergeResults = (0, generateCode_1.mergeContents)({
|
|
48
|
+
tag: '@react-native-adgeist/library-header-import',
|
|
49
|
+
src: originalContents,
|
|
50
|
+
newSrc: libraryHeaderImportCodeBlock,
|
|
51
|
+
anchor: rightBeforeAppDelegateImplementation,
|
|
52
|
+
offset: 0,
|
|
53
|
+
comment: '// React Native Ageist',
|
|
54
|
+
});
|
|
55
|
+
const wantsToAddAnyCodeBlock = ``;
|
|
56
|
+
const rightBeforeLastClosingEnd = /@end[^@]*$/g;
|
|
57
|
+
const implementationMergeResults = (0, generateCode_1.mergeContents)({
|
|
58
|
+
tag: '@react-native-adgeist/implementation',
|
|
59
|
+
src: headerImportMergeResults.contents,
|
|
60
|
+
newSrc: wantsToAddAnyCodeBlock,
|
|
61
|
+
anchor: rightBeforeLastClosingEnd,
|
|
62
|
+
offset: 0,
|
|
63
|
+
comment: '// React Native Ageist',
|
|
64
|
+
});
|
|
65
|
+
return implementationMergeResults.contents;
|
|
66
|
+
}
|
package/react-native.config.js
CHANGED
|
@@ -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.adgeist;
|
|
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 adSpaceId, String publisherId, Promise promise);
|
|
38
|
-
|
|
39
|
-
@ReactMethod
|
|
40
|
-
@DoNotStrip
|
|
41
|
-
public abstract void sendCreativeAnalytic(String campaignId, String adSpaceId, String publisherId, String eventType, 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;Lcom/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;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
NativeAdgeistSpecJSI::NativeAdgeistSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
26
|
-
: JavaTurboModule(params) {
|
|
27
|
-
methodMap_["fetchCreative"] = MethodMetadata {2, __hostFunction_NativeAdgeistSpecJSI_fetchCreative};
|
|
28
|
-
methodMap_["sendCreativeAnalytic"] = MethodMetadata {4, __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
|
package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp
DELETED
|
@@ -1,38 +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
|
-
);
|
|
20
|
-
}
|
|
21
|
-
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
22
|
-
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->sendCreativeAnalytic(
|
|
23
|
-
rt,
|
|
24
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
25
|
-
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
26
|
-
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
27
|
-
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt)
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
NativeAdgeistCxxSpecJSI::NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
32
|
-
: TurboModule("Adgeist", jsInvoker) {
|
|
33
|
-
methodMap_["fetchCreative"] = MethodMetadata {2, __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative};
|
|
34
|
-
methodMap_["sendCreativeAnalytic"] = MethodMetadata {4, __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} // 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 adSpaceId, jsi::String publisherId) = 0;
|
|
24
|
-
virtual jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType) = 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 adSpaceId, jsi::String publisherId) override {
|
|
56
|
-
static_assert(
|
|
57
|
-
bridging::getParameterCount(&T::fetchCreative) == 3,
|
|
58
|
-
"Expected fetchCreative(...) to have 3 parameters");
|
|
59
|
-
|
|
60
|
-
return bridging::callFromJs<jsi::Value>(
|
|
61
|
-
rt, &T::fetchCreative, jsInvoker_, instance_, std::move(adSpaceId), std::move(publisherId));
|
|
62
|
-
}
|
|
63
|
-
jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType) override {
|
|
64
|
-
static_assert(
|
|
65
|
-
bridging::getParameterCount(&T::sendCreativeAnalytic) == 5,
|
|
66
|
-
"Expected sendCreativeAnalytic(...) to have 5 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));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private:
|
|
73
|
-
friend class NativeAdgeistCxxSpec;
|
|
74
|
-
T *instance_;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Delegate delegate_;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
} // namespace facebook::react
|
|
@@ -1,46 +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: GenerateModuleObjCpp
|
|
8
|
-
*
|
|
9
|
-
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
-
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
-
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
#import "RNAdgeistSpec.h"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@implementation NativeAdgeistSpecBase
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
21
|
-
{
|
|
22
|
-
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
|
|
23
|
-
}
|
|
24
|
-
@end
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
namespace facebook::react {
|
|
28
|
-
|
|
29
|
-
static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_fetchCreative(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
30
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "fetchCreative", @selector(fetchCreative:publisherId:resolve:reject:), args, count);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
34
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "sendCreativeAnalytic", @selector(sendCreativeAnalytic:adSpaceId:publisherId:eventType:resolve:reject:), args, count);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
NativeAdgeistSpecJSI::NativeAdgeistSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
38
|
-
: ObjCTurboModule(params) {
|
|
39
|
-
|
|
40
|
-
methodMap_["fetchCreative"] = MethodMetadata {2, __hostFunction_NativeAdgeistSpecJSI_fetchCreative};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
methodMap_["sendCreativeAnalytic"] = MethodMetadata {4, __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic};
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
} // namespace facebook::react
|
|
@@ -1,71 +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: GenerateModuleObjCpp
|
|
8
|
-
*
|
|
9
|
-
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
-
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
-
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
#ifndef __cplusplus
|
|
15
|
-
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
-
#endif
|
|
17
|
-
|
|
18
|
-
// Avoid multiple includes of RNAdgeistSpec symbols
|
|
19
|
-
#ifndef RNAdgeistSpec_H
|
|
20
|
-
#define RNAdgeistSpec_H
|
|
21
|
-
|
|
22
|
-
#import <Foundation/Foundation.h>
|
|
23
|
-
#import <RCTRequired/RCTRequired.h>
|
|
24
|
-
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
-
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
-
#import <React/RCTBridgeModule.h>
|
|
27
|
-
#import <React/RCTCxxConvert.h>
|
|
28
|
-
#import <React/RCTManagedPointer.h>
|
|
29
|
-
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
-
#import <optional>
|
|
31
|
-
#import <vector>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
35
|
-
|
|
36
|
-
@protocol NativeAdgeistSpec <RCTBridgeModule, RCTTurboModule>
|
|
37
|
-
|
|
38
|
-
- (void)fetchCreative:(NSString *)adSpaceId
|
|
39
|
-
publisherId:(NSString *)publisherId
|
|
40
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
41
|
-
reject:(RCTPromiseRejectBlock)reject;
|
|
42
|
-
- (void)sendCreativeAnalytic:(NSString *)campaignId
|
|
43
|
-
adSpaceId:(NSString *)adSpaceId
|
|
44
|
-
publisherId:(NSString *)publisherId
|
|
45
|
-
eventType:(NSString *)eventType
|
|
46
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
47
|
-
reject:(RCTPromiseRejectBlock)reject;
|
|
48
|
-
|
|
49
|
-
@end
|
|
50
|
-
|
|
51
|
-
@interface NativeAdgeistSpecBase : NSObject {
|
|
52
|
-
@protected
|
|
53
|
-
facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
54
|
-
}
|
|
55
|
-
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@end
|
|
59
|
-
|
|
60
|
-
namespace facebook::react {
|
|
61
|
-
/**
|
|
62
|
-
* ObjC++ class for module 'NativeAdgeist'
|
|
63
|
-
*/
|
|
64
|
-
class JSI_EXPORT NativeAdgeistSpecJSI : public ObjCTurboModule {
|
|
65
|
-
public:
|
|
66
|
-
NativeAdgeistSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
67
|
-
};
|
|
68
|
-
} // namespace facebook::react
|
|
69
|
-
|
|
70
|
-
NS_ASSUME_NONNULL_END
|
|
71
|
-
#endif // RNAdgeistSpec_H
|
|
@@ -1,38 +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
|
-
);
|
|
20
|
-
}
|
|
21
|
-
static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
22
|
-
return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->sendCreativeAnalytic(
|
|
23
|
-
rt,
|
|
24
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
25
|
-
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
26
|
-
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
|
|
27
|
-
count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt)
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
NativeAdgeistCxxSpecJSI::NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
32
|
-
: TurboModule("Adgeist", jsInvoker) {
|
|
33
|
-
methodMap_["fetchCreative"] = MethodMetadata {2, __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative};
|
|
34
|
-
methodMap_["sendCreativeAnalytic"] = MethodMetadata {4, __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} // 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 adSpaceId, jsi::String publisherId) = 0;
|
|
24
|
-
virtual jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType) = 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 adSpaceId, jsi::String publisherId) override {
|
|
56
|
-
static_assert(
|
|
57
|
-
bridging::getParameterCount(&T::fetchCreative) == 3,
|
|
58
|
-
"Expected fetchCreative(...) to have 3 parameters");
|
|
59
|
-
|
|
60
|
-
return bridging::callFromJs<jsi::Value>(
|
|
61
|
-
rt, &T::fetchCreative, jsInvoker_, instance_, std::move(adSpaceId), std::move(publisherId));
|
|
62
|
-
}
|
|
63
|
-
jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType) override {
|
|
64
|
-
static_assert(
|
|
65
|
-
bridging::getParameterCount(&T::sendCreativeAnalytic) == 5,
|
|
66
|
-
"Expected sendCreativeAnalytic(...) to have 5 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));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private:
|
|
73
|
-
friend class NativeAdgeistCxxSpec;
|
|
74
|
-
T *instance_;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Delegate delegate_;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
} // namespace facebook::react
|