From a9319bf6a35c5087bead294e010b74833f6cfa2d Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 13 Sep 2015 12:24:15 +0300 Subject: [PATCH] 0.8.57 stable version with confirmation for spam reports --- Telegram/PrepareWin.bat | 8 ++++---- Telegram/SourceFiles/boxes/confirmbox.cpp | 2 +- Telegram/SourceFiles/config.h | 4 ++-- Telegram/SourceFiles/historywidget.cpp | 14 +++++++++++--- Telegram/SourceFiles/historywidget.h | 1 + Telegram/Telegram.plist | 2 +- Telegram/Telegram.rc | Bin 5540 -> 5540 bytes Telegram/Telegram.xcodeproj/project.pbxproj | 12 ++++++------ Telegram/Version.sh | 2 +- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Telegram/PrepareWin.bat b/Telegram/PrepareWin.bat index c832556d5..7774c249d 100644 --- a/Telegram/PrepareWin.bat +++ b/Telegram/PrepareWin.bat @@ -1,10 +1,10 @@ @echo OFF set "AppVersionStrMajor=0.8" -set "AppVersion=8056" -set "AppVersionStrSmall=0.8.56" -set "AppVersionStr=0.8.56" -set "AppVersionStrFull=0.8.56.0" +set "AppVersion=8057" +set "AppVersionStrSmall=0.8.57" +set "AppVersionStr=0.8.57" +set "AppVersionStrFull=0.8.57.0" set "DevChannel=0" if %DevChannel% neq 0 goto preparedev diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index c601cfa97..45e4cd28f 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -48,7 +48,7 @@ _text(100) { void ConfirmBox::init(const QString &text) { _text.setText(st::boxFont, text, (_infoMsg ? _confirmBoxTextOptions : _textPlainOptions)); - _textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right(); + _textWidth = st::boxWidth + 10 - st::boxPadding.left() - st::boxPadding.right(); _textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxFont->height); setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + (_infoMsg ? _close.height() : _confirm.height())); diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 3c7294a13..72244cb85 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 = 8056; -static const wchar_t *AppVersionStr = L"0.8.56"; +static const int32 AppVersion = 8057; +static const wchar_t *AppVersionStr = L"0.8.57"; static const bool DevVersion = false; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index fc47fa868..49887732a 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -4640,10 +4640,18 @@ void HistoryWidget::onAudioFailed(MsgId newId) { } void HistoryWidget::onReportSpamClicked() { + ConfirmBox *box = new ConfirmBox(lang(_peer->chat ? lng_report_spam_sure_group : lng_report_spam_sure), lang(lng_report_spam_ok)); + connect(box, SIGNAL(confirmed()), this, SLOT(onReportSpamSure())); + App::wnd()->showLayer(box); + _clearPeer = _peer; +} + +void HistoryWidget::onReportSpamSure() { if (_reportSpamRequest) return; - if (!_peer->chat) MTP::send(MTPcontacts_Block(_peer->asUser()->inputUser), rpcDone(&HistoryWidget::blockDone, _peer), RPCFailHandlerPtr(), 0, 5); - _reportSpamRequest = MTP::send(MTPmessages_ReportSpam(_peer->input), rpcDone(&HistoryWidget::reportSpamDone, _peer), rpcFail(&HistoryWidget::reportSpamFail)); + App::wnd()->hideLayer(); + if (!_clearPeer->chat) MTP::send(MTPcontacts_Block(_clearPeer->asUser()->inputUser), rpcDone(&HistoryWidget::blockDone, _clearPeer), RPCFailHandlerPtr(), 0, 5); + _reportSpamRequest = MTP::send(MTPmessages_ReportSpam(_clearPeer->input), rpcDone(&HistoryWidget::reportSpamDone, _clearPeer), rpcFail(&HistoryWidget::reportSpamFail)); } void HistoryWidget::reportSpamDone(PeerData *peer, const MTPBool &result, mtpRequestId req) { @@ -4684,8 +4692,8 @@ void HistoryWidget::onReportSpamClear() { } void HistoryWidget::onReportSpamClearSure() { + App::wnd()->hideLayer(); if (_clearPeer->chat) { - App::wnd()->hideLayer(); App::main()->showDialogs(); MTP::send(MTPmessages_DeleteChatUser(MTP_int(_clearPeer->id & 0xFFFFFFFF), App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _clearPeer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _clearPeer)); } else { diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 6e4e0eb6b..64662d767 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -546,6 +546,7 @@ public slots: void onAudioFailed(MsgId msgId); void onReportSpamClicked(); + void onReportSpamSure(); void onReportSpamHide(); void onReportSpamClear(); void onReportSpamClearSure(); diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index 529320931..4968406f2 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.8.56 + 0.8.57 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) CFBundleSignature diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index ec03f392f3bfad7cf4eecd426c0d2c4658079cd6..ba55f0baea21203b11cc9b1ce39c7f1dbef42a20 100644 GIT binary patch delta 53 zcmZ3Yy+nIM5ig_p6O delta 53 zcmZ3Yy+nIM5ig_J