Skip to content

Commit

Permalink
Merge pull request #13682 from nextcloud/backport/13546/stable-3.30
Browse files Browse the repository at this point in the history
[stable-3.30] TextWebView: allow to upload multiple attachements
  • Loading branch information
alperozturk96 authored Oct 2, 2024
2 parents ea19c02 + daffe17 commit 7005ee0
Showing 1 changed file with 16 additions and 1 deletion.
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

0 comments on commit 7005ee0

Please sign in to comment.