Skip to content

Commit

Permalink
Merge pull request #17285 from wordpress-mobile/fix/add-feature-flag-…
Browse files Browse the repository at this point in the history
…shared-login-provider

[Fix] [Shared login] Add feature flag to SharedLoginProvider
  • Loading branch information
RenanLukas authored Oct 10, 2022
2 parents c41ad3a + 08f12e6 commit 6fb9138
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ android {
buildConfigField "boolean", "JETPACK_POWERED_BOTTOM_SHEET", "false"
buildConfigField "boolean", "JETPACK_SHARED_LOGIN", "false"
buildConfigField "boolean", "JETPACK_LOCAL_USER_FLAGS", "false"
buildConfigField "boolean", "JETPACK_PROVIDER_SYNC", "false"

// Override these constants in jetpack product flavor to enable/ disable features
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.wordpress.android.fluxc.store.AccountStore
import org.wordpress.android.provider.query.QueryContentProvider
import org.wordpress.android.provider.query.QueryResult
import org.wordpress.android.sharedlogin.data.JetpackPublicData
import org.wordpress.android.util.config.JetpackProviderSyncFeatureConfig
import org.wordpress.android.util.signature.SignatureNotFoundException
import org.wordpress.android.util.signature.SignatureUtils
import javax.inject.Inject
Expand All @@ -16,6 +17,7 @@ class SharedLoginProvider : QueryContentProvider() {
@Inject lateinit var signatureUtils: SignatureUtils
@Inject lateinit var queryResult: QueryResult
@Inject lateinit var jetpackPublicData: JetpackPublicData
@Inject lateinit var jetpackProviderSyncFeatureConfig: JetpackProviderSyncFeatureConfig

override fun onCreate(): Boolean {
return true
Expand All @@ -30,6 +32,9 @@ class SharedLoginProvider : QueryContentProvider() {
sortOrder: String?
): Cursor? {
inject()
if (!jetpackProviderSyncFeatureConfig.isEnabled()) {
return null
}
return context?.let {
try {
val callerPackageId = callingPackage
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.wordpress.android.util.config

import org.wordpress.android.BuildConfig
import org.wordpress.android.annotation.Feature
import org.wordpress.android.util.config.JetpackProviderSyncFeatureConfig.Companion.JETPACK_PROVIDER_SYNC_REMOTE_FIELD
import javax.inject.Inject

@Feature(JETPACK_PROVIDER_SYNC_REMOTE_FIELD, false)
class JetpackProviderSyncFeatureConfig
@Inject constructor(
appConfig: AppConfig
) : FeatureConfig(
appConfig,
BuildConfig.JETPACK_PROVIDER_SYNC,
JETPACK_PROVIDER_SYNC_REMOTE_FIELD
) {
companion object {
const val JETPACK_PROVIDER_SYNC_REMOTE_FIELD = "provider_sync_remote_field"
}
}

0 comments on commit 6fb9138

Please sign in to comment.