SyncableSetting

interface SyncableSetting

A setting that can be synced. Implement this interface to provide a way to sync a setting with the Sync Service.

Properties

Link copied to clipboard
abstract val key: String

This is the unique identifier of the setting to be used as a key in the Sync Setting collection.

Functions

Link copied to clipboard
abstract fun deduplicate(value: String?): Boolean

Should provide a way to merge remote value with local value on First sync (Deduplication).

Link copied to clipboard
abstract fun getValue(): String?

Setting value represented as a string. If the setting is not set or has no value, null should be returned.

Link copied to clipboard
abstract fun onSettingChanged()

Should provide a way to register to changes applied by the user. When called means that the user changed the setting value, and needs to be synced.

Link copied to clipboard
abstract fun onSyncDisabled()

Sync Feature has been disabled / device has been removed This is an opportunity for Features to do some local cleanup if needed

Link copied to clipboard
abstract fun registerToRemoteChanges(onDataChanged: () -> Unit)

Should provide a way to register to changes applied by Sync Service. When listener notified means that the setting value was changed by the Sync Service.

Link copied to clipboard
abstract fun save(value: String?): Boolean

Should save a new value for the setting.