Skip to content

Commit 692f475

Browse files
Merge pull request #12640 from woocommerce/issue/12146-enable-for-jetpack-plugin
Issue/12146 enable for jetpack plugin
2 parents b07aafb + 8267e2b commit 692f475

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
-----
77
- [*] Fixes a bug that prevented users to rename the Product Variation Attributes to because of case insensitive checks [https://github.com/woocommerce/woocommerce-android/pull/12608]
88
- [*] Users can directly pick product images when creating Blaze ads [https://github.com/woocommerce/woocommerce-android/pull/12610]
9+
- [*] Enables Blaze feature for sites with Blaze for WooCommerce plugin installed and active [https://github.com/woocommerce/woocommerce-android/pull/12640]
910
- [*] Fix for ConcurrentModificationException while removing notification [https://github.com/woocommerce/woocommerce-android/pull/12646]
1011

1112
20.4
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
package com.woocommerce.android.ui.blaze
22

33
import com.woocommerce.android.tools.SelectedSite
4-
import com.woocommerce.android.tools.SiteConnectionType
4+
import com.woocommerce.android.tools.SiteConnectionType.Jetpack
55
import com.woocommerce.android.util.IsRemoteFeatureFlagEnabled
66
import com.woocommerce.android.util.RemoteFeatureFlag.WOO_BLAZE
77
import javax.inject.Inject
88

99
class IsBlazeEnabled @Inject constructor(
1010
private val selectedSite: SelectedSite,
11-
private val isRemoteFeatureFlagEnabled: IsRemoteFeatureFlagEnabled,
11+
private val isRemoteFeatureFlagEnabled: IsRemoteFeatureFlagEnabled
1212
) {
13+
companion object {
14+
private const val BLAZE_FOR_WOOCOMMERCE_PLUGIN_SLUG = "blaze-ads"
15+
}
16+
1317
suspend operator fun invoke(): Boolean = selectedSite.getIfExists()?.isAdmin ?: false &&
14-
selectedSite.connectionType == SiteConnectionType.Jetpack &&
18+
hasAValidJetpackConnectionForBlaze() &&
1519
selectedSite.getIfExists()?.canBlaze ?: false &&
1620
isRemoteFeatureFlagEnabled(WOO_BLAZE)
21+
22+
/**
23+
* In order for Blaze to work, the site requires the Jetpack Sync module to be enabled. This means not all
24+
* Jetpack connection will work. For now, Blaze will only be enabled for sites with Jetpack plugin installed and
25+
* active, or for sites with Blaze for WooCommerce plugin installed and connected.
26+
*/
27+
private fun hasAValidJetpackConnectionForBlaze() =
28+
selectedSite.connectionType == Jetpack || isBlazeForWooCommercePluginActive()
29+
30+
private fun isBlazeForWooCommercePluginActive(): Boolean =
31+
selectedSite.get().activeJetpackConnectionPlugins?.contains(BLAZE_FOR_WOOCOMMERCE_PLUGIN_SLUG) == true
1732
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ tasks.register("installGitHooks", Copy) {
100100
}
101101

102102
ext {
103-
fluxCVersion = '2.96.0'
103+
fluxCVersion = 'trunk-b96c0d2e70b1a2975ef8dce322f37a9ee4a60891'
104104
glideVersion = '4.16.0'
105105
coilVersion = '2.1.0'
106106
constraintLayoutVersion = '1.2.0'

0 commit comments

Comments
 (0)