Skip to content

Commit

Permalink
Merge pull request #2474 from wordpress-mobile/gutenberg/add-list-v2-…
Browse files Browse the repository at this point in the history
…flag

[Gutenberg] EditorTheme - Add List block V2 flag
  • Loading branch information
Gerardo Pacheco authored Aug 3, 2022
2 parents 6ba9b33 + 14e7476 commit b176f89
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const val MAP_KEY_ELEMENT_FEATURES: String = "rawFeatures"
const val MAP_KEY_IS_FSETHEME: String = "isFSETheme"
const val MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS: String = "galleryWithImageBlocks"
const val MAP_KEY_QUOTE_BLOCK_V2: String = "quoteBlockV2"
const val MAP_KEY_LIST_BLOCK_V2: String = "listBlockV2"

data class EditorTheme(
@SerializedName("theme_supports") val themeSupport: EditorThemeSupport,
Expand All @@ -36,7 +37,8 @@ data class EditorTheme(
blockEditorSettings.features?.toString(),
blockEditorSettings.isFSETheme,
blockEditorSettings.galleryWithImageBlocks,
blockEditorSettings.quoteBlockV2
blockEditorSettings.quoteBlockV2,
blockEditorSettings.listBlockV2
),
stylesheet = null,
version = null
Expand All @@ -52,6 +54,7 @@ data class EditorTheme(
element.isFSETheme = themeSupport.isFSETheme
element.galleryWithImageBlocks = themeSupport.galleryWithImageBlocks
element.quoteBlockV2 = themeSupport.quoteBlockV2
element.listBlockV2 = themeSupport.listBlockV2

return element
}
Expand All @@ -69,6 +72,7 @@ data class BlockEditorSettings(
@SerializedName("__unstableEnableFullSiteEditingBlocks") val isFSETheme: Boolean,
@SerializedName("__unstableGalleryWithImageBlocks") val galleryWithImageBlocks: Boolean,
@SerializedName("__experimentalEnableQuoteBlockV2") val quoteBlockV2: Boolean,
@SerializedName("__experimentalEnableListBlockV2") val listBlockV2: Boolean,
@SerializedName("__experimentalStyles") val styles: JsonElement?,
@SerializedName("__experimentalFeatures") val features: JsonElement?,
@JsonAdapter(EditorThemeElementListSerializer::class) val colors: List<EditorThemeElement>?,
Expand All @@ -86,7 +90,8 @@ data class EditorThemeSupport(
val rawFeatures: String?,
val isFSETheme: Boolean,
val galleryWithImageBlocks: Boolean,
val quoteBlockV2: Boolean
val quoteBlockV2: Boolean,
val listBlockV2: Boolean
) {
fun toBundle(): Bundle {
val bundle = Bundle()
Expand All @@ -110,6 +115,7 @@ data class EditorThemeSupport(
bundle.putBoolean(MAP_KEY_IS_FSETHEME, isFSETheme)
bundle.putBoolean(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS, galleryWithImageBlocks)
bundle.putBoolean(MAP_KEY_QUOTE_BLOCK_V2, quoteBlockV2)
bundle.putBoolean(MAP_KEY_LIST_BLOCK_V2, listBlockV2)

return bundle
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class EditorThemeSqlUtils {
set
@Column var galleryWithImageBlocks: Boolean = false
@Column var quoteBlockV2: Boolean = false
@Column var listBlockV2: Boolean = false

override fun setId(id: Int) {
this.mId = id
Expand Down Expand Up @@ -121,7 +122,8 @@ class EditorThemeSqlUtils {
rawFeatures,
isFSETheme,
galleryWithImageBlocks,
quoteBlockV2
quoteBlockV2,
listBlockV2
)

return EditorTheme(editorThemeSupport, stylesheet, version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ open class WellSqlConfig : DefaultWellConfig {
annotation class AddOn

override fun getDbVersion(): Int {
return 178
return 179
}

override fun getDbName(): String {
Expand Down Expand Up @@ -1876,6 +1876,9 @@ open class WellSqlConfig : DefaultWellConfig {
177 -> migrateAddOn(ADDON_WOOCOMMERCE, version) {
db.execSQL("ALTER TABLE WCSettingsModel ADD COUPONS_ENABLED BOOLEAN NOT NULL DEFAULT 0")
}
178 -> migrate(version) {
db.execSQL("ALTER TABLE EditorTheme ADD LIST_BLOCK_V2 BOOLEAN")
}
}
}
db.setTransactionSuccessful()
Expand Down

0 comments on commit b176f89

Please sign in to comment.