diff --git a/WordPress/src/main/java/org/wordpress/android/WordPressDB.java b/WordPress/src/main/java/org/wordpress/android/WordPressDB.java index cdd5a69209f9..1b5e7f751d83 100755 --- a/WordPress/src/main/java/org/wordpress/android/WordPressDB.java +++ b/WordPress/src/main/java/org/wordpress/android/WordPressDB.java @@ -22,7 +22,7 @@ import java.io.OutputStream; public class WordPressDB { - private static final int DATABASE_VERSION = 69; + private static final int DATABASE_VERSION = 70; // Warning renaming DATABASE_NAME could break previous App backups (see: xml/backup_scheme.xml) @@ -184,6 +184,9 @@ public WordPressDB(Context ctx) { // so the table creation depended on that screen being opened. Now that we need this table in other // places, we have to be sure the table exists even if PublicizeListActivity was never opened. PublicizeTable.createTables(mDb); + case 69: + // add editor theme styles site setting + mDb.execSQL(SiteSettingsModel.ADD_USE_THEME_STYLES); } mDb.setVersion(DATABASE_VERSION); } diff --git a/WordPress/src/main/java/org/wordpress/android/models/SiteSettingsModel.java b/WordPress/src/main/java/org/wordpress/android/models/SiteSettingsModel.java index 7d47715cf0a5..106d1a3a7473 100644 --- a/WordPress/src/main/java/org/wordpress/android/models/SiteSettingsModel.java +++ b/WordPress/src/main/java/org/wordpress/android/models/SiteSettingsModel.java @@ -69,6 +69,7 @@ public class SiteSettingsModel { private static final String AMP_ENABLED_COLUMN_NAME = "ampEnabled"; private static final String JETPACK_SEARCH_SUPPORTED_COLUMN_NAME = "jetpackSearchSupported"; private static final String JETPACK_SEARCH_ENABLED_COLUMN_NAME = "jetpackSearchEnabled"; + private static final String USE_THEME_STYLES_COLUMN_NAME = "useThemeStyles"; public static final String SETTINGS_TABLE_NAME = "site_settings"; @@ -104,6 +105,8 @@ public class SiteSettingsModel { + " add " + JETPACK_SEARCH_SUPPORTED_COLUMN_NAME + " BOOLEAN;"; public static final String ADD_SITE_ICON = "alter table " + SETTINGS_TABLE_NAME + " add " + SITE_ICON_COLUMN_NAME + " INTEGER;"; + public static final String ADD_USE_THEME_STYLES = "alter table " + SETTINGS_TABLE_NAME + + " add " + USE_THEME_STYLES_COLUMN_NAME + " BOOLEAN DEFAULT 1;"; public static final String CREATE_SETTINGS_TABLE_SQL = "CREATE TABLE IF NOT EXISTS " @@ -194,6 +197,7 @@ public class SiteSettingsModel { public boolean ampEnabled; public boolean jetpackSearchSupported; public boolean jetpackSearchEnabled; + public boolean useThemeStyles = true; public String quotaDiskSpace; @Override @@ -238,6 +242,7 @@ && equals(timezone, otherModel.timezone) && ampSupported == otherModel.ampSupported && jetpackSearchEnabled == otherModel.jetpackSearchEnabled && jetpackSearchSupported == otherModel.jetpackSearchSupported + && useThemeStyles == otherModel.useThemeStyles && maxLinks == otherModel.maxLinks && equals(defaultPostFormat, otherModel.defaultPostFormat) && holdForModeration != null @@ -303,6 +308,7 @@ public void copyFrom(SiteSettingsModel other) { ampEnabled = other.ampEnabled; jetpackSearchSupported = other.jetpackSearchSupported; jetpackSearchEnabled = other.jetpackSearchEnabled; + useThemeStyles = other.useThemeStyles; if (other.holdForModeration != null) { holdForModeration = new ArrayList<>(other.holdForModeration); } @@ -367,6 +373,7 @@ public void deserializeOptionsDatabaseCursor(Cursor cursor, SparseArrayCompatwp_pref_site_default_image_quality wp_pref_key_optimize_video wp_pref_key_gutenberg_default_for_new_posts + wp_pref_key_use_theme_styles wp_pref_site_default_video_width wp_pref_site_default_encoder_bitrate wp_pref_site_discussion diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 7da1edbadeb8..dd506731f4ce 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -702,6 +702,8 @@ Your WordPress.com site supports the use of Accelerated Mobile Pages, a Google-led initiative that dramatically speeds up loading times on mobile devices Use Block Editor Edit new posts and pages with the block editor + Use Theme Styles + Make the block editor look like your theme Password updated To reconnect the app to your self-hosted site, enter the site\'s new password here. Homepage Settings @@ -971,8 +973,6 @@ Experimental block editor will become the default in a future release and the ability to disable it will be removed. Experimental block editor Access additional block types and settings - Experimental block editor styles - Apply theme styles to the editor Experimental block editor plugins Share feedback Are you willing to share feedback on the experimental editor? diff --git a/WordPress/src/main/res/xml/site_settings.xml b/WordPress/src/main/res/xml/site_settings.xml index e86f76632c9a..58339f49b6bb 100644 --- a/WordPress/src/main/res/xml/site_settings.xml +++ b/WordPress/src/main/res/xml/site_settings.xml @@ -132,6 +132,12 @@ android:summary="@string/site_settings_gutenberg_default_for_new_posts_summary" android:title="@string/site_settings_gutenberg_default_for_new_posts" /> + + diff --git a/WordPress/src/test/java/org/wordpress/android/ui/prefs/experimentalfeatures/ExperimentalFeaturesViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/prefs/experimentalfeatures/ExperimentalFeaturesViewModelTest.kt index f56546c04cd4..e07435afedd9 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/prefs/experimentalfeatures/ExperimentalFeaturesViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/prefs/experimentalfeatures/ExperimentalFeaturesViewModelTest.kt @@ -69,14 +69,12 @@ class ExperimentalFeaturesViewModelTest : BaseUnitTest() { @Test fun `init loads enabled state from experimental features`() = test { whenever(experimentalFeatures.isEnabled(Feature.EXPERIMENTAL_BLOCK_EDITOR)).thenReturn(true) - whenever(experimentalFeatures.isEnabled(Feature.EXPERIMENTAL_BLOCK_EDITOR_THEME_STYLES)).thenReturn(false) createViewModel() val states = viewModel.switchStates.value assertThat(states[Feature.EXPERIMENTAL_BLOCK_EDITOR]).isTrue() - assertThat(states[Feature.EXPERIMENTAL_BLOCK_EDITOR_THEME_STYLES]).isFalse() } @Test @@ -145,7 +143,6 @@ class ExperimentalFeaturesViewModelTest : BaseUnitTest() { @Test fun `state flow emits correct initial state`() = test { whenever(experimentalFeatures.isEnabled(Feature.EXPERIMENTAL_BLOCK_EDITOR)).thenReturn(true) - whenever(experimentalFeatures.isEnabled(Feature.EXPERIMENTAL_BLOCK_EDITOR_THEME_STYLES)).thenReturn(false) createViewModel()