Skip to content

Commit 006d592

Browse files
authored
fix(core): parse Android plugin args starting with is, closes #14254 (#14260)
by default Jackson treats the `isX` as a getter, so it looks for the `x` key in the JSON. To match behavior on other platforms we now configure Jackson to treat it as the field name itself.
1 parent d293848 commit 006d592

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Properly deserialize Android plugin args with key starting with `is` (previously treated as a getter instead of a field name).

crates/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import app.tauri.annotation.InvokeArg
1717
import app.tauri.FsUtils
1818
import app.tauri.JniMethod
1919
import app.tauri.Logger
20+
import com.fasterxml.jackson.annotation.JsonAutoDetect
21+
import com.fasterxml.jackson.annotation.PropertyAccessor
2022
import com.fasterxml.jackson.databind.DeserializationFeature
2123
import com.fasterxml.jackson.databind.JsonNode
2224
import com.fasterxml.jackson.databind.ObjectMapper
@@ -69,6 +71,7 @@ class PluginManager(val activity: AppCompatActivity) {
6971
jsonMapper = ObjectMapper()
7072
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
7173
.enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
74+
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
7275

7376
val channelDeserializer = ChannelDeserializer({ channelId, payload ->
7477
sendChannelData(channelId, payload)

0 commit comments

Comments
 (0)