Skip to content

Commit 4fd812d

Browse files
authored
Merge pull request #14926 from woocommerce/issue/woomob-1313-use-remote-feature-flag-for-local-catalog
Issue/woomob 1313 use remote feature flag for local catalog
2 parents ca6c55f + f20c973 commit 4fd812d

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package com.woocommerce.android.ui.woopos.featureflags
22

3-
import com.woocommerce.android.util.FeatureFlag
3+
import com.woocommerce.android.util.IsRemoteFeatureFlagEnabled
4+
import com.woocommerce.android.util.RemoteFeatureFlag.REMOTE_WOO_POS_LOCAL_CATALOG_M1
45
import javax.inject.Inject
56

67
@Suppress("unused")
7-
class WooPosLocalCatalogM1Enabled @Inject constructor() {
8-
operator fun invoke(): Boolean {
9-
return FeatureFlag.WOO_POS_LOCAL_CATALOG_M1.isEnabled()
8+
class WooPosLocalCatalogM1Enabled @Inject constructor(
9+
private val isRemoteFeatureFlagEnabled: IsRemoteFeatureFlagEnabled
10+
) {
11+
suspend operator fun invoke(): Boolean {
12+
return isRemoteFeatureFlagEnabled(REMOTE_WOO_POS_LOCAL_CATALOG_M1)
1013
}
1114
}

WooCommerce/src/main/kotlin/com/woocommerce/android/util/FeatureFlag.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ enum class FeatureFlag {
1010
WC_SHIPPING_BANNER,
1111
BETTER_CUSTOMER_SEARCH_M2,
1212
ORDER_CREATION_AUTO_TAX_RATE,
13-
WOO_POS_LOCAL_CATALOG_M1,
1413
BOOKINGS_MVP;
1514

1615
fun isEnabled(context: Context? = null): Boolean {
@@ -22,7 +21,6 @@ enum class FeatureFlag {
2221
WC_SHIPPING_BANNER,
2322
BETTER_CUSTOMER_SEARCH_M2,
2423
ORDER_CREATION_AUTO_TAX_RATE,
25-
WOO_POS_LOCAL_CATALOG_M1,
2624
BOOKINGS_MVP -> PackageUtils.isDebugBuild()
2725
}
2826
}

WooCommerce/src/main/kotlin/com/woocommerce/android/util/IsRemoteFeatureFlagEnabled.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.woocommerce.android.util.RemoteFeatureFlag.APP_PASSWORDS_FOR_JETPACK_
55
import com.woocommerce.android.util.RemoteFeatureFlag.LOCAL_NOTIFICATION_1D_AFTER_FREE_TRIAL_EXPIRES
66
import com.woocommerce.android.util.RemoteFeatureFlag.LOCAL_NOTIFICATION_1D_BEFORE_FREE_TRIAL_EXPIRES
77
import com.woocommerce.android.util.RemoteFeatureFlag.LOCAL_NOTIFICATION_STORE_CREATION_READY
8+
import com.woocommerce.android.util.RemoteFeatureFlag.REMOTE_WOO_POS_LOCAL_CATALOG_M1
89
import com.woocommerce.android.util.RemoteFeatureFlag.WOO_POS
910
import javax.inject.Inject
1011

@@ -17,6 +18,7 @@ class IsRemoteFeatureFlagEnabled @Inject constructor(
1718
LOCAL_NOTIFICATION_1D_BEFORE_FREE_TRIAL_EXPIRES,
1819
LOCAL_NOTIFICATION_1D_AFTER_FREE_TRIAL_EXPIRES,
1920
WOO_POS,
21+
REMOTE_WOO_POS_LOCAL_CATALOG_M1,
2022
APP_PASSWORDS_FOR_JETPACK_SITES ->
2123
PackageUtils.isDebugBuild() ||
2224
wpComRemoteFeatureFlagRepository.isRemoteFeatureFlagEnabled(featureFlag.remoteKey)

WooCommerce/src/main/kotlin/com/woocommerce/android/util/RemoteFeatureFlag.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ enum class RemoteFeatureFlag(val remoteKey: String) {
55
LOCAL_NOTIFICATION_1D_BEFORE_FREE_TRIAL_EXPIRES("woo_notification_1d_before_free_trial_expires"),
66
LOCAL_NOTIFICATION_1D_AFTER_FREE_TRIAL_EXPIRES("woo_notification_1d_after_free_trial_expires"),
77
WOO_POS("woo_pos"),
8-
APP_PASSWORDS_FOR_JETPACK_SITES("woo_app_passwords_for_jetpack_sites")
8+
APP_PASSWORDS_FOR_JETPACK_SITES("woo_app_passwords_for_jetpack_sites"),
9+
REMOTE_WOO_POS_LOCAL_CATALOG_M1("woo_pos_local_catalog_m1"),
910
}

0 commit comments

Comments
 (0)