mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
parent
fd47fd4d9e
commit
1fc929b78f
1 changed files with 47 additions and 0 deletions
|
@ -1979,6 +1979,14 @@ bool HistoryWidget::insideJumpToEndInsteadOfToUnread() const {
|
||||||
_history->calculateFirstUnreadMessage();
|
_history->calculateFirstUnreadMessage();
|
||||||
const auto unread = _history->firstUnreadMessage();
|
const auto unread = _history->firstUnreadMessage();
|
||||||
const auto visibleBottom = _scroll->scrollTop() + _scroll->height();
|
const auto visibleBottom = _scroll->scrollTop() + _scroll->height();
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): "
|
||||||
|
"unread: %4, top: %5, visibleBottom: %6."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())
|
||||||
|
).arg(unread ? unread->data()->id.bare : 0
|
||||||
|
).arg(unread ? _list->itemTop(unread) : -1
|
||||||
|
).arg(visibleBottom));
|
||||||
return unread && _list->itemTop(unread) <= visibleBottom;
|
return unread && _list->itemTop(unread) <= visibleBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2004,6 +2012,11 @@ void HistoryWidget::showHistory(
|
||||||
|
|
||||||
if (showAtMsgId == ShowAtUnreadMsgId
|
if (showAtMsgId == ShowAtUnreadMsgId
|
||||||
&& insideJumpToEndInsteadOfToUnread()) {
|
&& insideJumpToEndInsteadOfToUnread()) {
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): "
|
||||||
|
"Jumping to end instead of unread."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())));
|
||||||
showAtMsgId = ShowAtTheEndMsgId;
|
showAtMsgId = ShowAtTheEndMsgId;
|
||||||
} else if (showAtMsgId == ShowForChooseMessagesMsgId) {
|
} else if (showAtMsgId == ShowForChooseMessagesMsgId) {
|
||||||
if (_chooseForReport) {
|
if (_chooseForReport) {
|
||||||
|
@ -2023,6 +2036,11 @@ void HistoryWidget::showHistory(
|
||||||
}
|
}
|
||||||
const auto canShowNow = _history->isReadyFor(showAtMsgId);
|
const auto canShowNow = _history->isReadyFor(showAtMsgId);
|
||||||
if (!canShowNow) {
|
if (!canShowNow) {
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): Showing delayed at %4."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())
|
||||||
|
).arg(showAtMsgId.bare));
|
||||||
delayedShowAt(showAtMsgId);
|
delayedShowAt(showAtMsgId);
|
||||||
} else {
|
} else {
|
||||||
_history->forgetScrollState();
|
_history->forgetScrollState();
|
||||||
|
@ -2042,6 +2060,13 @@ void HistoryWidget::showHistory(
|
||||||
|
|
||||||
setMsgId(showAtMsgId);
|
setMsgId(showAtMsgId);
|
||||||
if (_historyInited) {
|
if (_historyInited) {
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): "
|
||||||
|
"Showing instant at %4."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())
|
||||||
|
).arg(showAtMsgId.bare));
|
||||||
|
|
||||||
const auto to = countInitialScrollTop();
|
const auto to = countInitialScrollTop();
|
||||||
const auto item = getItemFromHistoryOrMigrated(
|
const auto item = getItemFromHistoryOrMigrated(
|
||||||
_showAtMsgId);
|
_showAtMsgId);
|
||||||
|
@ -3266,6 +3291,12 @@ void HistoryWidget::loadMessages() {
|
||||||
const auto minId = 0;
|
const auto minId = 0;
|
||||||
const auto historyHash = uint64(0);
|
const auto historyHash = uint64(0);
|
||||||
|
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): Loading up before %4."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())
|
||||||
|
).arg(offsetId.bare));
|
||||||
|
|
||||||
const auto history = from;
|
const auto history = from;
|
||||||
const auto type = Data::Histories::RequestType::History;
|
const auto type = Data::Histories::RequestType::History;
|
||||||
auto &histories = history->owner().histories();
|
auto &histories = history->owner().histories();
|
||||||
|
@ -3318,6 +3349,12 @@ void HistoryWidget::loadMessagesDown() {
|
||||||
const auto minId = 0;
|
const auto minId = 0;
|
||||||
const auto historyHash = uint64(0);
|
const auto historyHash = uint64(0);
|
||||||
|
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): Loading down after %4."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())
|
||||||
|
).arg(offsetId.bare));
|
||||||
|
|
||||||
const auto history = from;
|
const auto history = from;
|
||||||
const auto type = Data::Histories::RequestType::History;
|
const auto type = Data::Histories::RequestType::History;
|
||||||
auto &histories = history->owner().histories();
|
auto &histories = history->owner().histories();
|
||||||
|
@ -3350,6 +3387,12 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) {
|
||||||
clearAllLoadRequests();
|
clearAllLoadRequests();
|
||||||
_delayedShowAtMsgId = showAtMsgId;
|
_delayedShowAtMsgId = showAtMsgId;
|
||||||
|
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): Loading delayed around %4."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())
|
||||||
|
).arg(showAtMsgId.bare));
|
||||||
|
|
||||||
auto from = _history;
|
auto from = _history;
|
||||||
auto offsetId = MsgId();
|
auto offsetId = MsgId();
|
||||||
auto offset = 0;
|
auto offset = 0;
|
||||||
|
@ -4028,6 +4071,10 @@ void HistoryWidget::doneShow() {
|
||||||
void HistoryWidget::cornerButtonsShowAtPosition(
|
void HistoryWidget::cornerButtonsShowAtPosition(
|
||||||
Data::MessagePosition position) {
|
Data::MessagePosition position) {
|
||||||
if (position == Data::UnreadMessagePosition) {
|
if (position == Data::UnreadMessagePosition) {
|
||||||
|
DEBUG_LOG(("JumpToEnd(%1, %2, %3): Show at unread requested."
|
||||||
|
).arg(_history->peer->name()
|
||||||
|
).arg(_history->inboxReadTillId().bare
|
||||||
|
).arg(Logs::b(_history->loadedAtBottom())));
|
||||||
showHistory(_peer->id, ShowAtUnreadMsgId);
|
showHistory(_peer->id, ShowAtUnreadMsgId);
|
||||||
} else if (_peer && position.fullId.peer == _peer->id) {
|
} else if (_peer && position.fullId.peer == _peer->id) {
|
||||||
showHistory(_peer->id, position.fullId.msg);
|
showHistory(_peer->id, position.fullId.msg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue