Skip to content

Commit

Permalink
Merge pull request #58 from bmc08gt/patch-1
Browse files Browse the repository at this point in the history
chore(filepicker): trigger onResult when nothing selected on Android
  • Loading branch information
MohamedRejeb authored Feb 28, 2024
2 parents 9871e16 + 3d4fb6a commit d3e4e87
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private fun pickSingleVisualMedia(
contract = ActivityResultContracts.PickVisualMedia(),
onResult = { uri ->
val file = URIPathHelper.getPath(context, uri)?.let { File(it) }
file?.let { onResult(listOf(it)) }
file?.let { onResult(listOf(it)) } ?: onResult(emptyList())
}
)

Expand Down Expand Up @@ -136,7 +136,7 @@ private fun pickSingleFile(
contract = ActivityResultContracts.GetContent(),
onResult = { uri ->
val file = URIPathHelper.getPath(context, uri)?.let { File(it) }
file?.let { onResult(listOf(it)) }
file?.let { onResult(listOf(it)) } ?: onResult(emptyList())
}
)

Expand Down Expand Up @@ -201,7 +201,7 @@ private fun pickFolder(
Intent.FLAG_GRANT_READ_URI_PERMISSION
)
val file = URIPathHelper.getPath(context, uri)?.let { File(it) }
file?.let { onResult(listOf(it)) }
file?.let { onResult(listOf(it)) } ?: onResult(emptyList())
}
}
)
Expand Down Expand Up @@ -242,4 +242,4 @@ actual class FilePickerLauncher actual constructor(
actual fun launch() {
onLaunch()
}
}
}

0 comments on commit d3e4e87

Please sign in to comment.