Fix faved+recent stickers icon highlight.

This commit is contained in:
John Preston 2018-04-15 10:47:15 +04:00
parent 362b3bc578
commit 4f1a633019
2 changed files with 19 additions and 12 deletions

View File

@ -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(

View File

@ -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<Window::Controller*> controller,
const FormRequest &request)
: _controller(controller)
, _request(PreprocessRequest(request))
, _view(std::make_unique<PanelController>(this)) {
: _controller(controller)
, _request(PreprocessRequest(request))
, _view(std::make_unique<PanelController>(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();