diff --git a/library/src/enabled/java/com/telefonica/tweaks/Tweaks.kt b/library/src/enabled/java/com/telefonica/tweaks/Tweaks.kt index 419f85e..322745b 100644 --- a/library/src/enabled/java/com/telefonica/tweaks/Tweaks.kt +++ b/library/src/enabled/java/com/telefonica/tweaks/Tweaks.kt @@ -39,6 +39,14 @@ open class Tweaks { open fun getTweakValue(key: String): Flow = tweaksBusinessLogic.getValue(key) + open suspend fun setTweakValue(key: String, value: T) { + tweaksBusinessLogic.setValue(key, value) + } + + open suspend fun clearValue(key: String) { + tweaksBusinessLogic.clearValue(key) + } + private fun initializeGraph(tweaksGraph: TweaksGraph) { tweaksBusinessLogic.initialize(tweaksGraph) } diff --git a/library/src/enabled/java/com/telefonica/tweaks/domain/TweaksBusinessLogic.kt b/library/src/enabled/java/com/telefonica/tweaks/domain/TweaksBusinessLogic.kt index cbb8248..f692aa0 100644 --- a/library/src/enabled/java/com/telefonica/tweaks/domain/TweaksBusinessLogic.kt +++ b/library/src/enabled/java/com/telefonica/tweaks/domain/TweaksBusinessLogic.kt @@ -106,8 +106,8 @@ class TweaksBusinessLogic @Inject constructor( setValue(tweakEntry, value) } - suspend fun clearValue(key: String) { - val tweakEntry = keyToEntryValueMap[key] as Editable + suspend fun clearValue(key: String) { + val tweakEntry = keyToEntryValueMap[key] as Editable<*> clearValue(tweakEntry) } diff --git a/library/src/noop/java/com/telefonica/tweaks/Tweaks.kt b/library/src/noop/java/com/telefonica/tweaks/Tweaks.kt index f820744..06cd2f6 100644 --- a/library/src/noop/java/com/telefonica/tweaks/Tweaks.kt +++ b/library/src/noop/java/com/telefonica/tweaks/Tweaks.kt @@ -25,6 +25,10 @@ open class Tweaks { else -> flowOf() } + open suspend fun setTweakValue(key: String, value: T) {} + + open suspend fun clearValue(key: String) {} + private fun initialize(tweaksGraph: TweaksGraph) { val allEntries: List> = tweaksGraph.categories .flatMap { category ->