FFs can now be toggled in release builds too (#3101)
- Removed `StaticFeatureFlagProvider`. - Always provide `PreferencesFeatureFlagProvider`. - For the default values of feature flags, use a lambda with a `BuildMeta` parameter so we can customize the return value based on its data.
This commit is contained in:
parent
4757aac8b8
commit
32a374d836
19 changed files with 118 additions and 118 deletions
|
|
@ -23,5 +23,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.appconfig)
|
||||
implementation(projects.libraries.core)
|
||||
implementation(libs.coroutines.core)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package io.element.android.libraries.featureflag.api
|
||||
|
||||
import io.element.android.libraries.core.meta.BuildMeta
|
||||
|
||||
interface Feature {
|
||||
/**
|
||||
* Unique key to identify the feature.
|
||||
|
|
@ -33,9 +35,9 @@ interface Feature {
|
|||
val description: String?
|
||||
|
||||
/**
|
||||
* The default value of the feature (enabled or disabled).
|
||||
* Calculate the default value of the feature (enabled or disabled) given a [BuildMeta].
|
||||
*/
|
||||
val defaultValue: Boolean
|
||||
val defaultValue: (BuildMeta) -> Boolean
|
||||
|
||||
/**
|
||||
* Whether the feature is finished or not.
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
|
||||
package io.element.android.libraries.featureflag.api
|
||||
|
||||
import io.element.android.appconfig.OnBoardingConfig
|
||||
import io.element.android.libraries.core.meta.BuildMeta
|
||||
import io.element.android.libraries.core.meta.BuildType
|
||||
|
||||
/**
|
||||
* To enable or disable a FeatureFlags, change the `defaultValue` value.
|
||||
* Warning: to enable a flag for the release app, you MUST update the file
|
||||
|
|
@ -25,82 +29,88 @@ enum class FeatureFlags(
|
|||
override val key: String,
|
||||
override val title: String,
|
||||
override val description: String? = null,
|
||||
override val defaultValue: Boolean,
|
||||
override val defaultValue: (BuildMeta) -> Boolean,
|
||||
override val isFinished: Boolean,
|
||||
) : Feature {
|
||||
LocationSharing(
|
||||
key = "feature.locationsharing",
|
||||
title = "Allow user to share location",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = true,
|
||||
),
|
||||
Polls(
|
||||
key = "feature.polls",
|
||||
title = "Polls",
|
||||
description = "Create poll and render poll events in the timeline",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = true,
|
||||
),
|
||||
NotificationSettings(
|
||||
key = "feature.notificationsettings",
|
||||
title = "Show notification settings",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = true,
|
||||
),
|
||||
VoiceMessages(
|
||||
key = "feature.voicemessages",
|
||||
title = "Voice messages",
|
||||
description = "Send and receive voice messages",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = true,
|
||||
),
|
||||
PinUnlock(
|
||||
key = "feature.pinunlock",
|
||||
title = "Pin unlock",
|
||||
description = "Allow user to lock/unlock the app with a pin code or biometrics",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = true,
|
||||
),
|
||||
Mentions(
|
||||
key = "feature.mentions",
|
||||
title = "Mentions",
|
||||
description = "Type `@` to get mention suggestions and insert them",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = false,
|
||||
),
|
||||
MarkAsUnread(
|
||||
key = "feature.markAsUnread",
|
||||
title = "Mark as unread",
|
||||
description = "Allow user to mark a room as unread",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = false,
|
||||
),
|
||||
RoomDirectorySearch(
|
||||
key = "feature.roomdirectorysearch",
|
||||
title = "Room directory search",
|
||||
description = "Allow user to search for public rooms in their homeserver",
|
||||
defaultValue = false,
|
||||
defaultValue = { false },
|
||||
isFinished = false,
|
||||
),
|
||||
ShowBlockedUsersDetails(
|
||||
key = "feature.showBlockedUsersDetails",
|
||||
title = "Show blocked users details",
|
||||
description = "Show the name and avatar of blocked users in the blocked users list",
|
||||
defaultValue = false,
|
||||
defaultValue = { false },
|
||||
isFinished = false,
|
||||
),
|
||||
QrCodeLogin(
|
||||
key = "feature.qrCodeLogin",
|
||||
title = "Enable login using QR code",
|
||||
description = "Allow the user to login using the QR code flow",
|
||||
defaultValue = true,
|
||||
defaultValue = { buildMeta ->
|
||||
when (buildMeta.buildType) {
|
||||
// TODO remove once the feature is ready to publish
|
||||
BuildType.RELEASE -> false
|
||||
else -> OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE
|
||||
}
|
||||
},
|
||||
isFinished = false,
|
||||
),
|
||||
IncomingShare(
|
||||
key = "feature.incomingShare",
|
||||
title = "Incoming Share support",
|
||||
description = "Allow the application to receive data from other applications",
|
||||
defaultValue = true,
|
||||
defaultValue = { true },
|
||||
isFinished = false,
|
||||
),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue