Fix initial IV zoom level.

Fixes #28600.
This commit is contained in:
John Preston 2024-11-01 22:24:16 +04:00
parent 8447b95c50
commit d568cab2fc
2 changed files with 12 additions and 5 deletions

View file

@ -240,7 +240,7 @@ QByteArray Settings::serialize() const {
+ Serialize::stringSize(_customFontFamily) + Serialize::stringSize(_customFontFamily)
+ sizeof(qint32) * 3 + sizeof(qint32) * 3
+ Serialize::bytearraySize(_tonsiteStorageToken) + Serialize::bytearraySize(_tonsiteStorageToken)
+ sizeof(qint32) * 5; + sizeof(qint32) * 6;
auto result = QByteArray(); auto result = QByteArray();
result.reserve(size); result.reserve(size);
@ -396,10 +396,11 @@ QByteArray Settings::serialize() const {
<< qint32(!_weatherInCelsius ? 0 : *_weatherInCelsius ? 1 : 2) << qint32(!_weatherInCelsius ? 0 : *_weatherInCelsius ? 1 : 2)
<< _tonsiteStorageToken << _tonsiteStorageToken
<< qint32(_includeMutedCounterFolders ? 1 : 0) << qint32(_includeMutedCounterFolders ? 1 : 0)
<< qint32(_ivZoom.current()) << qint32(0) // Old IV zoom
<< qint32(_skipToastsInFocus ? 1 : 0) << qint32(_skipToastsInFocus ? 1 : 0)
<< qint32(_recordVideoMessages ? 1 : 0) << qint32(_recordVideoMessages ? 1 : 0)
<< SerializeVideoQuality(_videoQuality); << SerializeVideoQuality(_videoQuality)
<< qint32(_ivZoom.current());
} }
Ensures(result.size() == size); Ensures(result.size() == size);
@ -837,7 +838,8 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
stream >> includeMutedCounterFolders; stream >> includeMutedCounterFolders;
} }
if (!stream.atEnd()) { if (!stream.atEnd()) {
stream >> ivZoom; qint32 oldIvZoom = 0;
stream >> oldIvZoom;
} }
if (!stream.atEnd()) { if (!stream.atEnd()) {
stream >> skipToastsInFocus; stream >> skipToastsInFocus;
@ -848,6 +850,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
if (!stream.atEnd()) { if (!stream.atEnd()) {
stream >> videoQuality; stream >> videoQuality;
} }
if (!stream.atEnd()) {
stream >> ivZoom;
}
if (stream.status() != QDataStream::Ok) { if (stream.status() != QDataStream::Ok) {
LOG(("App Error: " LOG(("App Error: "
"Bad data for Core::Settings::constructFromSerialized()")); "Bad data for Core::Settings::constructFromSerialized()"));

View file

@ -655,7 +655,9 @@ void Controller::createWebview(const Webview::StorageId &storageId) {
if (const auto webviewZoomController = raw->zoomController()) { if (const auto webviewZoomController = raw->zoomController()) {
webviewZoomController->zoomValue( webviewZoomController->zoomValue(
) | rpl::start_with_next([this](int value) { ) | rpl::start_with_next([this](int value) {
_delegate->ivSetZoom(value); if (value > 0) {
_delegate->ivSetZoom(value);
}
}, lifetime()); }, lifetime());
_delegate->ivZoomValue( _delegate->ivZoomValue(
) | rpl::start_with_next([=](int value) { ) | rpl::start_with_next([=](int value) {