Merge branch 'posting_fix' into 'master'

Fix multi upload

See merge request pixeldroid/PixelDroid!300
This commit is contained in:
Matthieu 2021-01-25 18:00:18 +00:00
commit 6084ecda89
2 changed files with 7 additions and 3 deletions

View File

@ -284,7 +284,11 @@ class PostCreationActivity : BaseActivity() {
}
var postSub: Disposable? = null
val inter = pixelfedAPI.mediaUpload("Bearer $accessToken", data.imageDescription, requestBody.parts[0])
val description = data.imageDescription?.let { MultipartBody.Part.createFormData("description", it) }
val inter = pixelfedAPI.mediaUpload("Bearer $accessToken", description, requestBody.parts[0])
postSub = inter
.subscribeOn(Schedulers.io())
@ -302,7 +306,7 @@ class PostCreationActivity : BaseActivity() {
},
{
data.progress = 100
if(photoData.all{it.progress == 100}){
if(photoData.all{it.progress == 100 && it.uploadId != null}){
binding.uploadProgressBar.visibility = View.GONE
binding.uploadCompletedTextview.visibility = View.VISIBLE
post()

View File

@ -256,7 +256,7 @@ interface PixelfedAPI {
fun mediaUpload(
//The authorization header needs to be of the form "Bearer <token>"
@Header("Authorization") authorization: String,
@Part("description") description: String?,
@Part description: MultipartBody.Part? = null,
@Part file: MultipartBody.Part
): Observable<Attachment>