From 3ade5fa24a1f13e9319cf77932058ded70a7d1fa Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 25 Sep 2024 09:14:03 -0400 Subject: [PATCH 1/8] Added self-hosted users config --- WordPress/build.gradle | 1 + .../config/SelfHostedUsersFeatureConfig.kt | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 73cc00edee7b..eabd6cc437f8 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -201,6 +201,7 @@ android { buildConfigField "boolean", "READER_ANNOUNCEMENT_CARD", "false" buildConfigField "boolean", "VOICE_TO_CONTENT", "false" buildConfigField "boolean", "READER_FLOATING_BUTTON", "false" + buildConfigField "boolean", "ENABLE_SELF_HOSTED_USERS", "false" // Override these constants in jetpack product flavor to enable/ disable features buildConfigField "boolean", "ENABLE_SITE_CREATION", "true" diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt new file mode 100644 index 000000000000..67393c8e201a --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -0,0 +1,23 @@ +package org.wordpress.android.util.config + +import org.wordpress.android.BuildConfig +import org.wordpress.android.annotation.Feature +import org.wordpress.android.util.config.SelfHostedUsersFeatureConfig.Companion.SELF_HOSTED_USERS_REMOTE_FIELD +import javax.inject.Inject + +/** + * Configuration of the self-hosted users feature + */ +@Feature(SELF_HOSTED_USERS_REMOTE_FIELD, false) +class SelfHostedUsersFeatureConfig +@Inject constructor( + appConfig: AppConfig +) : FeatureConfig( + appConfig, + BuildConfig.ENABLE_SELF_HOSTED_USERS, + SELF_HOSTED_USERS_REMOTE_FIELD +) { + companion object { + const val SELF_HOSTED_USERS_REMOTE_FIELD = "self_hosted_users_remote_field" + } +} From e2459a755b1cf038bd2b0c0ae4f9b75747bc54a3 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 25 Sep 2024 10:19:54 -0400 Subject: [PATCH 2/8] Moved self-hosted users config to "Features in Development" --- .../util/config/SelfHostedUsersFeatureConfig.kt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt index 67393c8e201a..52d5cd9c1d54 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -1,23 +1,12 @@ package org.wordpress.android.util.config import org.wordpress.android.BuildConfig -import org.wordpress.android.annotation.Feature -import org.wordpress.android.util.config.SelfHostedUsersFeatureConfig.Companion.SELF_HOSTED_USERS_REMOTE_FIELD +import org.wordpress.android.annotation.FeatureInDevelopment import javax.inject.Inject /** * Configuration of the self-hosted users feature */ -@Feature(SELF_HOSTED_USERS_REMOTE_FIELD, false) +@FeatureInDevelopment class SelfHostedUsersFeatureConfig -@Inject constructor( - appConfig: AppConfig -) : FeatureConfig( - appConfig, - BuildConfig.ENABLE_SELF_HOSTED_USERS, - SELF_HOSTED_USERS_REMOTE_FIELD -) { - companion object { - const val SELF_HOSTED_USERS_REMOTE_FIELD = "self_hosted_users_remote_field" - } -} +@Inject constructor(appConfig: AppConfig) : FeatureConfig(appConfig, BuildConfig.ENABLE_SELF_HOSTED_USERS) From 8051565db62612c959f9edc5274c2dc1276540a1 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 25 Sep 2024 10:37:01 -0400 Subject: [PATCH 3/8] Minor formatting change --- .../android/util/config/SelfHostedUsersFeatureConfig.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt index 52d5cd9c1d54..0e2e5d369cbe 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -9,4 +9,7 @@ import javax.inject.Inject */ @FeatureInDevelopment class SelfHostedUsersFeatureConfig -@Inject constructor(appConfig: AppConfig) : FeatureConfig(appConfig, BuildConfig.ENABLE_SELF_HOSTED_USERS) +@Inject constructor(appConfig: AppConfig) : FeatureConfig( + appConfig, + BuildConfig.ENABLE_SELF_HOSTED_USERS +) From ae3bb103e61c3a5df0caf59b2dd50bbe1a089df0 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 25 Sep 2024 14:42:16 -0400 Subject: [PATCH 4/8] Changed to FeatureConfig --- .../android/util/config/SelfHostedUsersFeatureConfig.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt index 0e2e5d369cbe..49976840c8b1 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -1,15 +1,18 @@ package org.wordpress.android.util.config import org.wordpress.android.BuildConfig -import org.wordpress.android.annotation.FeatureInDevelopment +import org.wordpress.android.annotation.Feature import javax.inject.Inject /** * Configuration of the self-hosted users feature */ -@FeatureInDevelopment +private const val ENABLE_SELF_HOSTED_USERS = "enable_self_hosted_users" + +@Feature(ENABLE_SELF_HOSTED_USERS, false) class SelfHostedUsersFeatureConfig @Inject constructor(appConfig: AppConfig) : FeatureConfig( appConfig, - BuildConfig.ENABLE_SELF_HOSTED_USERS + BuildConfig.ENABLE_SELF_HOSTED_USERS, + ENABLE_SELF_HOSTED_USERS ) From e59606680f3c955486a0f2cb8f75ab133d2b560f Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 25 Sep 2024 15:27:38 -0400 Subject: [PATCH 5/8] Renamed variable --- .../android/util/config/SelfHostedUsersFeatureConfig.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt index 49976840c8b1..b33cd560c7e9 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -7,12 +7,12 @@ import javax.inject.Inject /** * Configuration of the self-hosted users feature */ -private const val ENABLE_SELF_HOSTED_USERS = "enable_self_hosted_users" +private const val ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD = "enable_self_hosted_users" -@Feature(ENABLE_SELF_HOSTED_USERS, false) +@Feature(ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD, false) class SelfHostedUsersFeatureConfig @Inject constructor(appConfig: AppConfig) : FeatureConfig( appConfig, BuildConfig.ENABLE_SELF_HOSTED_USERS, - ENABLE_SELF_HOSTED_USERS + ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD ) From 9e0ec5938738b831b6a94b119ed5d8df7bf920bc Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 25 Sep 2024 19:10:47 -0400 Subject: [PATCH 6/8] Removed inaccurate comments about remote_config_defaults.xml --- .../java/org/wordpress/android/util/config/ExperimentConfig.kt | 1 - .../main/java/org/wordpress/android/util/config/FeatureConfig.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/ExperimentConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/ExperimentConfig.kt index 500e75f92dca..1ad5cf116bd8 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/ExperimentConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/ExperimentConfig.kt @@ -2,7 +2,6 @@ package org.wordpress.android.util.config /** * This class represents an abstract experiment configuration. An experiment has a list of variants. - * To add an experiment don't forget to update the `remote_config_defaults.xml` file. * @param appConfig class that loads the feature configuration * @param remoteField is the key of the feature flag in the remote config file */ diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/FeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/FeatureConfig.kt index 2e61efb970f0..023e4d6b8a91 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/FeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/FeatureConfig.kt @@ -2,7 +2,6 @@ package org.wordpress.android.util.config /** * A class that represents a feature configuration which enables the feature to be remotely turned on or off. - * To add a feature don't forget to update the remote_config_defaults.xml file. * @param appConfig class that loads the feature configuration * @param buildConfigValue is the field in the BuildConfig file. This flag overrides the remote value. Use this field * to enable the feature to a certain build (debug, test build) so it doesn't have to rely on remote configuration. From ff3a0a91d2b8c06520e2d1e84482da291a8ebfc8 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Thu, 26 Sep 2024 06:21:53 -0400 Subject: [PATCH 7/8] Only enable feature in debug builds --- .../android/util/config/SelfHostedUsersFeatureConfig.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt index b33cd560c7e9..28fdd5770abf 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -15,4 +15,8 @@ class SelfHostedUsersFeatureConfig appConfig, BuildConfig.ENABLE_SELF_HOSTED_USERS, ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD -) +) { + override fun isEnabled(): Boolean { + return super.isEnabled() && BuildConfig.DEBUG + } +} From 526adb4527fbe3720d30a4a8a1abf16cbb3539b4 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Thu, 26 Sep 2024 13:03:14 -0400 Subject: [PATCH 8/8] Renamed val --- .../android/util/config/SelfHostedUsersFeatureConfig.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt index 28fdd5770abf..4e45eda1ba79 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/SelfHostedUsersFeatureConfig.kt @@ -7,14 +7,14 @@ import javax.inject.Inject /** * Configuration of the self-hosted users feature */ -private const val ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD = "enable_self_hosted_users" +private const val SELF_HOSTED_USERS_REMOTE_FIELD = "self_hosted_users" -@Feature(ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD, false) +@Feature(SELF_HOSTED_USERS_REMOTE_FIELD, false) class SelfHostedUsersFeatureConfig @Inject constructor(appConfig: AppConfig) : FeatureConfig( appConfig, BuildConfig.ENABLE_SELF_HOSTED_USERS, - ENABLE_SELF_HOSTED_USERS_REMOTE_FIELD + SELF_HOSTED_USERS_REMOTE_FIELD ) { override fun isEnabled(): Boolean { return super.isEnabled() && BuildConfig.DEBUG