Fix restriction label display.

Fixes #8680.
This commit is contained in:
John Preston 2020-10-01 16:53:39 +03:00
parent 8bb3b7fada
commit c6f66e83ee
2 changed files with 16 additions and 8 deletions

View File

@ -732,6 +732,7 @@ void ComposeControls::showStarted() {
_tabbedPanel->hideFast();
}
_wrap->hide();
_writeRestricted->hide();
}
void ComposeControls::showFinished() {
@ -741,7 +742,7 @@ void ComposeControls::showFinished() {
if (_tabbedPanel) {
_tabbedPanel->hideFast();
}
_wrap->show();
updateWrappingVisibility();
}
void ComposeControls::showForGrab() {
@ -1078,15 +1079,22 @@ void ComposeControls::initWriteRestriction() {
}, _wrap->lifetime());
_writeRestriction.value(
) | rpl::start_with_next([=](const std::optional<QString> &error) {
_writeRestricted->setVisible(error.has_value());
_wrap->setVisible(!error.has_value());
if (!error.has_value()) {
_wrap->raise();
}
) | rpl::filter([=] {
return _wrap->isHidden() || _writeRestricted->isHidden();
}) | rpl::start_with_next([=] {
updateWrappingVisibility();
}, _wrap->lifetime());
}
void ComposeControls::updateWrappingVisibility() {
const auto restricted = _writeRestriction.current().has_value();
_writeRestricted->setVisible(restricted);
_wrap->setVisible(!restricted);
if (!restricted) {
_wrap->raise();
}
}
void ComposeControls::updateSendButtonType() {
using Type = Ui::SendButton::Type;
const auto type = [&] {

View File

@ -163,6 +163,7 @@ private:
void initWriteRestriction();
void updateSendButtonType();
void updateHeight();
void updateWrappingVisibility();
void updateControlsVisibility();
void updateControlsGeometry(QSize size);
void updateOuterGeometry(QRect rect);
@ -176,7 +177,6 @@ private:
void setTextFromEditingMessage(not_null<HistoryItem*> item);
void recordError();
void recordUpdated(quint16 level, int samples);
void recordDone(QByteArray result, VoiceWaveform waveform, int samples);