Skip to content

Commit

Permalink
fix(android): file picker result processing (#1352)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lucasfernog committed Sep 3, 2024
1 parent a67a818 commit 5cea504
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-android-file-picker-result.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixes Android file picker result processing.
3 changes: 1 addition & 2 deletions src/android/kotlin/RustWebChromeClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,7 @@ class RustWebChromeClient(appActivity: WryActivity) : WebChromeClient() {
override fun onActivityResult(result: ActivityResult?) {
val res: Array<Uri?>?
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) {
Expand Down

0 comments on commit 5cea504

Please sign in to comment.