mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Moved out MainWidget::clearBotStartToken to static function.
This commit is contained in:
parent
920484d540
commit
ed667a42ad
2 changed files with 18 additions and 14 deletions
|
@ -94,6 +94,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
namespace {
|
||||
|
||||
void ClearBotStartToken(PeerData *peer) {
|
||||
if (peer && peer->isUser() && peer->asUser()->isBot()) {
|
||||
peer->asUser()->botInfo->startToken = QString();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
enum StackItemType {
|
||||
HistoryStackItem,
|
||||
SectionStackItem,
|
||||
|
@ -1205,12 +1215,6 @@ void MainWidget::setInnerFocus() {
|
|||
}
|
||||
}
|
||||
|
||||
void MainWidget::clearBotStartToken(PeerData *peer) {
|
||||
if (peer && peer->isUser() && peer->asUser()->isBot()) {
|
||||
peer->asUser()->botInfo->startToken = QString();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::showChooseReportMessages(
|
||||
not_null<PeerData*> peer,
|
||||
Ui::ReportReason reason,
|
||||
|
@ -1290,7 +1294,9 @@ void MainWidget::showHistory(
|
|||
if (peer->migrateTo()) {
|
||||
peer = peer->migrateTo();
|
||||
peerId = peer->id;
|
||||
if (showAtMsgId > 0) showAtMsgId = -showAtMsgId;
|
||||
if (showAtMsgId > 0) {
|
||||
showAtMsgId = -showAtMsgId;
|
||||
}
|
||||
}
|
||||
const auto unavailable = peer->computeUnavailableReason();
|
||||
if (!unavailable.isEmpty()) {
|
||||
|
@ -1345,7 +1351,7 @@ void MainWidget::showHistory(
|
|||
bool foundInStack = !peerId;
|
||||
if (foundInStack || (way == Way::ClearStack)) {
|
||||
for (const auto &item : _stack) {
|
||||
clearBotStartToken(item->peer());
|
||||
ClearBotStartToken(item->peer());
|
||||
}
|
||||
_stack.clear();
|
||||
} else {
|
||||
|
@ -1353,7 +1359,7 @@ void MainWidget::showHistory(
|
|||
if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer()->id == peerId) {
|
||||
foundInStack = true;
|
||||
while (int(_stack.size()) > i + 1) {
|
||||
clearBotStartToken(_stack.back()->peer());
|
||||
ClearBotStartToken(_stack.back()->peer());
|
||||
_stack.pop_back();
|
||||
}
|
||||
_stack.pop_back();
|
||||
|
@ -1415,7 +1421,7 @@ void MainWidget::showHistory(
|
|||
if (_history->peer()
|
||||
&& _history->peer()->id != peerId
|
||||
&& way != Way::Forward) {
|
||||
clearBotStartToken(_history->peer());
|
||||
ClearBotStartToken(_history->peer());
|
||||
}
|
||||
_history->showHistory(
|
||||
peerId,
|
||||
|
@ -1981,8 +1987,8 @@ bool MainWidget::showBackFromStack(const SectionShow ¶ms) {
|
|||
}
|
||||
auto item = std::move(_stack.back());
|
||||
_stack.pop_back();
|
||||
if (auto currentHistoryPeer = _history->peer()) {
|
||||
clearBotStartToken(currentHistoryPeer);
|
||||
if (const auto currentHistoryPeer = _history->peer()) {
|
||||
ClearBotStartToken(currentHistoryPeer);
|
||||
}
|
||||
_thirdSectionFromStack = item->takeThirdSectionMemento();
|
||||
if (item->type() == HistoryStackItem) {
|
||||
|
|
|
@ -173,8 +173,6 @@ public:
|
|||
void checkChatBackground();
|
||||
Image *newBackgroundThumb();
|
||||
|
||||
void clearBotStartToken(PeerData *peer);
|
||||
|
||||
void setInnerFocus();
|
||||
|
||||
bool contentOverlapped(const QRect &globalRect);
|
||||
|
|
Loading…
Add table
Reference in a new issue