Load local stickers / gifs in Session().

This commit is contained in:
John Preston 2020-06-24 16:52:06 +04:00
parent 0bc2bfe630
commit 28cafb129e
2 changed files with 16 additions and 18 deletions

View File

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h" #include "data/data_session.h"
#include "data/data_changes.h" #include "data/data_changes.h"
#include "data/data_user.h" #include "data/data_user.h"
#include "data/stickers/data_stickers.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "window/window_lock_widgets.h" #include "window/window_lock_widgets.h"
#include "window/themes/window_theme.h" #include "window/themes/window_theme.h"
@ -94,6 +95,7 @@ Session::Session(
_api->instance().setUserPhone(_user->phone()); _api->instance().setUserPhone(_user->phone());
// Load current userpic and keep it loaded. // Load current userpic and keep it loaded.
_user->loadUserpic();
changes().peerFlagsValue( changes().peerFlagsValue(
_user, _user,
Data::PeerUpdate::Flag::Photo Data::PeerUpdate::Flag::Photo
@ -131,11 +133,23 @@ Session::Session(
MTP_inputPrivacyValueDisallowAll())); MTP_inputPrivacyValueDisallowAll()));
saveSettingsDelayed(); saveSettingsDelayed();
} }
local().readInstalledStickers();
local().readFeaturedStickers();
local().readRecentStickers();
local().readFavedStickers();
local().readSavedGifs();
data().stickers().notifyUpdated();
data().stickers().notifySavedGifsUpdated();
}); });
#ifndef TDESKTOP_DISABLE_SPELLCHECK #ifndef TDESKTOP_DISABLE_SPELLCHECK
Spellchecker::Start(this); Spellchecker::Start(this);
#endif // TDESKTOP_DISABLE_SPELLCHECK #endif // TDESKTOP_DISABLE_SPELLCHECK
_api->requestNotifySettings(MTP_inputNotifyUsers());
_api->requestNotifySettings(MTP_inputNotifyChats());
_api->requestNotifySettings(MTP_inputNotifyBroadcasts());
} }
Session::~Session() { Session::~Session() {

View File

@ -352,27 +352,11 @@ MainWidget::MainWidget(
checker.start(); checker.start();
} }
auto &api = session().api();
api.requestNotifySettings(MTP_inputNotifyUsers());
api.requestNotifySettings(MTP_inputNotifyChats());
api.requestNotifySettings(MTP_inputNotifyBroadcasts());
cSetOtherOnline(0); cSetOtherOnline(0);
session().user()->loadUserpic();
auto &local = session().local(); if (const auto availableAt = session().local().readExportSettings().availableAt) {
local.readInstalledStickers(); session().data().suggestStartExport(availableAt);
local.readFeaturedStickers();
local.readRecentStickers();
local.readFavedStickers();
local.readSavedGifs();
auto &data = session().data();
if (const auto availableAt = local.readExportSettings().availableAt) {
data.suggestStartExport(availableAt);
} }
auto &stickers = data.stickers();
stickers.notifyUpdated();
stickers.notifySavedGifsUpdated();
_history->start(); _history->start();