From 0653a69bbd9a1566a8ad3a281ec925771822772f Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 1 Mar 2024 10:39:32 -0500 Subject: [PATCH] Replaces deprecated put method --- .../amethyst/service/relays/JsonFilter.kt | 8 ++++---- .../amethyst/service/relays/Subscription.kt | 2 +- .../amethyst/service/relays/TypedFilter.kt | 12 ++++++------ .../java/com/vitorpamplona/quartz/events/Event.kt | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/relays/JsonFilter.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/relays/JsonFilter.kt index dc7d66d9b..eac7b0f8f 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/relays/JsonFilter.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/relays/JsonFilter.kt @@ -37,26 +37,26 @@ class JsonFilter( val filter = factory.objectNode().apply { ids?.run { - put( + replace( "ids", factory.arrayNode(ids.size).apply { ids.forEach { add(it) } }, ) } authors?.run { - put( + replace( "authors", factory.arrayNode(authors.size).apply { authors.forEach { add(it) } }, ) } kinds?.run { - put( + replace( "kinds", factory.arrayNode(kinds.size).apply { kinds.forEach { add(it) } }, ) } tags?.run { entries.forEach { kv -> - put( + replace( "#${kv.key}", factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } }, ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/relays/Subscription.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/relays/Subscription.kt index eefe41b99..9de8de758 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/relays/Subscription.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/relays/Subscription.kt @@ -47,7 +47,7 @@ data class Subscription( return factory.objectNode().apply { put("id", id) typedFilters?.also { filters -> - put( + replace( "typedFilters", factory.arrayNode(filters.size).apply { filters.forEach { filter -> add(filter.toJsonObject()) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/relays/TypedFilter.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/relays/TypedFilter.kt index 84ef11d26..ec3c9e05c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/relays/TypedFilter.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/relays/TypedFilter.kt @@ -36,8 +36,8 @@ class TypedFilter( val factory = Event.mapper.nodeFactory return factory.objectNode().apply { - put("types", typesToJson(types)) - put("filter", filterToJson(filter)) + replace("types", typesToJson(types)) + replace("filter", filterToJson(filter)) } } @@ -50,26 +50,26 @@ class TypedFilter( val factory = Event.mapper.nodeFactory return factory.objectNode().apply { filter.ids?.run { - put( + replace( "ids", factory.arrayNode(filter.ids.size).apply { filter.ids.forEach { add(it) } }, ) } filter.authors?.run { - put( + replace( "authors", factory.arrayNode(filter.authors.size).apply { filter.authors.forEach { add(it) } }, ) } filter.kinds?.run { - put( + replace( "kinds", factory.arrayNode(filter.kinds.size).apply { filter.kinds.forEach { add(it) } }, ) } filter.tags?.run { entries.forEach { kv -> - put( + replace( "#${kv.key}", factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } }, ) diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/events/Event.kt b/quartz/src/main/java/com/vitorpamplona/quartz/events/Event.kt index aba51ab92..1d8549679 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/events/Event.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/events/Event.kt @@ -386,7 +386,7 @@ open class Event( put("pubkey", pubKey) put("created_at", createdAt) put("kind", kind) - put( + replace( "tags", factory.arrayNode(tags.size).apply { tags.forEach { tag ->