mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
moving the updateAvatar work to the io dispatcher
- fixes some devices/OS's from attempting to run okhttp on the main thread
This commit is contained in:
parent
18b38fe21e
commit
7714445d24
1 changed files with 1 additions and 1 deletions
|
@ -68,7 +68,7 @@ internal class DefaultProfileService @Inject constructor(private val taskExecuto
|
|||
}
|
||||
|
||||
override suspend fun updateAvatar(userId: String, newAvatarUri: Uri, fileName: String) {
|
||||
withContext(coroutineDispatchers.main) {
|
||||
withContext(coroutineDispatchers.io) {
|
||||
val response = fileUploader.uploadFromUri(newAvatarUri, fileName, MimeTypes.Jpeg)
|
||||
setAvatarUrlTask.execute(SetAvatarUrlTask.Params(userId = userId, newAvatarUrl = response.contentUri))
|
||||
userStore.updateAvatar(userId, response.contentUri)
|
||||
|
|
Loading…
Reference in a new issue