Package-level declarations

Types

Link copied to clipboard

A AndroidPlatform class that defines the Android platform type and name. References the names from the Android platform specific Build class

Link copied to clipboard
open class AppEventsObserver(context: Context, capabilities: List<Int>, transportTypes: List<Int>) : DefaultLifecycleObserver
Link copied to clipboard

A class we define platform specific or actual implementations for JS Target

Link copied to clipboard
class CommonFlow<T>(val origin: Flow<T>) : Flow<T>

A wrapper class for Kotlin Coroutine Flows for iOS. This is picked up from jetbrain's kotlinconf FlowUtils. So instead of flow, we only have callbacks that looks almost like a flow, It also exposes a Closeable. that is responsible for closing any scope we have on Kotlin side. so client can simple call close(). this creates a lifecycle flow we can deal with. it enables iOS and web to consume the flow data in a natural way. refer to the iOS and web samples for how to use. launchIn defines where we running our coroutine. here its running on Dispatchers.Main so this may cause issue with Threading controlled on Kotlin KMM. e.g in case the client want to run this flow in a Dispatchers background it will still run on Main. but will explorer this some other time.

Link copied to clipboard

All common config for client mangers

Link copied to clipboard
data class Consumer(val platform: Platform.Type, val appId: String, val fingerprint: String? = null, val alg: String = DEFAULT_ALG)
Link copied to clipboard
class ContextScope(context: CoroutineContext) : CoroutineScope
Link copied to clipboard
actual class CoreClient
expect class CoreClient
actual class CoreClient
actual class CoreClient
actual class CoreClient
Link copied to clipboard
Link copied to clipboard

Defines the different Environments the sdk support. this is usually passed to the SDK via the Config builder.

Link copied to clipboard
object Flows
Link copied to clipboard
object Http

a singleton class that holds utils common to the Http.

Link copied to clipboard
class InMemorySetting(clearExpiredKeysDuration: Duration? = null) : Settings

class provides an in memory version of the settings, mostly useful during unit tests.

Link copied to clipboard
internal actual class InternalTask<ResultT>(_task: Task<ResultT>)
internal expect class InternalTask<ResultT>(_task: Task<ResultT>)
internal actual class InternalTask<ResultT>(_task: Task<ResultT>)
internal actual class InternalTask<ResultT>(_task: Task<ResultT>)
internal actual class InternalTask<ResultT>(_task: Task<ResultT>)
Link copied to clipboard

Since the rest of the Darwin targets depend on iOSMain during its creation, All the actual implementations can be reuse and pickup from iOsMain On in special occasions when we need custom implementation on like MacOS or WatchOS we can use the specific target module.

Link copied to clipboard
Link copied to clipboard
class LazySuspend<T>(initializer: suspend () -> T)

https://github.com/Kotlin/kotlinx.coroutines/issues/706

Link copied to clipboard
object Log
Link copied to clipboard
class MapSettings(val delegate: MutableMap<String, Any> = mutableMapOf(), clearExpiredKeysDuration: Duration? = null) : ObservableSettings

A collection of storage-backed key-value data

Link copied to clipboard
Link copied to clipboard

A handle to a listener instance returned by one of the addListener methods of ObservableSettings, so it can be deactivated as needed.

Link copied to clipboard
abstract class Platform

Defines the supported platforms by the sdks

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class RunBlocking
Link copied to clipboard
interface Settings

A Wrapper for saving simple key-value data. Currently it only supports saving of primitive data types. TODO later we can add coroutines support or settings listeners since our implementation can support it. TODO later we can support wrapped using a property delegate.

Link copied to clipboard
internal class SettingsImpl(val settings: Settings = com.russhwolf.settings.Settings(), clearExpiredKeysDuration: Duration? = null) : Settings

https://github.com/russhwolf/multiplatform-settings

Link copied to clipboard
class Task<ResultT>(val scope: CoroutineScope, val config: TaskConfig? = TaskConfig(), block: suspend CoroutineScope.() -> ResultT)

A discriminated union that encapsulates a successful outcome with a value of type ResultT or a failure with an arbitrary Throwable ClientException.

Link copied to clipboard
data class TaskConfig(val retry: Int? = 0, val backOffDelay: Int? = 0, val startDelay: Int? = 0)
Tasks
Link copied to clipboard
object Tasks
object Tasks
object Tasks
Link copied to clipboard
Link copied to clipboard
object ThrowableSerializer : KSerializer<Throwable>

ThrowableSerializer is a custom serializer for the Throwable class which is used to serialize/deserialize Throwable objects to/from json strings. This class implements the KSerializer interface provided by the kotlinx.serialization library.

Functions

Link copied to clipboard
fun <T> Flow<T>.asCommonFlow(): CommonFlow<T>
Link copied to clipboard
suspend fun <ResultT> Task<ResultT>.await(): ResultT

Wait for the task to finish

Link copied to clipboard

Wait for the task to finish

Link copied to clipboard
inline operator fun Settings.contains(key: String): Boolean

Equivalent to Settings.hasKey

Link copied to clipboard

Called from the client to initialize Napier logger

Link copied to clipboard
internal fun debugLoggerInternal()
Link copied to clipboard

Return Singleton CoreClient

Link copied to clipboard
inline operator fun <T : Any> Settings.get(key: String): T?

Get the typed value stored at key if present, or return null if not. Throws IllegalArgumentException if T is not one of Int, Long, String, Float, Double, or Boolean.

inline operator fun Settings.get(key: String, defaultValue: Boolean): Boolean

Equivalent to Settings.getBoolean

inline operator fun Settings.get(key: String, defaultValue: Double): Double

Equivalent to Settings.getDouble

inline operator fun Settings.get(key: String, defaultValue: Float): Float

Equivalent to Settings.getFloat

inline operator fun Settings.get(key: String, defaultValue: Int): Int

Equivalent to Settings.getInt

inline operator fun Settings.get(key: String, defaultValue: Long): Long

Equivalent to Settings.getLong

inline operator fun Settings.get(key: String, defaultValue: String): String

Equivalent to Settings.getString

Link copied to clipboard
actual fun getPlatform(): Platform
expect fun getPlatform(): Platform

expects implementation on all supported platforms

actual fun getPlatform(): Platform

expected Platform imlmentation for iOS platform

actual fun getPlatform(): Platform

expected Platform implementation for JS platform

actual fun getPlatform(): Platform

expected Platform implementation for JVM platform

Link copied to clipboard
actual fun httpClient(shouldLogHttpRequests: Boolean, interceptors: List<Any?>?, userAgent: String?, config: HttpClientConfig<*>.() -> Unit): HttpClient
expect fun httpClient(shouldLogHttpRequests: Boolean = false, interceptors: List<Any?>? = listOf(), userAgent: String? = null, config: HttpClientConfig<*>.() -> Unit = {}): HttpClient

To configure Ktor engine-specific options in our multiplatform SDK we declare expect/actual dependencies Notice by default we set it to Unit we can also define this expect within the network package so not accessible to client. We have to write some actual and expected functions that will resolve all platform’s conflicts in iOS and Android and JS. It calls different HTTP functions in different platforms which you can define platform-specific.

actual fun httpClient(shouldLogHttpRequests: Boolean, interceptors: List<Any?>?, userAgent: String?, config: HttpClientConfig<*>.() -> Unit): HttpClient

actual declaration of the httpClient function for the iOS

actual fun httpClient(shouldLogHttpRequests: Boolean, interceptors: List<Any?>?, userAgent: String?, config: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun httpClient(shouldLogHttpRequests: Boolean, interceptors: List<Any?>?, userAgent: String?, config: HttpClientConfig<*>.() -> Unit): HttpClient
initLogger
Link copied to clipboard

Called from the client to initialize Napier logger

Called from the client to initialize Napier logger

Link copied to clipboard
inline operator fun Settings.minusAssign(key: String)

Equivalent to Settings.remove

Link copied to clipboard
inline operator fun <T : Any> Settings.set(key: String, value: T?)

Stores a typed value at key, or remove what's there if value is null. Throws IllegalArgumentException if T is not one of Int, Long, String, Float, Double, or Boolean.

inline operator fun Settings.set(key: String, value: Boolean)

Equivalent to Settings.putBoolean

inline operator fun Settings.set(key: String, value: Double)

Equivalent to Settings.putDouble

inline operator fun Settings.set(key: String, value: Float)

Equivalent to Settings.putFloat

inline operator fun Settings.set(key: String, value: Int)

Equivalent to Settings.putInt

inline operator fun Settings.set(key: String, value: Long)

Equivalent to Settings.putLong

inline operator fun Settings.set(key: String, value: Nothing?)

Equivalent to Settings.remove

inline operator fun Settings.set(key: String, value: String)

Equivalent to Settings.putString

Link copied to clipboard
fun ClientException.toNSError(): NSError

Converts a ClientException into an NSError object for better interop with Objective-C, Swift projects.

Link copied to clipboard
fun <T> CommonFlow<T>.watch(stream: (T) -> Unit, error: (ClientException) -> Unit, scope: CoroutineScope = ContextScope.get(DispatchersProvider.Default)): CommonFlow.Job

Another way to consume common flows for JS ,