From 20e303d3e65328450ccfbdaf5a2208c03b4a7711 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 28 Sep 2018 14:56:21 +0300 Subject: [PATCH] Read chats only on sending (support). --- Telegram/SourceFiles/auth_session.cpp | 5 +++++ Telegram/SourceFiles/auth_session.h | 2 ++ Telegram/SourceFiles/history/history_widget.cpp | 4 +++- Telegram/SourceFiles/mainwidget.cpp | 5 ++++- Telegram/SourceFiles/mainwindow.cpp | 10 +++++++--- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/auth_session.cpp b/Telegram/SourceFiles/auth_session.cpp index bce05b7d2..52dad65d5 100644 --- a/Telegram/SourceFiles/auth_session.cpp +++ b/Telegram/SourceFiles/auth_session.cpp @@ -391,4 +391,9 @@ void AuthSession::checkAutoLockIn(TimeMs time) { _autoLockTimer.callOnce(time); } +bool AuthSession::supportMode() const { +// return true; AssertIsDebug(); + return false; +} + AuthSession::~AuthSession() = default; diff --git a/Telegram/SourceFiles/auth_session.h b/Telegram/SourceFiles/auth_session.h index 90e0e6db3..b0e0caeed 100644 --- a/Telegram/SourceFiles/auth_session.h +++ b/Telegram/SourceFiles/auth_session.h @@ -262,6 +262,8 @@ public: base::Observable documentUpdated; base::Observable, MsgId>> messageIdChanging; + bool supportMode() const; + ~AuthSession(); private: diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 9d456e965..e0eba948f 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2898,7 +2898,9 @@ void HistoryWidget::historyDownClicked() { } else if (_replyReturn && _replyReturn->history() == _migrated) { showHistory(_peer->id, -_replyReturn->id); } else if (_peer) { - showHistory(_peer->id, ShowAtUnreadMsgId); + showHistory( + _peer->id, + Auth().supportMode() ? ShowAtTheEndMsgId : ShowAtUnreadMsgId); } } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 3d48ba73d..1839faa74 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -4002,7 +4002,10 @@ bool MainWidget::isActive() const { } bool MainWidget::doWeReadServerHistory() const { - return isActive() && !_mainSection && _history->doWeReadServerHistory(); + return isActive() + && !Auth().supportMode() + && !_mainSection + && _history->doWeReadServerHistory(); } bool MainWidget::doWeReadMentions() const { diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 24ee85f13..5e172ed95 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -416,16 +416,20 @@ void MainWindow::themeUpdated(const Window::Theme::BackgroundUpdate &data) { bool MainWindow::doWeReadServerHistory() { updateIsActive(0); - return isActive() && _main && !Ui::isLayerShown() && _main->doWeReadServerHistory(); + return isActive() + && !Ui::isLayerShown() + && (_main ? _main->doWeReadServerHistory() : false); } bool MainWindow::doWeReadMentions() { updateIsActive(0); - return isActive() && _main && !Ui::isLayerShown() && _main->doWeReadMentions(); + return isActive() + && !Ui::isLayerShown() + && (_main ? _main->doWeReadMentions() : false); } void MainWindow::checkHistoryActivation() { - if (_main && doWeReadServerHistory()) { + if (doWeReadServerHistory()) { _main->markActiveHistoryAsRead(); } }