From c54aadcac333e1870c303faa315fac51d4fae152 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 1 May 2015 02:05:19 +0300 Subject: [PATCH] version 0.8.10.dev with fixes in webpage layout, history load and history msgs reg --- Telegram/PrepareWin.bat | 8 +++---- Telegram/SourceFiles/application.cpp | 4 ++-- Telegram/SourceFiles/config.h | 4 ++-- Telegram/SourceFiles/history.cpp | 10 +++++++-- Telegram/SourceFiles/history.h | 3 +++ Telegram/SourceFiles/historywidget.cpp | 23 ++++++++++++++------ Telegram/Telegram.plist | 2 +- Telegram/Telegram.rc | Bin 5532 -> 5540 bytes Telegram/Telegram.xcodeproj/project.pbxproj | 12 +++++----- Telegram/Version.sh | 2 +- 10 files changed, 43 insertions(+), 25 deletions(-) diff --git a/Telegram/PrepareWin.bat b/Telegram/PrepareWin.bat index 50e324131..97ba30996 100644 --- a/Telegram/PrepareWin.bat +++ b/Telegram/PrepareWin.bat @@ -1,9 +1,9 @@ @echo OFF -set "AppVersion=8009" -set "AppVersionStrSmall=0.8.9" -set "AppVersionStr=0.8.9" -set "AppVersionStrFull=0.8.9.0" +set "AppVersion=8010" +set "AppVersionStrSmall=0.8.10" +set "AppVersionStr=0.8.10" +set "AppVersionStrFull=0.8.10.0" set "DevChannel=1" if %DevChannel% neq 0 goto preparedev diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 23022218c..490c2b5b6 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -662,8 +662,8 @@ void Application::checkMapVersion() { psRegisterCustomScheme(); if (Local::oldMapVersion()) { QString versionFeatures; - if (DevChannel && Local::oldMapVersion() < 8009) { - versionFeatures = QString::fromUtf8("\xe2\x80\x94 Invite links for group chats\n\xe2\x80\x94 Gray unread badge for muted conversations").replace('@', qsl("@") + QChar(0x200D)); + if (DevChannel && Local::oldMapVersion() < 8010) { + versionFeatures = QString::fromUtf8("\xe2\x80\x94 Critical bug fixes with message history loading").replace('@', qsl("@") + QChar(0x200D)); } else if (!DevChannel && Local::oldMapVersion() < 8007) { versionFeatures = lang(lng_new_version_text).trimmed(); } diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 79737b7c0..c00e1bfa0 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 8009; -static const wchar_t *AppVersionStr = L"0.8.9"; +static const int32 AppVersion = 8010; +static const wchar_t *AppVersionStr = L"0.8.10"; static const bool DevChannel = true; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 889266f0c..2c5514c42 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -549,6 +549,12 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo HistoryItem *existing = App::histItemById(msgId); if (existing) { + bool regged = false; + if (existing->detached() && block) { + existing->attach(block); + regged = true; + } + const MTPMessageMedia *media = 0; switch (msg.type()) { case mtpc_message: media = &msg.c_message().vmedia; break; @@ -556,7 +562,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo if (media) { existing->updateMedia(*media); } - return returnExisting ? existing : 0; + return (returnExisting || regged) ? existing : 0; } switch (msg.type()) { @@ -3342,7 +3348,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { w = thumbw; - _maxw = st::webPageLeft + qMax(w, int32(st::minPhotoSize)) + parent->timeWidth(true); + _maxw = st::webPageLeft + qMax(thumbh, qMax(w, int32(st::minPhotoSize))) + parent->timeWidth(true); _minh = qMax(thumbh, int32(st::minPhotoSize)); _minh += st::webPagePhotoSkip; } else { diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index bf2e7ad89..33049b826 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -660,6 +660,9 @@ public: bool detached() const { return !_block; } + void attach(HistoryBlock *block) { + _block = block; + } bool out() const { return _flags & MTPDmessage_flag_out; } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 3419feecc..90dbcd6e2 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1977,7 +1977,8 @@ void HistoryWidget::showPeer(const PeerId &peer, MsgId msgId, bool force, bool l if (hist) { if (histPeer->id == peer) { if (msgId != hist->activeMsgId) { - if (!force && !hist->canShowAround(msgId)) { + bool canShowNow = hist->canShowAround(msgId); + if (!force && !canShowNow) { if (_loadingAroundId != msgId) { clearLoadingAround(); _loadingAroundId = msgId; @@ -1986,9 +1987,13 @@ void HistoryWidget::showPeer(const PeerId &peer, MsgId msgId, bool force, bool l return; } hist->loadAround(msgId); - if (histPreloading) MTP::cancel(histPreloading); - if (histPreloadingDown) MTP::cancel(histPreloadingDown); - histPreloading = histPreloadingDown = 0; + if (!canShowNow) { + histPreload.clear(); + histPreloadDown.clear(); + if (histPreloading) MTP::cancel(histPreloading); + if (histPreloadingDown) MTP::cancel(histPreloadingDown); + histPreloading = histPreloadingDown = 0; + } } if (_replyReturn && _replyReturn->id == msgId) calcNextReplyReturn(); @@ -2306,6 +2311,8 @@ bool HistoryWidget::messagesFailed(const RPCError &error, mtpRequestId requestId void HistoryWidget::messagesReceived(const MTPmessages_Messages &messages, mtpRequestId requestId) { if (!hist) { histPreloading = histPreloadingDown = _loadingAroundRequest = 0; + histPreload.clear(); + histPreloadDown.clear(); return; } @@ -2355,11 +2362,13 @@ void HistoryWidget::messagesReceived(const MTPmessages_Messages &messages, mtpRe _loadingAroundRequest = 0; hist->loadAround(_loadingAroundId); if (hist->isEmpty()) { + histPreload.clear(); + histPreloadDown.clear(); + if (histPreloading) MTP::cancel(histPreloading); + if (histPreloadingDown) MTP::cancel(histPreloadingDown); + histPreloading = histPreloadingDown = 0; addMessagesToFront(*histList); } - if (histPreloading) MTP::cancel(histPreloading); - if (histPreloadingDown) MTP::cancel(histPreloadingDown); - histPreloading = histPreloadingDown = 0; showPeer(hist->peer->id, _loadingAroundId, true); } return; diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index bde3fb3a9..bdd8c251d 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.8.9 + 0.8.10 CFBundleSignature ???? CFBundleURLTypes diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index 285afa4fc9db409194fdf970034eb1a989742e1c..44458739339c5914fbdeeb06e5afa2b7ea574797 100644 GIT binary patch delta 58 zcmbQEy+nIM0WY&5gTdrNUPE>u&7cEhf8>?ie1Nxz2`rH>C_TA>Uu<)V02d=jU~|5p GE(-w1*$$8Z delta 53 zcmZ3YJx6;(0WYKF