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

[stable-3.30] TextWebView: allow to upload multiple attachements #13682

Merged
merged 1 commit into from
Oct 2, 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 @@ -9,6 +9,7 @@

import android.app.DownloadManager;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -36,6 +37,7 @@
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.WebViewUtil;

import java.util.ArrayList;
import java.util.Optional;

import javax.inject.Inject;
Expand Down Expand Up @@ -200,7 +202,20 @@ protected void handleLocalFile(Intent data, int resultCode) {
return;
}

uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, data));
if (data.getClipData() == null) {
// one file
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, data));
} else {
ArrayList<Uri> uris = new ArrayList<>();
// multiple files
for (int i = 0; i < data.getClipData().getItemCount(); i++) {
ClipData.Item item = data.getClipData().getItemAt(i);
uris.add(item.getUri());
}

uploadMessage.onReceiveValue(uris.toArray(new Uri[0]));
}

uploadMessage = null;
}

Expand Down
Loading