From 4f1a6330191a4714e240a94a75993ac224100891 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 15 Apr 2018 10:47:15 +0400 Subject: [PATCH] Fix faved+recent stickers icon highlight. --- .../chat_helpers/stickers_list_widget.cpp | 11 ++++++++-- .../passport/passport_form_controller.cpp | 20 +++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index f8eb440365..af92354358 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -266,16 +266,23 @@ void StickersListWidget::Footer::preloadImages() { void StickersListWidget::Footer::validateSelectedIcon( uint64 setId, ValidateIconAnimations animations) { - auto newSelected = 0; + auto favedIconIndex = -1; + auto newSelected = -1; for (auto i = 0, l = _icons.size(); i != l; ++i) { if (_icons[i].setId == setId || (_icons[i].setId == Stickers::FavedSetId && setId == Stickers::RecentSetId)) { newSelected = i; break; + } else if (_icons[i].setId == Stickers::FavedSetId) { + favedIconIndex = i; } } - setSelectedIcon(newSelected, animations); + setSelectedIcon( + (newSelected >= 0 + ? newSelected + : (favedIconIndex >= 0) ? favedIconIndex : 0), + animations); } void StickersListWidget::Footer::setSelectedIcon( diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index c5baf2c889..f02731e16b 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -126,11 +126,11 @@ FormRequest::FormRequest( const QString &callbackUrl, const QString &publicKey, const QString &payload) - : botId(botId) - , scope(scope) - , callbackUrl(callbackUrl) - , publicKey(publicKey) - , payload(payload) { +: botId(botId) +, scope(scope) +, callbackUrl(callbackUrl) +, publicKey(publicKey) +, payload(payload) { } EditFile::EditFile( @@ -184,9 +184,9 @@ Value::Value(Type type) : type(type) { FormController::FormController( not_null controller, const FormRequest &request) - : _controller(controller) - , _request(PreprocessRequest(request)) - , _view(std::make_unique(this)) { +: _controller(controller) +, _request(PreprocessRequest(request)) +, _view(std::make_unique(this)) { } void FormController::show() { @@ -203,7 +203,7 @@ QString FormController::privacyPolicyUrl() const { } bytes::vector FormController::passwordHashForAuth( - bytes::const_span password) const { + bytes::const_span password) const { return openssl::Sha256(bytes::concatenate( _password.salt, password, @@ -221,7 +221,7 @@ auto FormController::prepareFinalData() -> FinalData { object.insert("data", GetJSONFromMap({ { "data_hash", value->data.hash }, { "secret", value->data.secret } - })); + })); } if (!value->scans.empty()) { auto files = QJsonArray();