Make a diff between FeatureFlags.defaultValue and value returned by StaticFeatureFlagProvider.isFeatureEnabled().
Iterate after Ganfra's review.
This commit is contained in:
@@ -18,7 +18,8 @@ package io.element.android.libraries.featureflag.api
|
||||
|
||||
/**
|
||||
* To enable or disable a FeatureFlags, change the `defaultValue` value.
|
||||
* It will impact all the build types.
|
||||
* Warning: to enable a flog for the release app, you MUST update the file
|
||||
* [io.element.android.libraries.featureflag.impl.StaticFeatureFlagProvider]
|
||||
*/
|
||||
enum class FeatureFlags(
|
||||
override val key: String,
|
||||
@@ -40,6 +41,7 @@ enum class FeatureFlags(
|
||||
NotificationSettings(
|
||||
key = "feature.notificationsettings",
|
||||
title = "Show notification settings",
|
||||
// Do not forget to edit StaticFeatureFlagProvider when enabling the feature.
|
||||
defaultValue = false,
|
||||
),
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* This provider is used for release build.
|
||||
* [isFeatureEnabled] just returns the default value of the FeatureFlags.
|
||||
* This is the place to enable or disable feature for the release build.
|
||||
*/
|
||||
class StaticFeatureFlagProvider @Inject constructor() :
|
||||
FeatureFlagProvider {
|
||||
@@ -31,7 +31,11 @@ class StaticFeatureFlagProvider @Inject constructor() :
|
||||
|
||||
override suspend fun isFeatureEnabled(feature: Feature): Boolean {
|
||||
return if (feature is FeatureFlags) {
|
||||
feature.defaultValue
|
||||
when(feature) {
|
||||
FeatureFlags.LocationSharing -> true
|
||||
FeatureFlags.Polls -> true
|
||||
FeatureFlags.NotificationSettings -> false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user