@thealteroffice/react-native-adgeist 0.0.29-beta → 0.0.30-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.
|
@@ -5,6 +5,7 @@ import android.util.Log
|
|
|
5
5
|
import com.facebook.react.bridge.Promise
|
|
6
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
7
|
import com.adgeistkit.AdgeistCore
|
|
8
|
+
import com.adgeistkit.data.models.AdData
|
|
8
9
|
import com.adgeistkit.data.models.CPMAdResponse
|
|
9
10
|
import com.adgeistkit.data.models.Event
|
|
10
11
|
import com.adgeistkit.data.models.FixedAdResponse
|
|
@@ -41,16 +42,20 @@ class AdgeistImpl internal constructor(private val context: ReactApplicationCont
|
|
|
41
42
|
fun fetchCreative(adSpaceId: String, buyType: String, isTestEnvironment: Boolean, promise: Promise) {
|
|
42
43
|
getAd?.fetchCreative(adSpaceId, buyType, isTestEnvironment) { adData ->
|
|
43
44
|
if (adData != null) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if (adData.isSuccess && adData.data != null) {
|
|
46
|
+
when (val response = adData.data) {
|
|
47
|
+
is CPMAdResponse -> {
|
|
48
|
+
promise.resolve(response.toWritableMap())
|
|
49
|
+
}
|
|
50
|
+
is FixedAdResponse -> {
|
|
51
|
+
promise.resolve(response.toWritableMap())
|
|
52
|
+
}
|
|
53
|
+
else -> {
|
|
54
|
+
promise.reject("UNKNOWN_RESPONSE", "Unknown ad response type")
|
|
55
|
+
}
|
|
53
56
|
}
|
|
57
|
+
} else {
|
|
58
|
+
promise.reject("AD_ERROR", adData.errorMessage)
|
|
54
59
|
}
|
|
55
60
|
} else {
|
|
56
61
|
promise.reject("NO_AD", "Ad data not available")
|
package/ios/AdgeistImpl.swift
CHANGED
|
@@ -52,18 +52,24 @@ import React
|
|
|
52
52
|
adUnitID: adSpaceId,
|
|
53
53
|
buyType: buyType,
|
|
54
54
|
isTestEnvironment: isTestEnvironment
|
|
55
|
-
) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
) { adData in
|
|
56
|
+
// Check if the request was successful
|
|
57
|
+
if adData.isSuccess, let creativeData = adData.data {
|
|
58
|
+
var result: [String: Any] = [:]
|
|
59
|
+
|
|
60
|
+
// Use Mirror to reflect the object's properties
|
|
61
|
+
let mirror = Mirror(reflecting: creativeData)
|
|
62
|
+
for child in mirror.children {
|
|
63
|
+
if let label = child.label {
|
|
64
|
+
result[label] = child.value
|
|
65
|
+
}
|
|
63
66
|
}
|
|
67
|
+
|
|
68
|
+
resolver(result)
|
|
69
|
+
} else {
|
|
70
|
+
// Return error from AdData
|
|
71
|
+
rejecter("AD_ERROR", adData.errorMessage, nil)
|
|
64
72
|
}
|
|
65
|
-
|
|
66
|
-
resolver(result)
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
|
package/lib/module/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AdSize } from './types/AdSize';
|
|
2
2
|
export declare const PACKAGE_VERSION_TAG = "RN";
|
|
3
|
-
export declare const PACKAGE_VERSION = "0.0.
|
|
3
|
+
export declare const PACKAGE_VERSION = "0.0.30-beta";
|
|
4
4
|
export declare const AdSizes: {
|
|
5
5
|
custom: (width: number, height: number) => AdSize;
|
|
6
6
|
Responsive: {
|
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.30-beta",
|
|
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",
|
package/src/constants.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AdSize } from './types/AdSize';
|
|
2
2
|
|
|
3
3
|
export const PACKAGE_VERSION_TAG = 'RN';
|
|
4
|
-
export const PACKAGE_VERSION = '0.0.
|
|
4
|
+
export const PACKAGE_VERSION = '0.0.30-beta';
|
|
5
5
|
|
|
6
6
|
export const AdSizes = {
|
|
7
7
|
custom: (width: number, height: number): AdSize => ({ width, height }),
|