Skip to content

Commit

Permalink
Enable add site menu using build config constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ashiagr committed Feb 10, 2022
1 parent 85f767f commit 200208f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ android {
buildConfigField "boolean", "COMMENTS_SNIPPET", "false"
buildConfigField "boolean", "READER_COMMENTS_MODERATION", "false"

// Override these constants in jetpack product flavor to enable/ disable features
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"

manifestPlaceholders = [magicLinkScheme:"wordpress"]
}

Expand Down Expand Up @@ -151,6 +154,7 @@ android {

applicationId "com.jetpack.android"
buildConfigField "boolean", "IS_JETPACK_APP", "true"
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
buildConfigField "String", "TRACKS_EVENT_PREFIX", '"jpandroid_"'
buildConfigField "String", "PUSH_NOTIFICATIONS_APP_KEY", '"com.jetpack.android"'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.wordpress.android.util.AccessibilityUtils;
import org.wordpress.android.util.ActivityUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.BuildConfigWrapper;
import org.wordpress.android.util.DeviceUtils;
import org.wordpress.android.util.NetworkUtils;
import org.wordpress.android.util.SiteUtils;
Expand Down Expand Up @@ -116,6 +117,7 @@ public class SitePickerActivity extends LocaleAwareActivity
@Inject Dispatcher mDispatcher;
@Inject StatsStore mStatsStore;
@Inject ViewModelProvider.Factory mViewModelFactory;
@Inject BuildConfigWrapper mBuildConfigWrapper;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -241,7 +243,7 @@ private void updateMenuItemVisibility() {
} else {
// don't allow editing visibility unless there are multiple wp.com and jetpack sites
mMenuEdit.setVisible(mSiteStore.getSitesAccessedViaWPComRestCount() > 1);
mMenuAdd.setVisible(true);
mMenuAdd.setVisible(mBuildConfigWrapper.isSiteCreationEnabled());
}

// no point showing search if there aren't multiple blogs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ class BuildConfigWrapper @Inject constructor() {
fun isDebugSettingsEnabled(): Boolean = BuildConfig.ENABLE_DEBUG_SETTINGS

val isJetpackApp = BuildConfig.IS_JETPACK_APP

val isSiteCreationEnabled = BuildConfig.ENABLE_SITE_CREATION
}

0 comments on commit 200208f

Please sign in to comment.