2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Replace App::self() with Auth().user().

Always have self Auth().user() when AuthSession exists.
This commit is contained in:
John Preston
2018-09-11 15:50:40 +03:00
parent 12ebae01b0
commit 0c8709ca5f
41 changed files with 227 additions and 230 deletions

View File

@@ -208,14 +208,18 @@ BioManager SetupBio(
geometry.y() + style->textMargins.top());
}, countdown->lifetime());
const auto assign = [=](QString text) {
auto position = bio->textCursor().position();
bio->setText(text.replace('\n', ' '));
auto cursor = bio->textCursor();
cursor.setPosition(position);
bio->setTextCursor(cursor);
};
const auto updated = [=] {
auto text = bio->getLastText();
if (text.indexOf('\n') >= 0) {
auto position = bio->textCursor().position();
bio->setText(text.replace('\n', ' '));
auto cursor = bio->textCursor();
cursor.setPosition(position);
bio->setTextCursor(cursor);
assign(text);
text = bio->getLastText();
}
changed->fire(*current != text);
const auto countLeft = qMax(kMaxBioLength - text.size(), 0);
@@ -230,8 +234,14 @@ BioManager SetupBio(
Info::Profile::BioValue(
self
) | rpl::start_with_next([=](const TextWithEntities &text) {
const auto wasChanged = (*current != bio->getLastText());
*current = text.text;
changed->fire(*current != bio->getLastText());
if (wasChanged) {
changed->fire(*current != bio->getLastText());
} else {
assign(text.text);
*current = bio->getLastText();
}
}, bio->lifetime());
bio->setMaxLength(kMaxBioLength);