From d568cab2fc30cb0c5d03a044bc88df421492fb08 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 1 Nov 2024 22:24:16 +0400 Subject: [PATCH] Fix initial IV zoom level. Fixes #28600. --- Telegram/SourceFiles/core/core_settings.cpp | 13 +++++++++---- Telegram/SourceFiles/iv/iv_controller.cpp | 4 +++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/core/core_settings.cpp b/Telegram/SourceFiles/core/core_settings.cpp index 0e47733b1e..2ef80a80df 100644 --- a/Telegram/SourceFiles/core/core_settings.cpp +++ b/Telegram/SourceFiles/core/core_settings.cpp @@ -240,7 +240,7 @@ QByteArray Settings::serialize() const { + Serialize::stringSize(_customFontFamily) + sizeof(qint32) * 3 + Serialize::bytearraySize(_tonsiteStorageToken) - + sizeof(qint32) * 5; + + sizeof(qint32) * 6; auto result = QByteArray(); result.reserve(size); @@ -396,10 +396,11 @@ QByteArray Settings::serialize() const { << qint32(!_weatherInCelsius ? 0 : *_weatherInCelsius ? 1 : 2) << _tonsiteStorageToken << qint32(_includeMutedCounterFolders ? 1 : 0) - << qint32(_ivZoom.current()) + << qint32(0) // Old IV zoom << qint32(_skipToastsInFocus ? 1 : 0) << qint32(_recordVideoMessages ? 1 : 0) - << SerializeVideoQuality(_videoQuality); + << SerializeVideoQuality(_videoQuality) + << qint32(_ivZoom.current()); } Ensures(result.size() == size); @@ -837,7 +838,8 @@ void Settings::addFromSerialized(const QByteArray &serialized) { stream >> includeMutedCounterFolders; } if (!stream.atEnd()) { - stream >> ivZoom; + qint32 oldIvZoom = 0; + stream >> oldIvZoom; } if (!stream.atEnd()) { stream >> skipToastsInFocus; @@ -848,6 +850,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) { if (!stream.atEnd()) { stream >> videoQuality; } + if (!stream.atEnd()) { + stream >> ivZoom; + } if (stream.status() != QDataStream::Ok) { LOG(("App Error: " "Bad data for Core::Settings::constructFromSerialized()")); diff --git a/Telegram/SourceFiles/iv/iv_controller.cpp b/Telegram/SourceFiles/iv/iv_controller.cpp index 7565fc90de..bf699adb71 100644 --- a/Telegram/SourceFiles/iv/iv_controller.cpp +++ b/Telegram/SourceFiles/iv/iv_controller.cpp @@ -655,7 +655,9 @@ void Controller::createWebview(const Webview::StorageId &storageId) { if (const auto webviewZoomController = raw->zoomController()) { webviewZoomController->zoomValue( ) | rpl::start_with_next([this](int value) { - _delegate->ivSetZoom(value); + if (value > 0) { + _delegate->ivSetZoom(value); + } }, lifetime()); _delegate->ivZoomValue( ) | rpl::start_with_next([=](int value) {