mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 11:26:01 +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) {
|
override suspend fun updateAvatar(userId: String, newAvatarUri: Uri, fileName: String) {
|
||||||
withContext(coroutineDispatchers.main) {
|
withContext(coroutineDispatchers.io) {
|
||||||
val response = fileUploader.uploadFromUri(newAvatarUri, fileName, MimeTypes.Jpeg)
|
val response = fileUploader.uploadFromUri(newAvatarUri, fileName, MimeTypes.Jpeg)
|
||||||
setAvatarUrlTask.execute(SetAvatarUrlTask.Params(userId = userId, newAvatarUrl = response.contentUri))
|
setAvatarUrlTask.execute(SetAvatarUrlTask.Params(userId = userId, newAvatarUrl = response.contentUri))
|
||||||
userStore.updateAvatar(userId, response.contentUri)
|
userStore.updateAvatar(userId, response.contentUri)
|
||||||
|
|
Loading…
Reference in a new issue