Skip to content

Commit

Permalink
Interface should use AutofillSubfeature rather than AutofillSubfeatur…
Browse files Browse the repository at this point in the history
…eName (#2815)
  • Loading branch information
marcosholgado authored Feb 6, 2023
1 parent 8cdf9dd commit 616995e
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.edit
import com.duckduckgo.autofill.api.feature.AutofillFeatureName
import com.duckduckgo.autofill.api.feature.AutofillSubfeatureName
import com.duckduckgo.autofill.api.feature.AutofillSubfeature

interface AutofillFeatureToggleStore {
fun deleteAll()
Expand All @@ -31,12 +31,12 @@ interface AutofillFeatureToggleStore {
): Boolean

fun get(
featureName: AutofillSubfeatureName,
featureName: AutofillSubfeature,
defaultValue: Boolean,
): Boolean

fun getMinSupportedVersion(featureName: AutofillFeatureName): Int
fun getMinSupportedVersion(featureName: AutofillSubfeatureName): Int
fun getMinSupportedVersion(featureName: AutofillSubfeature): Int

fun insert(toggle: AutofillFeatureToggles)
fun insert(toggle: AutofillSubfeatureToggle)
Expand All @@ -56,12 +56,12 @@ class RealAutofillFeatureToggleStore(private val context: Context) : AutofillFea
): Boolean = preferences.getBoolean(featureName.value, defaultValue)

override fun get(
featureName: AutofillSubfeatureName,
featureName: AutofillSubfeature,
defaultValue: Boolean,
): Boolean = preferences.getBoolean(featureName.value, defaultValue)

override fun getMinSupportedVersion(featureName: AutofillFeatureName): Int = getMinSupportedVersion(featureName.value)
override fun getMinSupportedVersion(featureName: AutofillSubfeatureName): Int = getMinSupportedVersion(featureName.value)
override fun getMinSupportedVersion(featureName: AutofillSubfeature): Int = getMinSupportedVersion(featureName.value)
private fun getMinSupportedVersion(key: String): Int = preferences.getInt("${key}$MIN_SUPPORTED_VERSION", 0)

override fun insert(toggle: AutofillFeatureToggles) = insert(toggle.featureName.value, toggle.enabled, toggle.minSupportedVersion)
Expand Down Expand Up @@ -92,7 +92,7 @@ data class AutofillFeatureToggles(
)

data class AutofillSubfeatureToggle(
val featureName: AutofillSubfeatureName,
val featureName: AutofillSubfeature,
val enabled: Boolean,
val minSupportedVersion: Int?,
)

0 comments on commit 616995e

Please sign in to comment.