Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ android {
buildConfigField "boolean", "ENABLE_FEATURE_CONFIGURATION", "true"
buildConfigField "boolean", "MY_SITE_IMPROVEMENTS", "false"
buildConfigField "boolean", "SEEN_UNSEEN_WITH_COUNTER", "false"
buildConfigField "boolean", "CONTACT_INFO_BLOCK_AVAILABLE", "true"
buildConfigField "boolean", "LIKES_ENHANCEMENTS", "false"
}

Expand All @@ -99,6 +100,7 @@ android {
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "false"
buildConfigField "long", "REMOTE_CONFIG_FETCH_INTERVAL", "3600"
buildConfigField "boolean", "ENABLE_FEATURE_CONFIGURATION", "false"
buildConfigField "boolean", "CONTACT_INFO_BLOCK_AVAILABLE", "false"
}

zalpha { // alpha version - enable experimental features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils.BlockEditorEnabledSource;
import org.wordpress.android.util.config.ContactInfoBlockFeatureConfig;
import org.wordpress.android.util.helpers.MediaFile;
import org.wordpress.android.util.helpers.MediaGallery;
import org.wordpress.android.util.image.ImageManager;
Expand Down Expand Up @@ -399,6 +400,7 @@ enum RestartEditorOptions {
@Inject LoadStoryFromStoriesPrefsUseCase mLoadStoryFromStoriesPrefsUseCase;
@Inject StoriesPrefs mStoriesPrefs;
@Inject StoriesEventListener mStoriesEventListener;
@Inject ContactInfoBlockFeatureConfig mContactInfoBlockFeatureConfig;

private StorePostViewModel mViewModel;

Expand Down Expand Up @@ -2270,6 +2272,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() {
boolean isFreeWPCom = mSite.isWPCom() && SiteUtils.onFreePlan(mSite);

return new GutenbergPropsBuilder(
mContactInfoBlockFeatureConfig.isEnabled() && SiteUtils.supportsContactInfoFeature(mSite),
SiteUtils.supportsStoriesFeature(mSite),
mSite.isUsingWpComRestApi(),
enableXPosts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class SiteUtils {
public static final String AZTEC_EDITOR_NAME = "aztec";
public static final String WP_STORIES_CREATOR_NAME = "wp_stories_creator";
public static final String WP_STORIES_JETPACK_VERSION = "9.1";
public static final String WP_CONTACT_INFO_JETPACK_VERSION = "8.5";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @illusaen or @mzorz I have a question about the Jetpack version. I am looking at the release notes above and it specifies that the contact info block works on WP.com site and sites with JetPack 9.1 and above. But this value is 8.5 so I am just checking if this is expected i.e I am checking to see if these versions should be the same or not. Thanks 🙇

Copy link
Contributor Author

@mzorz mzorz Jan 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation @jd-alexander ! My findings tell me the first version of Jetpack shipping with that block was 8.5, so the release notes should be updated accordingly 👍 @illusaen do you want to update it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also another question @mzorz should the block be tested with vanilla debug or vanilla release ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both should work as long as it's vanilla - I tested vanillaDebug only but it should be the same (the productFlavors work this way)

private static final int GB_ROLLOUT_PERCENTAGE_PHASE_1 = 100;
private static final int GB_ROLLOUT_PERCENTAGE_PHASE_2 = 100;

Expand Down Expand Up @@ -345,6 +346,10 @@ public static boolean supportsStoriesFeature(SiteModel site) {
return site != null && (site.isWPCom() || checkMinimalJetpackVersion(site, WP_STORIES_JETPACK_VERSION));
}

public static boolean supportsContactInfoFeature(SiteModel site) {
return site != null & (site.isWPCom() || checkMinimalJetpackVersion(site, WP_CONTACT_INFO_JETPACK_VERSION));
}

public static boolean isNonAtomicBusinessPlanSite(@Nullable SiteModel site) {
return site != null && !site.isAutomatedTransfer() && SiteUtils.hasNonJetpackBusinessPlan(site);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.wordpress.android.util.config

import org.wordpress.android.BuildConfig
import org.wordpress.android.annotation.FeatureInDevelopment
import javax.inject.Inject

@FeatureInDevelopment
class ContactInfoBlockFeatureConfig
@Inject constructor(appConfig: AppConfig) : FeatureConfig(appConfig, BuildConfig.CONTACT_INFO_BLOCK_AVAILABLE)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.wordpress.mobile.WPAndroidGlue.GutenbergProps

@Parcelize
data class GutenbergPropsBuilder(
private val enableContactInfoBlock: Boolean,
private val enableMediaFilesCollectionBlocks: Boolean,
private val enableMentions: Boolean,
private val enableXPosts: Boolean,
Expand All @@ -19,7 +20,7 @@ data class GutenbergPropsBuilder(
private val editorTheme: Bundle?
) : Parcelable {
fun build(activity: Activity, isHtmlModeEnabled: Boolean) = GutenbergProps(
enableContactInfoBlock = false,
enableContactInfoBlock = enableContactInfoBlock,
enableMediaFilesCollectionBlocks = enableMediaFilesCollectionBlocks,
enableMentions = enableMentions,
enableXPosts = enableXPosts,
Expand Down