mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Refactor how drafts are handled on a coordinator level and add support for them on thread timelines.
This commit is contained in:
committed by
Stefan Ceriu
parent
eaf14eaaac
commit
6fc6df9375
@@ -161,9 +161,22 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
NotificationCenter.default.publisher(for: UIApplication.willResignActiveNotification).sink { [weak self] _ in
|
||||
self?.saveDraft()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
func start() {
|
||||
Task { await loadDraft() }
|
||||
}
|
||||
|
||||
func stop() {
|
||||
saveDraft()
|
||||
}
|
||||
|
||||
override func process(viewAction: ComposerToolbarViewAction) {
|
||||
switch viewAction {
|
||||
@@ -172,6 +185,8 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
hasAppeard = true
|
||||
wysiwygViewModel.setup()
|
||||
}
|
||||
case .composerDisappeared:
|
||||
saveDraft()
|
||||
case .sendMessage:
|
||||
guard !state.sendButtonDisabled else { return }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user