@tinkerlandai/indiana-react-native 0.10.1 → 0.10.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/IndianaReactNative.podspec +1 -1
- package/README.md +5 -5
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/native-sdk/android/assets/indiana/index.html +36 -36
- package/native-sdk/android/java/ai/tinkerland/indiana/ContentView.kt +1 -1
- package/native-sdk/android/java/ai/tinkerland/indiana/FeatureClient.kt +1 -1
- package/native-sdk/android/java/ai/tinkerland/indiana/HTTPTransport.kt +1 -1
- package/native-sdk/android/java/ai/tinkerland/indiana/SDKVersion.kt +1 -1
- package/native-sdk/ios/ContentView.swift +1 -1
- package/native-sdk/ios/FeatureClient.swift +1 -1
- package/native-sdk/ios/HTTPTransport.swift +1 -1
- package/native-sdk/ios/SDKVersion.swift +1 -1
- package/native-sdk/ios/WebView/index.html +36 -36
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ class IndianaContentView(activity: Activity, val session: IndianaContentSession)
|
|
|
14
14
|
var onDismiss: (() -> Unit)? = null
|
|
15
15
|
var onError: ((Exception) -> Unit)? = null
|
|
16
16
|
private val work = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
|
17
|
-
private val host = IndianaBundledWebView(activity, "
|
|
17
|
+
private val host = IndianaBundledWebView(activity, "Longplay content", work, ::dispatch) { error -> onError?.invoke(error) }
|
|
18
18
|
private var stopped = false
|
|
19
19
|
init {
|
|
20
20
|
addView(host.view, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
|
@@ -19,7 +19,7 @@ class IndianaFeatureClient internal constructor(private val activity: Activity,
|
|
|
19
19
|
private val pending = mutableMapOf<UUID, CompletableDeferred<Any?>>()
|
|
20
20
|
var onError: ((Exception) -> Unit)? = null
|
|
21
21
|
private var stopped = false
|
|
22
|
-
private val host = IndianaBundledWebView(activity, "
|
|
22
|
+
private val host = IndianaBundledWebView(activity, "Longplay Feature evaluator", work, ::dispatch) { error -> if (!readiness.isCompleted) close() else onError?.invoke(error) }
|
|
23
23
|
init { host.start() }
|
|
24
24
|
suspend fun evalFeature(key: String): JSONObject {
|
|
25
25
|
val result = call(JSONObject().put("method", "evalFeature").put("key", key)) as? JSONObject ?: throw IndianaClientException("invalid_response")
|
|
@@ -8,7 +8,7 @@ import java.net.HttpURLConnection
|
|
|
8
8
|
import java.io.ByteArrayOutputStream
|
|
9
9
|
|
|
10
10
|
/** Override baseUrl for test services; Sandbox selects business scope within that service. */
|
|
11
|
-
data class IndianaConfiguration(val baseUrl: String = "https://api.
|
|
11
|
+
data class IndianaConfiguration(val baseUrl: String = "https://api.longplayai.com",val scope: IndianaScope,val timeoutMs: Int=15_000) {
|
|
12
12
|
internal val apiOrigin: String get() {
|
|
13
13
|
val url = URI(baseUrl)
|
|
14
14
|
return URI(url.scheme.lowercase(), null, url.host.lowercase(), if (url.port == 443) -1 else url.port, null, null, null).toString()
|
|
@@ -14,7 +14,7 @@ import SwiftUI
|
|
|
14
14
|
required init?(coder: NSCoder) { fatalError("Use init(session:)") }
|
|
15
15
|
public override func viewDidLoad() {
|
|
16
16
|
super.viewDidLoad()
|
|
17
|
-
host = IndianaBundledWebView(label: "
|
|
17
|
+
host = IndianaBundledWebView(label: "Longplay content", dispatch: { [weak self] method, payload in
|
|
18
18
|
guard let self else { throw IndianaClientError.identityChanged }; return try await self.dispatch(method, payload)
|
|
19
19
|
}, onError: { [weak self] error in self?.onError?(error) })
|
|
20
20
|
host.webView.frame = view.bounds; host.webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]; view.addSubview(host.webView)
|
|
@@ -26,7 +26,7 @@ import UIKit
|
|
|
26
26
|
private var pending: [UUID: CheckedContinuation<IndianaJSON, Error>] = [:]
|
|
27
27
|
init(configuration: IndianaConfiguration, attributes: [String: IndianaJSON], operation: @escaping @Sendable (IndianaCustomerOperation, [String: IndianaJSON]) async throws -> IndianaJSON) {
|
|
28
28
|
self.configuration = configuration; self.attributes = attributes; self.operation = operation
|
|
29
|
-
host = IndianaBundledWebView(label: "
|
|
29
|
+
host = IndianaBundledWebView(label: "Longplay Feature evaluator", dispatch: { [weak self] method, payload in
|
|
30
30
|
guard let self else { throw IndianaClientError.identityChanged }; return try await self.dispatch(method, payload)
|
|
31
31
|
}, onError: { [weak self] error in guard let self else { return }; if !self.ready { self.close() } else { self.onError?(error) } })
|
|
32
32
|
host.start()
|
|
@@ -11,7 +11,7 @@ public struct IndianaConfiguration: Sendable {
|
|
|
11
11
|
public let scope: IndianaScope
|
|
12
12
|
public let timeout: TimeInterval
|
|
13
13
|
/// Override baseURL explicitly for test services; Sandbox is a business scope, not a deployment selector.
|
|
14
|
-
public init(baseURL: URL = URL(string: "https://api.
|
|
14
|
+
public init(baseURL: URL = URL(string: "https://api.longplayai.com")!, scope: IndianaScope, timeout: TimeInterval = 15) throws {
|
|
15
15
|
guard baseURL.scheme == "https", baseURL.host != nil, baseURL.user == nil, baseURL.password == nil,
|
|
16
16
|
baseURL.query == nil, baseURL.fragment == nil, timeout > 0, timeout <= 120 else { throw IndianaClientError.invalidConfiguration }
|
|
17
17
|
self.baseURL = baseURL; self.scope = scope; self.timeout = timeout
|