From 5cea5045c9e646ace1f94767d91b746c2afd3c14 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 2 Sep 2024 23:21:35 -0300 Subject: [PATCH] fix(android): file picker result processing (#1352) The Android file picker result callback implementation is incorrectly checking the expected minimum result length. This only impacts usage on SDK 34+ because on older releases the `FileChooserParams.parseResult` properly resolves the response. --- .changes/fix-android-file-picker-result.md | 5 +++++ src/android/kotlin/RustWebChromeClient.kt | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-android-file-picker-result.md diff --git a/.changes/fix-android-file-picker-result.md b/.changes/fix-android-file-picker-result.md new file mode 100644 index 000000000..2c39123ca --- /dev/null +++ b/.changes/fix-android-file-picker-result.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Fixes Android file picker result processing. diff --git a/src/android/kotlin/RustWebChromeClient.kt b/src/android/kotlin/RustWebChromeClient.kt index 981a4838d..b89192602 100644 --- a/src/android/kotlin/RustWebChromeClient.kt +++ b/src/android/kotlin/RustWebChromeClient.kt @@ -391,8 +391,7 @@ class RustWebChromeClient(appActivity: WryActivity) : WebChromeClient() { override fun onActivityResult(result: ActivityResult?) { val res: Array? val resultIntent = result?.data - if (result?.resultCode == Activity.RESULT_OK && resultIntent!!.clipData != null && resultIntent.clipData!!.itemCount > 1 - ) { + if (result?.resultCode == Activity.RESULT_OK && resultIntent!!.clipData != null) { val numFiles = resultIntent.clipData!!.itemCount res = arrayOfNulls(numFiles) for (i in 0 until numFiles) {