mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added counter label of characters limit to edit mode without media.
This commit is contained in:
parent
a77c547a62
commit
08717dcd78
2 changed files with 14 additions and 6 deletions
|
@ -7316,12 +7316,16 @@ void HistoryWidget::checkCharsLimitation() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto item = session().data().message(_history->peer, _editMsgId);
|
const auto item = session().data().message(_history->peer, _editMsgId);
|
||||||
if (!item || !item->media() || !item->media()->allowsEditCaption()) {
|
if (!item) {
|
||||||
_charsLimitation = nullptr;
|
_charsLimitation = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto remove = Ui::FieldCharacterCount(_field)
|
const auto hasMediaWithCaption = item->media()
|
||||||
- Data::PremiumLimits(&session()).captionLengthCurrent();
|
&& item->media()->allowsEditCaption();
|
||||||
|
const auto maxCaptionSize = !hasMediaWithCaption
|
||||||
|
? MaxMessageSize
|
||||||
|
: Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||||
|
const auto remove = Ui::FieldCharacterCount(_field) - maxCaptionSize;
|
||||||
if (remove > 0) {
|
if (remove > 0) {
|
||||||
if (!_charsLimitation) {
|
if (!_charsLimitation) {
|
||||||
_charsLimitation = base::make_unique_q<CharactersLimitLabel>(
|
_charsLimitation = base::make_unique_q<CharactersLimitLabel>(
|
||||||
|
|
|
@ -3323,12 +3323,16 @@ void ComposeControls::checkCharsLimitation() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto item = _history->owner().message(_header->editMsgId());
|
const auto item = _history->owner().message(_header->editMsgId());
|
||||||
if (!item || !item->media() || !item->media()->allowsEditCaption()) {
|
if (!item) {
|
||||||
_charsLimitation = nullptr;
|
_charsLimitation = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto remove = Ui::FieldCharacterCount(_field)
|
const auto hasMediaWithCaption = item->media()
|
||||||
- Data::PremiumLimits(&session()).captionLengthCurrent();
|
&& item->media()->allowsEditCaption();
|
||||||
|
const auto maxCaptionSize = !hasMediaWithCaption
|
||||||
|
? MaxMessageSize
|
||||||
|
: Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||||
|
const auto remove = Ui::FieldCharacterCount(_field) - maxCaptionSize;
|
||||||
if (remove > 0) {
|
if (remove > 0) {
|
||||||
if (!_charsLimitation) {
|
if (!_charsLimitation) {
|
||||||
using namespace Controls;
|
using namespace Controls;
|
||||||
|
|
Loading…
Add table
Reference in a new issue