Fix key name to upload conversation avatars

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-04-24 12:43:38 +02:00
parent fdb845d298
commit 0063fa8c10
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 6 additions and 9 deletions

View File

@ -230,12 +230,12 @@ class ConversationInfoActivity :
val builder = MultipartBody.Builder() val builder = MultipartBody.Builder()
builder.setType(MultipartBody.FORM) builder.setType(MultipartBody.FORM)
builder.addFormDataPart( builder.addFormDataPart(
"files[]", "file",
file!!.name, file!!.name,
file.asRequestBody(Mimetype.IMAGE_PREFIX_GENERIC.toMediaTypeOrNull()) file.asRequestBody(Mimetype.IMAGE_PREFIX_GENERIC.toMediaTypeOrNull())
) )
val filePart: MultipartBody.Part = MultipartBody.Part.createFormData( val filePart: MultipartBody.Part = MultipartBody.Part.createFormData(
"files[]", "file",
file.name, file.name,
file.asRequestBody(Mimetype.IMAGE_JPG.toMediaTypeOrNull()) file.asRequestBody(Mimetype.IMAGE_JPG.toMediaTypeOrNull())
) )
@ -243,7 +243,7 @@ class ConversationInfoActivity :
// upload file // upload file
ncApi.uploadAvatar( ncApi.uploadAvatar(
ApiUtils.getCredentials(conversationUser.username, conversationUser.token), ApiUtils.getCredentials(conversationUser.username, conversationUser.token),
ApiUtils.getUrlForConversationAvatar(1,conversationUser.baseUrl, conversation!!.token), ApiUtils.getUrlForConversationAvatar(1, conversationUser.baseUrl, conversation!!.token),
filePart filePart
) )
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -261,8 +261,7 @@ class ConversationInfoActivity :
Toast.makeText( Toast.makeText(
applicationContext, applicationContext,
context.getString(R.string.default_error_msg), context.getString(R.string.default_error_msg),
Toast Toast.LENGTH_LONG
.LENGTH_LONG
).show() ).show()
Log.e(TAG, "Error uploading avatar", e) Log.e(TAG, "Error uploading avatar", e)
} }

View File

@ -162,10 +162,8 @@ class PickImage(
if (resultCode != Activity.RESULT_OK) { if (resultCode != Activity.RESULT_OK) {
Log.w( Log.w(
TAG, TAG,
"Check result code before calling 'PickImage#handleActivtyResult'. It should be ${ "Check result code before calling " +
Activity "'PickImage#handleActivtyResult'. It should be ${Activity.RESULT_OK}, but it is $resultCode!"
.RESULT_OK
}, but it is $resultCode!"
) )
return return
} }