mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Volatile draft to restore the composer after an edit. (#2996)
This commit is contained in:
@@ -21,6 +21,7 @@ import MatrixRustSDK
|
||||
final class ComposerDraftService: ComposerDraftServiceProtocol {
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
private let timelineItemfactory: RoomTimelineItemFactoryProtocol
|
||||
private var volatileDraft: ComposerDraftProxy?
|
||||
|
||||
init(roomProxy: RoomProxyProtocol, timelineItemfactory: RoomTimelineItemFactoryProtocol) {
|
||||
self.roomProxy = roomProxy
|
||||
@@ -71,4 +72,16 @@ final class ComposerDraftService: ComposerDraftServiceProtocol {
|
||||
return .failure(.failedToClearDraft)
|
||||
}
|
||||
}
|
||||
|
||||
func saveVolatileDraft(_ draft: ComposerDraftProxy) {
|
||||
volatileDraft = draft
|
||||
}
|
||||
|
||||
func loadVolatileDraft() -> ComposerDraftProxy? {
|
||||
volatileDraft
|
||||
}
|
||||
|
||||
func clearVolatileDraft() {
|
||||
volatileDraft = nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user