mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-30 07:18:28 +00:00
Use notify* instead of mark* in Data::Session.
This commit is contained in:
parent
8a56ede187
commit
04c8c95634
Telegram/SourceFiles
apiwrap.cppapp.cpp
boxes
chat_helpers
data
history
info/media
inline_bots
mainwidget.cppmedia/player
@ -1219,7 +1219,7 @@ void ApiWrap::saveStickerSets(const Stickers::Order &localOrder, const Stickers:
|
||||
if (writeArchived) Local::writeArchivedStickers();
|
||||
if (writeCloudRecent) Local::writeRecentStickers();
|
||||
if (writeFaved) Local::writeFavedStickers();
|
||||
_session->data().markStickersUpdated();
|
||||
_session->data().notifyStickersUpdated();
|
||||
|
||||
if (_stickerSetDisenableRequests.empty()) {
|
||||
stickersSaveOrder();
|
||||
@ -1834,7 +1834,7 @@ void ApiWrap::setGroupStickerSet(not_null<ChannelData*> megagroup, const MTPInpu
|
||||
Expects(megagroup->mgInfo != nullptr);
|
||||
megagroup->mgInfo->stickerSet = set;
|
||||
request(MTPchannels_SetStickers(megagroup->inputChannel, set)).send();
|
||||
_session->data().markStickersUpdated();
|
||||
_session->data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
void ApiWrap::requestStickers(TimeId now) {
|
||||
@ -1986,7 +1986,7 @@ void ApiWrap::readFeaturedSets() {
|
||||
MTP_vector<MTPlong>(wrappedIds));
|
||||
request(std::move(requestData)).done([=](const MTPBool &result) {
|
||||
Local::writeFeaturedStickers();
|
||||
_session->data().markStickersUpdated();
|
||||
_session->data().notifyStickersUpdated();
|
||||
}).send();
|
||||
|
||||
_session->data().setFeaturedStickerSetsUnreadCount(count);
|
||||
|
@ -951,7 +951,7 @@ namespace {
|
||||
if (saved.size() > Global::SavedGifsLimit()) saved.pop_back();
|
||||
Local::writeSavedGifs();
|
||||
|
||||
Auth().data().markSavedGifsUpdated();
|
||||
Auth().data().notifySavedGifsUpdated();
|
||||
Auth().data().setLastSavedGifsUpdate(0);
|
||||
Auth().api().updateStickers();
|
||||
}
|
||||
@ -1277,7 +1277,7 @@ namespace {
|
||||
if (Global::started()
|
||||
&& !App::quitting()
|
||||
&& AuthSession::Exists()) {
|
||||
Auth().data().markItemRemoved(item);
|
||||
Auth().data().notifyItemRemoved(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ void StickerSetBox::Inner::installDone(const MTPmessages_StickerSetInstallResult
|
||||
Local::writeArchivedStickers();
|
||||
}
|
||||
Local::writeInstalledStickers();
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
_setInstalled.fire_copy(_setId);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void ApplyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) {
|
||||
Ui::Toast::Show(toast);
|
||||
// Ui::show(Box<StickersBox>(archived), LayerOption::KeepOther);
|
||||
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
// For testing: Just apply random subset or your sticker sets as archived.
|
||||
@ -132,7 +132,7 @@ void InstallLocally(uint64 setId) {
|
||||
Local::writeArchivedStickers();
|
||||
}
|
||||
}
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
void UndoInstallLocally(uint64 setId) {
|
||||
@ -151,7 +151,7 @@ void UndoInstallLocally(uint64 setId) {
|
||||
}
|
||||
|
||||
Local::writeInstalledStickers();
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
|
||||
Ui::show(
|
||||
Box<InformBox>(lang(lng_stickers_not_found)),
|
||||
@ -234,7 +234,7 @@ void SetIsFaved(not_null<DocumentData*> document, base::optional<std::vector<not
|
||||
return;
|
||||
}
|
||||
Local::writeFavedStickers();
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
Auth().api().stickerSetInstalled(FavedSetId);
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ void SetIsNotFaved(not_null<DocumentData*> document) {
|
||||
sets.erase(it);
|
||||
}
|
||||
Local::writeFavedStickers();
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
void SetFaved(not_null<DocumentData*> document, bool faved) {
|
||||
@ -374,7 +374,7 @@ void SetsReceived(const QVector<MTPStickerSet> &data, int32 hash) {
|
||||
LOG(("API Error: received stickers hash %1 while counted hash is %2").arg(hash).arg(Local::countStickersHash()));
|
||||
}
|
||||
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
void SetPackAndEmoji(Set &set, Pack &&pack, const QVector<MTPStickerPack> &packs) {
|
||||
@ -475,7 +475,7 @@ void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector<MTP
|
||||
default: Unexpected("setId in SpecialSetReceived()");
|
||||
}
|
||||
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, int32 hash) {
|
||||
@ -575,7 +575,7 @@ void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVect
|
||||
|
||||
Local::writeFeaturedStickers();
|
||||
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
|
||||
void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
|
||||
@ -598,7 +598,7 @@ void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
|
||||
|
||||
Local::writeSavedGifs();
|
||||
|
||||
Auth().data().markSavedGifsUpdated();
|
||||
Auth().data().notifySavedGifsUpdated();
|
||||
}
|
||||
|
||||
Pack GetListByEmoji(not_null<EmojiPtr> emoji) {
|
||||
@ -792,7 +792,7 @@ Set *FeedSetFull(const MTPmessages_StickerSet &data) {
|
||||
}
|
||||
}
|
||||
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
|
||||
return set;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void Session::animationLoadSettingsChanged() {
|
||||
void Session::notifyPhotoLayoutChanged(not_null<const PhotoData*> photo) {
|
||||
if (const auto i = _photoViews.find(photo); i != end(_photoViews)) {
|
||||
for (const auto view : i->second) {
|
||||
markViewLayoutChange(view);
|
||||
notifyViewLayoutChange(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ void Session::notifyDocumentLayoutChanged(
|
||||
const auto i = _documentViews.find(document);
|
||||
if (i != end(_documentViews)) {
|
||||
for (const auto view : i->second) {
|
||||
markViewLayoutChange(view);
|
||||
notifyViewLayoutChange(view);
|
||||
}
|
||||
}
|
||||
if (const auto items = InlineBots::Layout::documentItems()) {
|
||||
@ -147,27 +147,19 @@ void Session::markMediaRead(not_null<const DocumentData*> document) {
|
||||
}
|
||||
}
|
||||
|
||||
void Session::markItemLayoutChange(not_null<const HistoryItem*> item) {
|
||||
_itemLayoutChanges.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> Session::itemLayoutChanged() const {
|
||||
return _itemLayoutChanges.events();
|
||||
}
|
||||
|
||||
void Session::markViewLayoutChange(not_null<const HistoryView::Element*> view) {
|
||||
void Session::notifyViewLayoutChange(not_null<const ViewElement*> view) {
|
||||
_viewLayoutChanges.fire_copy(view);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryView::Element*>> Session::viewLayoutChanged() const {
|
||||
rpl::producer<not_null<const ViewElement*>> Session::viewLayoutChanged() const {
|
||||
return _viewLayoutChanges.events();
|
||||
}
|
||||
|
||||
void Session::markItemIdChange(IdChange event) {
|
||||
void Session::notifyItemIdChange(IdChange event) {
|
||||
_itemIdChanges.fire_copy(event);
|
||||
enumerateItemViews(event.item, [](not_null<HistoryView::Element*> view) {
|
||||
view->refreshDataId();
|
||||
});
|
||||
enumerateItemViews(
|
||||
event.item,
|
||||
[](not_null<ViewElement*> view) { view->refreshDataId(); });
|
||||
}
|
||||
|
||||
rpl::producer<Session::IdChange> Session::itemIdChanged() const {
|
||||
@ -222,7 +214,7 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemPlayInlineRequest() con
|
||||
return _itemPlayInlineRequest.events();
|
||||
}
|
||||
|
||||
void Session::markItemRemoved(not_null<const HistoryItem*> item) {
|
||||
void Session::notifyItemRemoved(not_null<const HistoryItem*> item) {
|
||||
_itemRemoved.fire_copy(item);
|
||||
}
|
||||
|
||||
@ -230,7 +222,7 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved() const {
|
||||
return _itemRemoved.events();
|
||||
}
|
||||
|
||||
void Session::markHistoryUnloaded(not_null<const History*> history) {
|
||||
void Session::notifyHistoryUnloaded(not_null<const History*> history) {
|
||||
_historyUnloaded.fire_copy(history);
|
||||
}
|
||||
|
||||
@ -238,7 +230,7 @@ rpl::producer<not_null<const History*>> Session::historyUnloaded() const {
|
||||
return _historyUnloaded.events();
|
||||
}
|
||||
|
||||
void Session::markHistoryCleared(not_null<const History*> history) {
|
||||
void Session::notifyHistoryCleared(not_null<const History*> history) {
|
||||
_historyCleared.fire_copy(history);
|
||||
}
|
||||
|
||||
@ -288,7 +280,7 @@ rpl::producer<not_null<UserData*>> Session::megagroupParticipantAdded(
|
||||
});
|
||||
}
|
||||
|
||||
void Session::markStickersUpdated() {
|
||||
void Session::notifyStickersUpdated() {
|
||||
_stickersUpdated.fire({});
|
||||
}
|
||||
|
||||
@ -296,7 +288,7 @@ rpl::producer<> Session::stickersUpdated() const {
|
||||
return _stickersUpdated.events();
|
||||
}
|
||||
|
||||
void Session::markSavedGifsUpdated() {
|
||||
void Session::notifySavedGifsUpdated() {
|
||||
_savedGifsUpdated.fire({});
|
||||
}
|
||||
|
||||
@ -1107,13 +1099,13 @@ void Session::gameApplyFields(
|
||||
|
||||
void Session::registerPhotoView(
|
||||
not_null<const PhotoData*> photo,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
_photoViews[photo].insert(view);
|
||||
}
|
||||
|
||||
void Session::unregisterPhotoView(
|
||||
not_null<const PhotoData*> photo,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
const auto i = _photoViews.find(photo);
|
||||
if (i != _photoViews.end()) {
|
||||
auto &items = i->second;
|
||||
@ -1125,13 +1117,13 @@ void Session::unregisterPhotoView(
|
||||
|
||||
void Session::registerDocumentView(
|
||||
not_null<const DocumentData*> document,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
_documentViews[document].insert(view);
|
||||
}
|
||||
|
||||
void Session::unregisterDocumentView(
|
||||
not_null<const DocumentData*> document,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
const auto i = _documentViews.find(document);
|
||||
if (i != _documentViews.end()) {
|
||||
auto &items = i->second;
|
||||
@ -1161,13 +1153,13 @@ void Session::unregisterDocumentItem(
|
||||
|
||||
void Session::registerWebPageView(
|
||||
not_null<const WebPageData*> page,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
_webpageViews[page].insert(view);
|
||||
}
|
||||
|
||||
void Session::unregisterWebPageView(
|
||||
not_null<const WebPageData*> page,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
const auto i = _webpageViews.find(page);
|
||||
if (i != _webpageViews.end()) {
|
||||
auto &items = i->second;
|
||||
@ -1197,13 +1189,13 @@ void Session::unregisterWebPageItem(
|
||||
|
||||
void Session::registerGameView(
|
||||
not_null<const GameData*> game,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
_gameViews[game].insert(view);
|
||||
}
|
||||
|
||||
void Session::unregisterGameView(
|
||||
not_null<const GameData*> game,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
const auto i = _gameViews.find(game);
|
||||
if (i != _gameViews.end()) {
|
||||
auto &items = i->second;
|
||||
@ -1215,7 +1207,7 @@ void Session::unregisterGameView(
|
||||
|
||||
void Session::registerContactView(
|
||||
UserId contactId,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
if (!contactId) {
|
||||
return;
|
||||
}
|
||||
@ -1224,7 +1216,7 @@ void Session::registerContactView(
|
||||
|
||||
void Session::unregisterContactView(
|
||||
UserId contactId,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
if (!contactId) {
|
||||
return;
|
||||
}
|
||||
@ -1289,7 +1281,7 @@ void Session::unregisterContactItem(
|
||||
|
||||
void Session::registerAutoplayAnimation(
|
||||
not_null<::Media::Clip::Reader*> reader,
|
||||
not_null<HistoryView::Element*> view) {
|
||||
not_null<ViewElement*> view) {
|
||||
_autoplayAnimations.emplace(reader, view);
|
||||
}
|
||||
|
||||
|
@ -61,11 +61,9 @@ public:
|
||||
not_null<HistoryItem*> item;
|
||||
MsgId oldId = 0;
|
||||
};
|
||||
void markItemIdChange(IdChange event);
|
||||
void notifyItemIdChange(IdChange event);
|
||||
rpl::producer<IdChange> itemIdChanged() const;
|
||||
void markItemLayoutChange(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemLayoutChanged() const;
|
||||
void markViewLayoutChange(not_null<const ViewElement*> view);
|
||||
void notifyViewLayoutChange(not_null<const ViewElement*> view);
|
||||
rpl::producer<not_null<const ViewElement*>> viewLayoutChanged() const;
|
||||
void requestItemViewRepaint(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemViewRepaintRequest() const;
|
||||
@ -79,13 +77,14 @@ public:
|
||||
rpl::producer<not_null<const HistoryItem*>> itemViewRefreshRequest() const;
|
||||
void requestItemPlayInline(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemPlayInlineRequest() const;
|
||||
void markItemRemoved(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemRemoved() const;
|
||||
void markHistoryUnloaded(not_null<const History*> history);
|
||||
void notifyHistoryUnloaded(not_null<const History*> history);
|
||||
rpl::producer<not_null<const History*>> historyUnloaded() const;
|
||||
|
||||
void markHistoryCleared(not_null<const History*> history);
|
||||
void notifyItemRemoved(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemRemoved() const;
|
||||
void notifyHistoryCleared(not_null<const History*> history);
|
||||
rpl::producer<not_null<const History*>> historyCleared() const;
|
||||
|
||||
using MegagroupParticipant = std::tuple<
|
||||
not_null<ChannelData*>,
|
||||
not_null<UserData*>>;
|
||||
@ -102,9 +101,9 @@ public:
|
||||
rpl::producer<not_null<UserData*>> megagroupParticipantAdded(
|
||||
not_null<ChannelData*> channel) const;
|
||||
|
||||
void markStickersUpdated();
|
||||
void notifyStickersUpdated();
|
||||
rpl::producer<> stickersUpdated() const;
|
||||
void markSavedGifsUpdated();
|
||||
void notifySavedGifsUpdated();
|
||||
rpl::producer<> savedGifsUpdated() const;
|
||||
|
||||
bool stickersUpdateNeeded(TimeMs now) const {
|
||||
@ -276,16 +275,16 @@ public:
|
||||
|
||||
void registerPhotoView(
|
||||
not_null<const PhotoData*> photo,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void unregisterPhotoView(
|
||||
not_null<const PhotoData*> photo,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void registerDocumentView(
|
||||
not_null<const DocumentData*> document,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void unregisterDocumentView(
|
||||
not_null<const DocumentData*> document,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void registerDocumentItem(
|
||||
not_null<const DocumentData*> document,
|
||||
not_null<HistoryItem*> item);
|
||||
@ -294,10 +293,10 @@ public:
|
||||
not_null<HistoryItem*> item);
|
||||
void registerWebPageView(
|
||||
not_null<const WebPageData*> page,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void unregisterWebPageView(
|
||||
not_null<const WebPageData*> page,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void registerWebPageItem(
|
||||
not_null<const WebPageData*> page,
|
||||
not_null<HistoryItem*> item);
|
||||
@ -306,16 +305,16 @@ public:
|
||||
not_null<HistoryItem*> item);
|
||||
void registerGameView(
|
||||
not_null<const GameData*> game,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void unregisterGameView(
|
||||
not_null<const GameData*> game,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void registerContactView(
|
||||
UserId contactId,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void unregisterContactView(
|
||||
UserId contactId,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void registerContactItem(
|
||||
UserId contactId,
|
||||
not_null<HistoryItem*> item);
|
||||
@ -324,7 +323,7 @@ public:
|
||||
not_null<HistoryItem*> item);
|
||||
void registerAutoplayAnimation(
|
||||
not_null<::Media::Clip::Reader*> reader,
|
||||
not_null<HistoryView::Element*> view);
|
||||
not_null<ViewElement*> view);
|
||||
void unregisterAutoplayAnimation(
|
||||
not_null<::Media::Clip::Reader*> reader);
|
||||
|
||||
@ -439,7 +438,6 @@ private:
|
||||
base::Observable<void> _pendingHistoryResize;
|
||||
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
||||
rpl::event_stream<IdChange> _itemIdChanges;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemLayoutChanges;
|
||||
rpl::event_stream<not_null<const ViewElement*>> _viewLayoutChanges;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemViewRepaintRequest;
|
||||
rpl::event_stream<not_null<const ViewElement*>> _viewRepaintRequest;
|
||||
@ -472,7 +470,7 @@ private:
|
||||
std::unique_ptr<PhotoData>> _photos;
|
||||
std::map<
|
||||
not_null<const PhotoData*>,
|
||||
base::flat_set<not_null<HistoryView::Element*>>> _photoViews;
|
||||
base::flat_set<not_null<ViewElement*>>> _photoViews;
|
||||
std::unordered_map<
|
||||
DocumentId,
|
||||
std::unique_ptr<DocumentData>> _documents;
|
||||
@ -481,7 +479,7 @@ private:
|
||||
base::flat_set<not_null<HistoryItem*>>> _documentItems;
|
||||
std::map<
|
||||
not_null<const DocumentData*>,
|
||||
base::flat_set<not_null<HistoryView::Element*>>> _documentViews;
|
||||
base::flat_set<not_null<ViewElement*>>> _documentViews;
|
||||
std::unordered_map<
|
||||
WebPageId,
|
||||
std::unique_ptr<WebPageData>> _webpages;
|
||||
@ -490,22 +488,22 @@ private:
|
||||
base::flat_set<not_null<HistoryItem*>>> _webpageItems;
|
||||
std::map<
|
||||
not_null<const WebPageData*>,
|
||||
base::flat_set<not_null<HistoryView::Element*>>> _webpageViews;
|
||||
base::flat_set<not_null<ViewElement*>>> _webpageViews;
|
||||
std::unordered_map<
|
||||
GameId,
|
||||
std::unique_ptr<GameData>> _games;
|
||||
std::map<
|
||||
not_null<const GameData*>,
|
||||
base::flat_set<not_null<HistoryView::Element*>>> _gameViews;
|
||||
base::flat_set<not_null<ViewElement*>>> _gameViews;
|
||||
std::map<
|
||||
UserId,
|
||||
base::flat_set<not_null<HistoryItem*>>> _contactItems;
|
||||
std::map<
|
||||
UserId,
|
||||
base::flat_set<not_null<HistoryView::Element*>>> _contactViews;
|
||||
base::flat_set<not_null<ViewElement*>>> _contactViews;
|
||||
base::flat_map<
|
||||
not_null<::Media::Clip::Reader*>,
|
||||
not_null<HistoryView::Element*>> _autoplayAnimations;
|
||||
not_null<ViewElement*>> _autoplayAnimations;
|
||||
|
||||
base::flat_set<not_null<WebPageData*>> _webpagesUpdated;
|
||||
base::flat_set<not_null<GameData*>> _gamesUpdated;
|
||||
@ -515,7 +513,7 @@ private:
|
||||
Groups _groups;
|
||||
std::map<
|
||||
not_null<HistoryItem*>,
|
||||
std::vector<not_null<HistoryView::Element*>>> _views;
|
||||
std::vector<not_null<ViewElement*>>> _views;
|
||||
|
||||
MessageIdsList _mimeForwardIds;
|
||||
|
||||
|
@ -2424,12 +2424,12 @@ void History::clear(bool leaveItems) {
|
||||
forgetScrollState();
|
||||
}
|
||||
if (leaveItems) {
|
||||
Auth().data().markHistoryUnloaded(this);
|
||||
Auth().data().notifyHistoryUnloaded(this);
|
||||
} else {
|
||||
setLastMessage(nullptr);
|
||||
notifies.clear();
|
||||
Auth().storage().remove(Storage::SharedMediaRemoveAll(peer->id));
|
||||
Auth().data().markHistoryCleared(this);
|
||||
Auth().data().notifyHistoryCleared(this);
|
||||
}
|
||||
clearBlocks(leaveItems);
|
||||
if (leaveItems) {
|
||||
|
@ -338,7 +338,7 @@ void HistoryItem::setRealId(MsgId newId) {
|
||||
}
|
||||
}
|
||||
|
||||
Auth().data().markItemIdChange({ this, oldId });
|
||||
Auth().data().notifyItemIdChange({ this, oldId });
|
||||
Auth().data().requestItemViewRepaint(this);
|
||||
}
|
||||
|
||||
@ -630,51 +630,6 @@ bool HistoryItem::isEmpty() const {
|
||||
&& !Has<HistoryMessageLogEntryOriginal>();
|
||||
}
|
||||
|
||||
void HistoryItem::clipCallback(Media::Clip::Notification notification) {
|
||||
using namespace Media::Clip;
|
||||
|
||||
auto media = this->media();
|
||||
if (!media) {
|
||||
return;
|
||||
}
|
||||
|
||||
// #TODO GIFs
|
||||
//auto reader = media->getClipReader();
|
||||
//if (!reader) {
|
||||
// return;
|
||||
//}
|
||||
|
||||
//switch (notification) {
|
||||
//case NotificationReinit: {
|
||||
// auto stopped = false;
|
||||
// if (reader->autoPausedGif()) {
|
||||
// auto amVisible = false;
|
||||
// Auth().data().queryItemVisibility().notify({ this, &amVisible }, true);
|
||||
// if (!amVisible) { // stop animation if it is not visible
|
||||
// media->stopInline();
|
||||
// if (auto document = media->getDocument()) { // forget data from memory
|
||||
// document->forget();
|
||||
// }
|
||||
// stopped = true;
|
||||
// }
|
||||
// } else if (reader->mode() == Media::Clip::Reader::Mode::Video && reader->state() == Media::Clip::State::Finished) {
|
||||
// // Stop finished video message.
|
||||
// media->stopInline();
|
||||
// }
|
||||
// if (!stopped) {
|
||||
// Auth().data().requestItemViewResize(this);
|
||||
// Auth().data().markItemLayoutChange(this);
|
||||
// }
|
||||
//} break;
|
||||
|
||||
//case NotificationRepaint: {
|
||||
// if (!reader->currentDisplayed()) {
|
||||
// Auth().data().requestItemViewRepaint(this);
|
||||
// }
|
||||
//} break;
|
||||
//}
|
||||
}
|
||||
|
||||
void HistoryItem::audioTrackUpdated() {
|
||||
auto media = this->media();
|
||||
if (!media) {
|
||||
|
@ -265,7 +265,6 @@ public:
|
||||
|
||||
MessageGroupId groupId() const;
|
||||
|
||||
void clipCallback(Media::Clip::Notification notification);
|
||||
void audioTrackUpdated();
|
||||
|
||||
HistoryItem *previousItem() const;
|
||||
|
@ -2687,7 +2687,7 @@ bool HistoryGif::playInline(bool autoplay) {
|
||||
: Mode::Gif;
|
||||
setClipReader(Media::Clip::MakeReader(_data, _parent->data()->fullId(), [this](Media::Clip::Notification notification) {
|
||||
// #TODO GIFs
|
||||
_parent->data()->clipCallback(notification);
|
||||
_parent->clipCallback(notification);
|
||||
}, mode));
|
||||
if (mode == Mode::Video) {
|
||||
_roundPlayback = std::make_unique<Media::Clip::Playback>();
|
||||
@ -2717,7 +2717,7 @@ void HistoryGif::stopInline() {
|
||||
clearClipReader();
|
||||
|
||||
Auth().data().requestViewResize(_parent);
|
||||
Auth().data().markViewLayoutChange(_parent);
|
||||
Auth().data().notifyViewLayoutChange(_parent);
|
||||
}
|
||||
|
||||
void HistoryGif::setClipReader(Media::Clip::ReaderPointer gif) {
|
||||
|
@ -646,10 +646,10 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
||||
}
|
||||
}
|
||||
});
|
||||
Auth().data().itemLayoutChanged(
|
||||
) | rpl::start_with_next([this](auto item) {
|
||||
Auth().data().viewLayoutChanged(
|
||||
) | rpl::start_with_next([this](auto view) {
|
||||
if (_peer && _list) {
|
||||
if (const auto view = item->mainView()) {
|
||||
if (view == view->data()->mainView()) {
|
||||
if (view->isUnderCursor()) {
|
||||
_list->onUpdateSelected();
|
||||
}
|
||||
@ -909,7 +909,7 @@ void HistoryWidget::start() {
|
||||
updateStickersByEmoji();
|
||||
}, lifetime());
|
||||
updateRecentStickers();
|
||||
Auth().data().markSavedGifsUpdated();
|
||||
Auth().data().notifySavedGifsUpdated();
|
||||
subscribe(Auth().api().fullPeerUpdated(), [this](PeerData *peer) {
|
||||
fullPeerUpdated(peer);
|
||||
});
|
||||
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "history/view/history_view_element.h"
|
||||
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_media.h"
|
||||
@ -260,6 +261,52 @@ void Element::nextInBlocksChanged() {
|
||||
setAttachToNext(false);
|
||||
}
|
||||
|
||||
void Element::clipCallback(Media::Clip::Notification notification) {
|
||||
using namespace Media::Clip;
|
||||
|
||||
const auto media = this->media();
|
||||
if (!media) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto reader = media->getClipReader();
|
||||
if (!reader) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (notification) {
|
||||
case NotificationReinit: {
|
||||
auto stopped = false;
|
||||
if (reader->autoPausedGif()) {
|
||||
auto amVisible = false;
|
||||
Auth().data().queryItemVisibility().notify({ data(), &amVisible }, true);
|
||||
if (!amVisible) { // stop animation if it is not visible
|
||||
media->stopInline();
|
||||
if (const auto document = media->getDocument()) {
|
||||
document->forget();
|
||||
}
|
||||
stopped = true;
|
||||
}
|
||||
} else if (reader->mode() == Reader::Mode::Video
|
||||
&& reader->state() == State::Finished) {
|
||||
// Stop finished video message.
|
||||
media->stopInline();
|
||||
}
|
||||
if (!stopped) {
|
||||
Auth().data().requestViewResize(this);
|
||||
Auth().data().notifyViewLayoutChange(this);
|
||||
}
|
||||
} break;
|
||||
|
||||
case NotificationRepaint: {
|
||||
if (!reader->currentDisplayed()) {
|
||||
Auth().data().requestViewRepaint(this);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Element::refreshDataId() {
|
||||
if (const auto media = this->media()) {
|
||||
media->refreshParentId(data());
|
||||
|
@ -186,6 +186,8 @@ public:
|
||||
void previousInBlocksChanged();
|
||||
void nextInBlocksChanged();
|
||||
|
||||
void clipCallback(Media::Clip::Notification notification);
|
||||
|
||||
virtual ~Element();
|
||||
|
||||
protected:
|
||||
|
@ -561,10 +561,10 @@ void ListWidget::start() {
|
||||
ObservableViewer(
|
||||
Auth().downloader().taskFinished()
|
||||
) | rpl::start_with_next([this] { update(); }, lifetime());
|
||||
Auth().data().itemLayoutChanged(
|
||||
) | rpl::start_with_next([this](auto item) {
|
||||
itemLayoutChanged(item);
|
||||
}, lifetime());
|
||||
//Auth().data().itemLayoutChanged( // #TODO
|
||||
//) | rpl::start_with_next([this](auto item) {
|
||||
// itemLayoutChanged(item);
|
||||
//}, lifetime());
|
||||
Auth().data().itemRemoved(
|
||||
) | rpl::start_with_next([this](auto item) {
|
||||
itemRemoved(item);
|
||||
|
@ -120,7 +120,7 @@ void DeleteSavedGifClickHandler::onClickImpl() const {
|
||||
|
||||
MTP::send(MTPmessages_SaveGif(_data->mtpInput(), MTP_bool(true)));
|
||||
}
|
||||
Auth().data().markSavedGifsUpdated();
|
||||
Auth().data().notifySavedGifsUpdated();
|
||||
}
|
||||
|
||||
int Gif::resizeGetHeight(int width) {
|
||||
|
@ -5366,7 +5366,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
}
|
||||
Local::writeInstalledStickers();
|
||||
if (writeArchived) Local::writeArchivedStickers();
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5390,7 +5390,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
} else {
|
||||
Auth().data().stickerSetsOrderRef() = std::move(result);
|
||||
Local::writeInstalledStickers();
|
||||
Auth().data().markStickersUpdated();
|
||||
Auth().data().notifyStickersUpdated();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_media_types.h"
|
||||
#include "history/history_media.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "media/media_audio.h"
|
||||
@ -46,7 +47,10 @@ Float::Float(
|
||||
prepareShadow();
|
||||
|
||||
rpl::merge(
|
||||
Auth().data().itemLayoutChanged(),
|
||||
//Auth().data().viewLayoutChanged(
|
||||
//) | rpl::map(
|
||||
// [](auto view) { return view->data(); }
|
||||
//),
|
||||
Auth().data().itemViewRepaintRequest()
|
||||
) | rpl::start_with_next([this](auto item) {
|
||||
if (_item == item) {
|
||||
|
Loading…
Reference in New Issue
Block a user