Skip to content

Commit

Permalink
build(deps): Bump com.google.code.gson:gson from 2.11.0 to 2.12.0 (#2…
Browse files Browse the repository at this point in the history
…1643)

* build(deps): Bump com.google.code.gson:gson from 2.11.0 to 2.12.0

Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.11.0 to 2.12.0.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/main/CHANGELOG.md)
- [Commits](google/gson@gson-parent-2.11.0...gson-parent-2.12.0)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fixed checkResult warning due to not checking for null asJsonObject

* Fixed checkResult error: " The result of fromJson is not used"

* Simplified removeFontFamilies to resolve detekt nesting error

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nick Bradbury <[email protected]>
Co-authored-by: Nick Bradbury <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2025
1 parent 10d605c commit ee662ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ google-exoplayer = '2.13.3'
google-firebase-bom = '33.8.0'
google-firebase-iid = '21.1.0'
google-flexboxlayout = '3.0.0'
google-gson = '2.11.0'
google-gson = '2.12.0'
google-material = '1.12.0'
google-mlkit-barcode-scanning-common = '17.0.0'
google-mlkit-barcode-scanning-main = '17.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.google.gson.JsonSyntaxException
import com.google.gson.annotations.JsonAdapter
import com.google.gson.annotations.SerializedName
Expand Down Expand Up @@ -88,15 +89,12 @@ data class BlockEditorSettings(
get() = features?.removeFontFamilies()

private fun JsonElement.removeFontFamilies(): JsonElement {
if (isJsonObject && asJsonObject.has("typography")) {
val featuresObject = asJsonObject
val typography = featuresObject.get("typography")
if (typography.isJsonObject) {
val typographyObject = typography.asJsonObject
if (typographyObject.has("fontFamilies")) {
typographyObject.remove("fontFamilies")
return featuresObject
(this as? JsonObject)?.let { jsonObject ->
(jsonObject.get("typography") as? JsonObject)?.let { typography ->
if (typography.has("fontFamilies")) {
typography.remove("fontFamilies")
}
return jsonObject
}
}
return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public JsonObjectOrFalse deserialize(JsonElement json, Type typeOfT, JsonDeseria
}
Object elementToPrimitive = jsonPrimitiveToJavaPrimitive(field.getType(), element);

if (elementToPrimitive == null) {
gson.fromJson(element, field.getType());
} else {
if (elementToPrimitive != null) {
field.set(result, jsonPrimitiveToJavaPrimitive(field.getType(), element));
}
}
Expand Down

0 comments on commit ee662ea

Please sign in to comment.