I am uploading a dynamic number of files in a single multipart request using Retrofit2. My retrofit interface looks like this -
public interface FileUploadService {
@Multipart
@POST("upload")
Call<ResponseBody> uploadMultipleFilesDynamic(
@Part List<MultipartBody.Part> files);
}
Now I want to track progress for this multi-file upload. This solution explains how to get progress while uploading a single file in a multipart request by extending RequestBody. Though I can't seem to comprehend how to apply this for my multiple files request. One solution I could think of was to create ProgressRequestBody by extending OkHTTP MultipartBody class instead of RequestBody but OkHTTP3 implements MultipartBody as a final class making it impossible to extend. Can anyone point me in the right direction as it's a huge blocker for me to not be able to show the progress to the user for files upload. Or are there any work arounds that I can implement to achieve this functionality?