2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

Remove some calls to Auth().

This commit is contained in:
John Preston
2019-07-24 13:13:51 +02:00
parent 9cf4cf6dca
commit 06982fdf04
39 changed files with 573 additions and 444 deletions

View File

@@ -1645,7 +1645,7 @@ bool Session::checkEntitiesAndViewsUpdate(const MTPDmessage &data) {
}
requestItemTextRefresh(existing);
if (existing->mainView()) {
App::checkSavedGif(existing);
checkSavedGif(existing);
return true;
}
return false;
@@ -1653,6 +1653,40 @@ bool Session::checkEntitiesAndViewsUpdate(const MTPDmessage &data) {
return false;
}
void Session::addSavedGif(not_null<DocumentData*> document) {
const auto index = _savedGifs.indexOf(document);
if (!index) {
return;
}
if (index > 0) {
_savedGifs.remove(index);
}
_savedGifs.push_front(document);
if (_savedGifs.size() > Global::SavedGifsLimit()) {
_savedGifs.pop_back();
}
Local::writeSavedGifs();
notifySavedGifsUpdated();
setLastSavedGifsUpdate(0);
session().api().updateStickers();
}
void Session::checkSavedGif(not_null<HistoryItem*> item) {
if (item->Has<HistoryMessageForwarded>()
|| (!item->out()
&& item->history()->peer != session().user())) {
return;
}
if (const auto media = item->media()) {
if (const auto document = media->document()) {
if (document->isGifv()) {
addSavedGif(document);
}
}
}
}
void Session::updateEditedMessage(const MTPMessage &data) {
const auto existing = data.match([](const MTPDmessageEmpty &)
-> HistoryItem* {