-
Notifications
You must be signed in to change notification settings - Fork 732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Create private room] Picture doesn't not displayed #5405
Changes from 1 commit
c8d1ca2
d873fe0
363ecc2
8a1c11b
51e292b
efe413f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[Create room] Picture doesn't not displayed | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ import androidx.lifecycle.LiveData | |
import dagger.assisted.Assisted | ||
import dagger.assisted.AssistedFactory | ||
import dagger.assisted.AssistedInject | ||
import kotlinx.coroutines.withContext | ||
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers | ||
import org.matrix.android.sdk.api.query.QueryStringValue | ||
import org.matrix.android.sdk.api.session.events.model.Event | ||
import org.matrix.android.sdk.api.session.events.model.EventType | ||
|
@@ -42,8 +44,9 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private | |
private val stateEventDataSource: StateEventDataSource, | ||
private val sendStateTask: SendStateTask, | ||
private val fileUploader: FileUploader, | ||
private val viaParameterFinder: ViaParameterFinder | ||
) : StateService { | ||
private val viaParameterFinder: ViaParameterFinder, | ||
private val coroutineDispatchers: MatrixCoroutineDispatchers, | ||
) : StateService { | ||
|
||
@AssistedFactory | ||
interface Factory { | ||
|
@@ -155,12 +158,14 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private | |
} | ||
|
||
override suspend fun updateAvatar(avatarUri: Uri, fileName: String) { | ||
val response = fileUploader.uploadFromUri(avatarUri, fileName, MimeTypes.Jpeg) | ||
sendStateEvent( | ||
eventType = EventType.STATE_ROOM_AVATAR, | ||
body = mapOf("url" to response.contentUri), | ||
stateKey = "" | ||
) | ||
withContext(coroutineDispatchers.io) { | ||
val response = fileUploader.uploadFromUri(avatarUri, fileName, MimeTypes.Jpeg) | ||
sendStateEvent( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this could stay outside of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is used when we update the picture in the room settings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If i put the with(coroutineDispatchers.io) in here it's working too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, so please do it, it will be cleaner. Thanks! |
||
eventType = EventType.STATE_ROOM_AVATAR, | ||
body = mapOf("url" to response.contentUri), | ||
stateKey = "" | ||
) | ||
} | ||
} | ||
|
||
override suspend fun deleteAvatar() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.