Skip to content

Commit 8306625

Browse files
committed
Draft : add some doc on ComposerDraftStores
1 parent 82838d6 commit 8306625

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/draft/MatrixComposerDraftStore.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
2222
import timber.log.Timber
2323
import javax.inject.Inject
2424

25+
/**
26+
* A draft store that persists drafts in the room state.
27+
* It can be used to store drafts that should be persisted across app restarts.
28+
*/
2529
class MatrixComposerDraftStore @Inject constructor(
2630
private val client: MatrixClient,
2731
) : ComposerDraftStore {

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/draft/VolatileComposerDraftStore.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import io.element.android.libraries.matrix.api.core.RoomId
2020
import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
2121
import javax.inject.Inject
2222

23+
/**
24+
* A volatile draft store that keeps drafts in memory only.
25+
* It can be used to store drafts that should not be persisted across app restarts.
26+
* Currently it's used to store draft message when moving to edit mode.
27+
*/
2328
class VolatileComposerDraftStore @Inject constructor() : ComposerDraftStore {
2429
private val drafts: MutableMap<RoomId, ComposerDraft> = mutableMapOf()
2530

0 commit comments

Comments
 (0)