Skip to content

Commit

Permalink
Format file
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelga committed Feb 8, 2024
1 parent ef72869 commit 9dc6cf2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions library/src/enabled/java/com/telefonica/tweaks/Tweaks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@ import kotlinx.coroutines.flow.map
import javax.inject.Inject


open class Tweaks: TweaksContract {
open class Tweaks : TweaksContract {

@Inject
internal lateinit var tweaksBusinessLogic: TweaksBusinessLogic

override fun <T> getTweakValue(key: String): Flow<T?> = tweaksBusinessLogic.getValue(key)

override fun <T> getTweakValue(key: String, defaultValue: T): Flow<T> = getTweakValue<T>(key).map { it ?: defaultValue }
override fun <T> getTweakValue(key: String, defaultValue: T): Flow<T> =
getTweakValue<T>(key).map { it ?: defaultValue }

override suspend fun <T> getTweak(key: String): T? = getTweakValue<T>(key).firstOrNull()

override suspend fun <T> getTweak(key: String, defaultValue: T): T = getTweak(key) ?: defaultValue
override suspend fun <T> getTweak(key: String, defaultValue: T): T =
getTweak(key) ?: defaultValue

override suspend fun <T> setTweakValue(key: String, value: T) {
tweaksBusinessLogic.setValue(key, value)
Expand Down

0 comments on commit 9dc6cf2

Please sign in to comment.