mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 12:00:03 +03:00
Merge pull request #2368 from vector-im/feature/bma/fix_discard
Feature/bma/fix discard
This commit is contained in:
commit
ae3e1f3a9f
3 changed files with 21 additions and 16 deletions
|
@ -8,7 +8,8 @@ Improvements 🙌:
|
|||
- Open an existing DM instead of creating a new one (#2319)
|
||||
|
||||
Bugfix 🐛:
|
||||
- Fix issue when updating the avatar of a room
|
||||
- Fix issue when updating the avatar of a room (new avatar vanishing)
|
||||
- Discard change dialog displayed by mistake when avatar has been updated
|
||||
|
||||
Translations 🗣:
|
||||
-
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.matrix.android.sdk.internal.task.TaskExecutor
|
|||
import org.matrix.android.sdk.internal.task.configureWith
|
||||
import org.matrix.android.sdk.internal.task.launchToCallback
|
||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||
|
||||
internal class DefaultStateService @AssistedInject constructor(@Assisted private val roomId: String,
|
||||
private val stateEventDataSource: StateEventDataSource,
|
||||
|
@ -132,23 +133,23 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
|
|||
override fun updateAvatar(avatarUri: Uri, fileName: String, callback: MatrixCallback<Unit>): Cancelable {
|
||||
return taskExecutor.executorScope.launchToCallback(coroutineDispatchers.main, callback) {
|
||||
val response = fileUploader.uploadFromUri(avatarUri, fileName, "image/jpeg")
|
||||
sendStateEvent(
|
||||
eventType = EventType.STATE_ROOM_AVATAR,
|
||||
body = mapOf("url" to response.contentUri),
|
||||
callback = callback,
|
||||
stateKey = null
|
||||
)
|
||||
awaitCallback<Unit> {
|
||||
sendStateEvent(
|
||||
eventType = EventType.STATE_ROOM_AVATAR,
|
||||
body = mapOf("url" to response.contentUri),
|
||||
callback = it,
|
||||
stateKey = null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun deleteAvatar(callback: MatrixCallback<Unit>): Cancelable {
|
||||
return taskExecutor.executorScope.launchToCallback(coroutineDispatchers.main, callback) {
|
||||
sendStateEvent(
|
||||
eventType = EventType.STATE_ROOM_AVATAR,
|
||||
body = emptyMap(),
|
||||
callback = callback,
|
||||
stateKey = null
|
||||
)
|
||||
}
|
||||
return sendStateEvent(
|
||||
eventType = EventType.STATE_ROOM_AVATAR,
|
||||
body = emptyMap(),
|
||||
callback = callback,
|
||||
stateKey = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,7 +211,10 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState:
|
|||
postLoading(false)
|
||||
setState {
|
||||
deletePendingAvatar(this)
|
||||
copy(newHistoryVisibility = null)
|
||||
copy(
|
||||
avatarAction = RoomSettingsViewState.AvatarAction.None,
|
||||
newHistoryVisibility = null
|
||||
)
|
||||
}
|
||||
_viewEvents.post(RoomSettingsViewEvents.Success)
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue