Package-level declarations
Types
A AndroidPlatform class that defines the Android platform type and name. References the names from the Android platform specific Build class
A class we define platform specific or actual implementations for JS Target
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.
All common config for client mangers
Defines the different Environments the sdk support. this is usually passed to the SDK via the Config builder.
class provides an in memory version of the settings, mostly useful during unit tests.
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.
https://github.com/Kotlin/kotlinx.coroutines/issues/706
A collection of storage-backed key-value data
A handle to a listener instance returned by one of the addListener methods of ObservableSettings, so it can be deactivated as needed.
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.
https://github.com/russhwolf/multiplatform-settings
A discriminated union that encapsulates a successful outcome with a value of type ResultT or a failure with an arbitrary Throwable ClientException.
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
Wait for the task to finish
Called from the client to initialize Napier logger
Return Singleton CoreClient
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
.
Equivalent to Settings.getBoolean
Equivalent to Settings.getDouble
Equivalent to Settings.getFloat
Equivalent to Settings.getInt
Equivalent to Settings.getLong
Equivalent to Settings.getString
expects implementation on all supported platforms
expected Platform imlmentation for iOS platform
expected Platform implementation for JS platform
expected Platform implementation for JVM platform
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 declaration of the httpClient function for the iOS
Called from the client to initialize Napier logger
Called from the client to initialize Napier logger
Equivalent to Settings.remove
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
.
Equivalent to Settings.putBoolean
Equivalent to Settings.putDouble
Equivalent to Settings.putFloat
Equivalent to Settings.putInt
Equivalent to Settings.putLong
Equivalent to Settings.remove
Equivalent to Settings.putString
Converts a ClientException into an NSError object for better interop with Objective-C, Swift projects.
Another way to consume common flows for JS ,