From 1cc1aab8234e532238e3bb7cef9f3df365380516 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 3 Oct 2016 11:20:02 +0300 Subject: [PATCH 1/3] Version 0.10.9: don't handle cStartUrl() while passcoded. --- Telegram/SourceFiles/application.cpp | 5 ++--- Telegram/SourceFiles/mainwidget.cpp | 16 ++++++++++++---- Telegram/SourceFiles/mainwidget.h | 1 + Telegram/SourceFiles/mainwindow.cpp | 9 ++++++--- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 9a21f66af3..7ca8ba389d 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -303,9 +303,8 @@ void Application::readClients() { if (!startUrl.isEmpty()) { cSetStartUrl(startUrl); } - if (!cStartUrl().isEmpty() && App::main() && App::self()) { - App::main()->openLocalUrl(cStartUrl()); - cSetStartUrl(QString()); + if (auto main = App::main()) { + main->checkStartUrl(); } } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 37ac2441bb..a84d6bec34 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -3301,10 +3301,7 @@ void MainWidget::start(const MTPUser &user) { App::feedUsers(MTP_vector(1, user)); MTP::send(MTPupdates_GetState(), rpcDone(&MainWidget::gotState)); update(); - if (!cStartUrl().isEmpty()) { - openLocalUrl(cStartUrl()); - cSetStartUrl(QString()); - } + _started = true; App::wnd()->sendServiceHistoryRequest(); Local::readInstalledStickers(); @@ -3312,12 +3309,23 @@ void MainWidget::start(const MTPUser &user) { Local::readRecentStickers(); Local::readSavedGifs(); _history->start(); + + checkStartUrl(); } bool MainWidget::started() { return _started; } +void MainWidget::checkStartUrl() { + if (!cStartUrl().isEmpty() && App::self() && !App::passcoded()) { + auto url = cStartUrl(); + cSetStartUrl(QString()); + + openLocalUrl(url); + } +} + void MainWidget::openLocalUrl(const QString &url) { auto urlTrimmed = url.trimmed(); if (urlTrimmed.size() > 8192) urlTrimmed = urlTrimmed.mid(0, 8192); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 84fb263800..a6d3547ee6 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -155,6 +155,7 @@ public: void start(const MTPUser &user); + void checkStartUrl(); void openLocalUrl(const QString &str); void openPeerByName(const QString &name, MsgId msgId = ShowAtUnreadMsgId, const QString &startToken = QString()); void joinGroupByHash(const QString &hash); diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 43c59329e1..fb2c6e1faf 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -550,6 +550,10 @@ void MainWindow::clearPasscode() { notifyUpdateAll(); title->updateBackButton(); updateGlobalMenu(); + + if (auto main = App::main()) { + main->checkStartUrl(); + } } void MainWindow::setupPasscode(bool anim) { @@ -1040,9 +1044,8 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *e) { QString url = static_cast(e)->url().toEncoded().trimmed(); if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) { cSetStartUrl(url.mid(0, 8192)); - if (!cStartUrl().isEmpty() && App::main() && App::self()) { - App::main()->openLocalUrl(cStartUrl()); - cSetStartUrl(QString()); + if (auto main = App::main()) { + main->checkStartUrl(); } } activate(); From f710fe2dd3a31bd930a8e5bd083bcd49f0c80f8d Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 3 Oct 2016 13:08:22 +0300 Subject: [PATCH 2/3] 0.10.10: Crashfix: Removed infinite recursion in Ui::FadeAnimation(). --- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/SourceFiles/ui/effects/fade_animation.cpp | 2 +- Telegram/build/version | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 449d1fc2e2..2b84c45adf 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,9,0 - PRODUCTVERSION 0,10,9,0 + FILEVERSION 0,10,10,0 + PRODUCTVERSION 0,10,10,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.10.9.0" + VALUE "FileVersion", "0.10.10.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.9.0" + VALUE "ProductVersion", "0.10.10.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index a3d19de62a..3a100ee90c 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,9,0 - PRODUCTVERSION 0,10,9,0 + FILEVERSION 0,10,10,0 + PRODUCTVERSION 0,10,10,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "0.10.9.0" + VALUE "FileVersion", "0.10.10.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.9.0" + VALUE "ProductVersion", "0.10.10.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 6505e548ad..16c5222200 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 10009; -constexpr str_const AppVersionStr = "0.10.9"; +constexpr int AppVersion = 10010; +constexpr str_const AppVersionStr = "0.10.10"; constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/ui/effects/fade_animation.cpp b/Telegram/SourceFiles/ui/effects/fade_animation.cpp index 5e2663a5d9..2c5cee26ac 100644 --- a/Telegram/SourceFiles/ui/effects/fade_animation.cpp +++ b/Telegram/SourceFiles/ui/effects/fade_animation.cpp @@ -103,7 +103,7 @@ void FadeAnimation::startAnimation(int duration) { } void FadeAnimation::updateCallback() { - if (_animation.animating(getms())) { + if (_animation.animating()) { _widget->update(); if (_updatedCallback) { _updatedCallback(_animation.current(_visible ? 1. : 0.)); diff --git a/Telegram/build/version b/Telegram/build/version index 209d05a04b..41da4ebe39 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 10009 +AppVersion 10010 AppVersionStrMajor 0.10 -AppVersionStrSmall 0.10.9 -AppVersionStr 0.10.9 +AppVersionStrSmall 0.10.10 +AppVersionStr 0.10.10 AlphaChannel 0 BetaVersion 0 From b600050057f0d0de5dc9d3c4fbae1f9dab5127ec Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 3 Oct 2016 18:00:54 +0300 Subject: [PATCH 3/3] Version 0.10.11: two more crash fixes. --- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/boxes/report_box.cpp | 2 +- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/SourceFiles/history/history_message.cpp | 12 +++++++----- Telegram/build/version | 6 +++--- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 2b84c45adf..1b2a0fdd75 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,10,0 - PRODUCTVERSION 0,10,10,0 + FILEVERSION 0,10,11,0 + PRODUCTVERSION 0,10,11,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.10.10.0" + VALUE "FileVersion", "0.10.11.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.10.0" + VALUE "ProductVersion", "0.10.11.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 3a100ee90c..def0bd48c6 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,10,0 - PRODUCTVERSION 0,10,10,0 + FILEVERSION 0,10,11,0 + PRODUCTVERSION 0,10,11,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "0.10.10.0" + VALUE "FileVersion", "0.10.11.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.10.0" + VALUE "ProductVersion", "0.10.11.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/boxes/report_box.cpp b/Telegram/SourceFiles/boxes/report_box.cpp index e845390cc1..42cb287ff6 100644 --- a/Telegram/SourceFiles/boxes/report_box.cpp +++ b/Telegram/SourceFiles/boxes/report_box.cpp @@ -83,11 +83,11 @@ void ReportBox::onChange() { connect(_reasonOtherText, SIGNAL(submitted(bool)), this, SLOT(onReport())); connect(_reasonOtherText, SIGNAL(cancelled()), this, SLOT(onClose())); } + _reasonOtherText->setFocus(); } else if (_reasonOtherText) { _reasonOtherText.destroy(); updateMaxHeight(); } - _reasonOtherText->setFocus(); } void ReportBox::doSetInnerFocus() { diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 16c5222200..5c49b9b9d9 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 10010; -constexpr str_const AppVersionStr = "0.10.10"; +constexpr int AppVersion = 10011; +constexpr str_const AppVersionStr = "0.10.11"; constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index dc23b998d0..b6f0c4bd54 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -2011,10 +2011,11 @@ bool HistoryService::prepareGameScoreText(const QString &from, QString *outText, } else { gameTitle = lang(lng_deleted_message); } + auto scoreNumber = gamescore ? gamescore->score : 0; if (_from->isSelf()) { - *outText = lng_action_game_you_scored(lt_count, gamescore->score, lt_game, gameTitle); + *outText = lng_action_game_you_scored(lt_count, scoreNumber, lt_game, gameTitle); } else { - *outText = lng_action_game_score(lt_from, from, lt_count, gamescore->score, lt_game, gameTitle); + *outText = lng_action_game_score(lt_from, from, lt_count, scoreNumber, lt_game, gameTitle); } if (second) { outLinks->push_back(second); @@ -2212,12 +2213,13 @@ HistoryTextState HistoryService::getState(int x, int y, HistoryStateRequest requ } void HistoryService::createFromMtp(const MTPDmessageService &message) { + if (message.vaction.type() == mtpc_messageActionGameScore) { + UpdateComponents(HistoryServiceGameScore::Bit()); + Get()->score = message.vaction.c_messageActionGameScore().vscore.v; + } if (message.has_reply_to_msg_id()) { if (message.vaction.type() == mtpc_messageActionPinMessage) { UpdateComponents(HistoryServicePinned::Bit()); - } else if (message.vaction.type() == mtpc_messageActionGameScore) { - UpdateComponents(HistoryServiceGameScore::Bit()); - Get()->score = message.vaction.c_messageActionGameScore().vscore.v; } if (auto dependent = GetDependentData()) { dependent->msgId = message.vreply_to_msg_id.v; diff --git a/Telegram/build/version b/Telegram/build/version index 41da4ebe39..6eec02a3c9 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 10010 +AppVersion 10011 AppVersionStrMajor 0.10 -AppVersionStrSmall 0.10.10 -AppVersionStr 0.10.10 +AppVersionStrSmall 0.10.11 +AppVersionStr 0.10.11 AlphaChannel 0 BetaVersion 0