Seamlessly switch for the RichTextEditor based message composer to the… (#2753)

* Seemlesly switch for the RichTextEditor based message composer to the plain one depending on whether formatting options are enabled or not.

* Address PR comments

* Fixes #2803 - Add extra padding at the bottom of the composer suggestions list

* Update preview test snapshots

* Update UI test snapshots
This commit is contained in:
Stefan Ceriu
2024-05-08 17:57:32 +03:00
committed by GitHub
parent 75ac523fa2
commit 636274df74
59 changed files with 132 additions and 160 deletions
@@ -60,6 +60,7 @@ enum ComposerToolbarViewAction {
case voiceMessage(ComposerToolbarVoiceMessageAction)
case plainComposerTextChanged
case didToggleFormattingOptions
}
enum ComposerAttachmentType {
@@ -95,7 +96,7 @@ struct ComposerToolbarViewState: BindableState {
case .previewVoiceMessage:
return true
default:
if ServiceLocator.shared.settings.richTextEditorEnabled {
if bindings.composerFormattingEnabled {
return !composerEmpty
} else {
return !bindings.plainComposerText.string.isEmpty
@@ -108,7 +109,7 @@ struct ComposerToolbarViewState: BindableState {
return false
}
if ServiceLocator.shared.settings.richTextEditorEnabled {
if bindings.composerFormattingEnabled {
return composerEmpty
} else {
return bindings.plainComposerText.string.isEmpty
@@ -128,7 +129,7 @@ struct ComposerToolbarViewState: BindableState {
struct ComposerToolbarViewStateBindings {
var plainComposerText: NSAttributedString = .init(string: "")
var composerFocused = false
var composerActionsEnabled = false
var composerFormattingEnabled = false
var composerExpanded = false
var formatItems: [FormatItem] = .init()
var alertInfo: AlertInfo<UUID>?