Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Android browser component now works with multi-file selection. #3788

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7982,10 +7982,29 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_SELECT_FILE || requestCode == FILECHOOSER_RESULTCODE) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode == REQUEST_SELECT_FILE) {
if (uploadMessage == null) {
return;
if (uploadMessage == null) return;
Uri[] results = null;

// Check that the response is a good one
if (resultCode == Activity.RESULT_OK) {
if (intent != null) {
// If there is not data, then we may have taken a photo
String dataString = intent.getDataString();
ClipData clipData = intent.getClipData();

if (clipData != null) {
results = new Uri[clipData.getItemCount()];
for (int i = 0; i < clipData.getItemCount(); i++) {
ClipData.Item item = clipData.getItemAt(i);
results[i] = item.getUri();
}
} else if (dataString != null) {
results = new Uri[]{Uri.parse(dataString)};
}
}
}
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));

uploadMessage.onReceiveValue(results);
uploadMessage = null;
}
}
Expand Down
Loading