2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Move session data localstorage -> storage_account.

This commit is contained in:
John Preston
2020-06-09 20:57:05 +04:00
parent 739a3ebe97
commit ad4afe9293
64 changed files with 5190 additions and 4652 deletions

View File

@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "apiwrap.h"
#include "storage/localstorage.h"
#include "storage/storage_account.h"
#include "storage/localimageloader.h"
#include "storage/file_upload.h"
#include "base/parse_helper.h"
@@ -529,6 +530,10 @@ ChatBackground::ChatBackground() : _adjustableColors({
});
}
Storage::Account &ChatBackground::local() const {
return Core::App().activeAccount().local();
}
void ChatBackground::setThemeData(QImage &&themeImage, bool themeTile) {
_themeImage = validateBackgroundImage(std::move(themeImage));
_themeTile = themeTile;
@@ -538,7 +543,7 @@ void ChatBackground::start() {
if (!Data::details::IsUninitializedWallPaper(_paper)) {
return;
}
if (!Local::readBackground()) {
if (!local().readBackground()) {
set(Data::ThemeWallPaper());
}
@@ -653,7 +658,7 @@ void ChatBackground::set(const Data::WallPaper &paper, QImage image) {
setPaper(Data::DefaultWallPaper().withParamsFrom(_paper));
image.load(qsl(":/gui/art/bg.jpg"));
}
Local::writeBackground(
local().writeBackground(
_paper,
((Data::IsDefaultWallPaper(_paper)
|| Data::IsLegacy1DefaultWallPaper(_paper))
@@ -869,7 +874,7 @@ void ChatBackground::setTile(bool tile) {
if (this->tile() != old) {
if (!Data::details::IsTestingThemeWallPaper(_paper)
&& !Data::details::IsTestingDefaultWallPaper(_paper)) {
Local::writeUserSettings();
local().writeSettings();
}
notify(BackgroundUpdate(BackgroundUpdate::Type::Changed, tile));
}
@@ -1024,9 +1029,9 @@ bool ChatBackground::isNonDefaultBackground() {
void ChatBackground::writeNewBackgroundSettings() {
if (tile() != _tileForRevert) {
Local::writeUserSettings();
local().writeSettings();
}
Local::writeBackground(
local().writeBackground(
_paper,
((Data::IsThemeWallPaper(_paper)
|| Data::IsDefaultWallPaper(_paper))
@@ -1111,12 +1116,12 @@ void ChatBackground::reapplyWithNightMode(
ClearApplying();
keepApplied(saved.object, settingExactTheme);
if (tile() != _tileForRevert) {
Local::writeUserSettings();
local().writeSettings();
}
if (nightModeChanged) {
Local::writeSettings();
}
if (!settingExactTheme && !Local::readBackground()) {
if (!settingExactTheme && !local().readBackground()) {
set(Data::ThemeWallPaper());
}
};