ditto-lib / live.ditto / DittoKit

DittoKit

class DittoKit : Closeable

DittoKit is the entry point for accessing Ditto-related functionality.

Parameters

dependencies - the dependencies required by the SDK to be initialised.

identity - the identity to be used to represent the connected client.

dbConfig - optional config that will be used to configure the internal database store.

Constructors

<init>

DittoKit(dependencies: DittoKitDependencies, identity: DittoIdentity = DittoIdentity.Development(), dbConfig: DittoDBConfig = DittoDBConfig())

Creates a DittoKit instance.

Properties

activated

var activated: Boolean

flag indicating whether or not the SDK has been activated with an access license.

callback

var callback: DittoKitCallback?

an optional callback that will be called with lifecycle events relating to the SDK.

dependencies

val dependencies: DittoKitDependencies

the dependencies required by the SDK to be initialised.

siteID

val siteID: UInt

the site ID component of the identity in use.

status

val status: Status

the status of the network transports.

store

val store: DittoStore

provides access to the SDK's store functionality.

Functions

clearSiteID

fun clearSiteID(): Unit

Clears the cached site ID, if one had been cached.

close

fun close(): Unit

Closes the DittoKit instance so that its underlying resources are cleaned up appropriately.

getTransportDiagnostics

fun getTransportDiagnostics(): TransportDiagnostics

Request bulk status information about the transports. This is mostly intended for statistical or debugging purposes.

refreshPermissions

fun refreshPermissions(): Unit

Provide a hint to DittoKit that app permissions may have changed.

setAccessLicense

fun setAccessLicense(license: String): Unit

Activate a DittoKit instance by setting an access license. You cannot interact with DittoKit before you have activated it.

start

fun start(transports: Set<DittoTransports> = mutableSetOf( DittoTransports.WiFi, DittoTransports.Bluetooth )): Unit

Start a set of transports being used by DittoKit to connect to other devices. This has no effect if a provided transport is already started.

stop

fun stop(transports: Set<DittoTransports>): Unit

Stop a set of transports from being used by DittoKit to connect to other devices.

Companion Object Properties

logger

var logger: DittoLogger

The logger that will be used to log all Ditto-related logs. A default one is set that logs to logcat.

loggingEnabled

var loggingEnabled: Boolean

Represents whether logging is enabled.

minimumLogLevel

var minimumLogLevel: LogLevel

The minimum log level at which logs will be logged, provided loggingEnabled is true.