mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 21:48:50 +03:00
Merge pull request #2364 from Dominaezzz/fix_draft_sharesheet
Fix draft share sheet
This commit is contained in:
commit
812b1f7baa
2 changed files with 6 additions and 4 deletions
|
@ -8,6 +8,7 @@ Improvements 🙌:
|
||||||
- Open an existing DM instead of creating a new one (#2319)
|
- Open an existing DM instead of creating a new one (#2319)
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
|
- Fix issue when restoring draft after sharing (#2287)
|
||||||
- Fix issue when updating the avatar of a room (new avatar vanishing)
|
- Fix issue when updating the avatar of a room (new avatar vanishing)
|
||||||
- Discard change dialog displayed by mistake when avatar has been updated
|
- Discard change dialog displayed by mistake when avatar has been updated
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
getUnreadState()
|
getUnreadState()
|
||||||
observeSyncState()
|
observeSyncState()
|
||||||
observeEventDisplayedActions()
|
observeEventDisplayedActions()
|
||||||
getDraftIfAny()
|
loadDraftIfAny()
|
||||||
observeUnreadState()
|
observeUnreadState()
|
||||||
observeMyRoomMember()
|
observeMyRoomMember()
|
||||||
observeActiveRoomWidgets()
|
observeActiveRoomWidgets()
|
||||||
|
@ -495,8 +495,8 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDraftIfAny() {
|
private fun loadDraftIfAny() {
|
||||||
val currentDraft = room.getDraft() ?: return
|
val currentDraft = room.getDraft()
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
// Create a sendMode from a draft and retrieve the TimelineEvent
|
// Create a sendMode from a draft and retrieve the TimelineEvent
|
||||||
|
@ -517,6 +517,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
SendMode.EDIT(timelineEvent, currentDraft.text)
|
SendMode.EDIT(timelineEvent, currentDraft.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else -> null
|
||||||
} ?: SendMode.REGULAR("", fromSharing = false)
|
} ?: SendMode.REGULAR("", fromSharing = false)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -772,7 +773,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
private fun popDraft() = withState {
|
private fun popDraft() = withState {
|
||||||
if (it.sendMode is SendMode.REGULAR && it.sendMode.fromSharing) {
|
if (it.sendMode is SendMode.REGULAR && it.sendMode.fromSharing) {
|
||||||
// If we were sharing, we want to get back our last value from draft
|
// If we were sharing, we want to get back our last value from draft
|
||||||
getDraftIfAny()
|
loadDraftIfAny()
|
||||||
} else {
|
} else {
|
||||||
// Otherwise we clear the composer and remove the draft from db
|
// Otherwise we clear the composer and remove the draft from db
|
||||||
setState { copy(sendMode = SendMode.REGULAR("", false)) }
|
setState { copy(sendMode = SendMode.REGULAR("", false)) }
|
||||||
|
|
Loading…
Reference in a new issue