mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +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/QCoreApplication>
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void ClearBotStartToken(PeerData *peer) {
|
||||||
|
if (peer && peer->isUser() && peer->asUser()->isBot()) {
|
||||||
|
peer->asUser()->botInfo->startToken = QString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
enum StackItemType {
|
enum StackItemType {
|
||||||
HistoryStackItem,
|
HistoryStackItem,
|
||||||
SectionStackItem,
|
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(
|
void MainWidget::showChooseReportMessages(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ReportReason reason,
|
Ui::ReportReason reason,
|
||||||
|
@ -1290,7 +1294,9 @@ void MainWidget::showHistory(
|
||||||
if (peer->migrateTo()) {
|
if (peer->migrateTo()) {
|
||||||
peer = peer->migrateTo();
|
peer = peer->migrateTo();
|
||||||
peerId = peer->id;
|
peerId = peer->id;
|
||||||
if (showAtMsgId > 0) showAtMsgId = -showAtMsgId;
|
if (showAtMsgId > 0) {
|
||||||
|
showAtMsgId = -showAtMsgId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const auto unavailable = peer->computeUnavailableReason();
|
const auto unavailable = peer->computeUnavailableReason();
|
||||||
if (!unavailable.isEmpty()) {
|
if (!unavailable.isEmpty()) {
|
||||||
|
@ -1345,7 +1351,7 @@ void MainWidget::showHistory(
|
||||||
bool foundInStack = !peerId;
|
bool foundInStack = !peerId;
|
||||||
if (foundInStack || (way == Way::ClearStack)) {
|
if (foundInStack || (way == Way::ClearStack)) {
|
||||||
for (const auto &item : _stack) {
|
for (const auto &item : _stack) {
|
||||||
clearBotStartToken(item->peer());
|
ClearBotStartToken(item->peer());
|
||||||
}
|
}
|
||||||
_stack.clear();
|
_stack.clear();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1353,7 +1359,7 @@ void MainWidget::showHistory(
|
||||||
if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer()->id == peerId) {
|
if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer()->id == peerId) {
|
||||||
foundInStack = true;
|
foundInStack = true;
|
||||||
while (int(_stack.size()) > i + 1) {
|
while (int(_stack.size()) > i + 1) {
|
||||||
clearBotStartToken(_stack.back()->peer());
|
ClearBotStartToken(_stack.back()->peer());
|
||||||
_stack.pop_back();
|
_stack.pop_back();
|
||||||
}
|
}
|
||||||
_stack.pop_back();
|
_stack.pop_back();
|
||||||
|
@ -1415,7 +1421,7 @@ void MainWidget::showHistory(
|
||||||
if (_history->peer()
|
if (_history->peer()
|
||||||
&& _history->peer()->id != peerId
|
&& _history->peer()->id != peerId
|
||||||
&& way != Way::Forward) {
|
&& way != Way::Forward) {
|
||||||
clearBotStartToken(_history->peer());
|
ClearBotStartToken(_history->peer());
|
||||||
}
|
}
|
||||||
_history->showHistory(
|
_history->showHistory(
|
||||||
peerId,
|
peerId,
|
||||||
|
@ -1981,8 +1987,8 @@ bool MainWidget::showBackFromStack(const SectionShow ¶ms) {
|
||||||
}
|
}
|
||||||
auto item = std::move(_stack.back());
|
auto item = std::move(_stack.back());
|
||||||
_stack.pop_back();
|
_stack.pop_back();
|
||||||
if (auto currentHistoryPeer = _history->peer()) {
|
if (const auto currentHistoryPeer = _history->peer()) {
|
||||||
clearBotStartToken(currentHistoryPeer);
|
ClearBotStartToken(currentHistoryPeer);
|
||||||
}
|
}
|
||||||
_thirdSectionFromStack = item->takeThirdSectionMemento();
|
_thirdSectionFromStack = item->takeThirdSectionMemento();
|
||||||
if (item->type() == HistoryStackItem) {
|
if (item->type() == HistoryStackItem) {
|
||||||
|
|
|
@ -173,8 +173,6 @@ public:
|
||||||
void checkChatBackground();
|
void checkChatBackground();
|
||||||
Image *newBackgroundThumb();
|
Image *newBackgroundThumb();
|
||||||
|
|
||||||
void clearBotStartToken(PeerData *peer);
|
|
||||||
|
|
||||||
void setInnerFocus();
|
void setInnerFocus();
|
||||||
|
|
||||||
bool contentOverlapped(const QRect &globalRect);
|
bool contentOverlapped(const QRect &globalRect);
|
||||||
|
|
Loading…
Add table
Reference in a new issue