2018-01-04 13:22:53 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2018-08-29 16:23:16 +03:00
|
|
|
#include "storage/storage_databases.h"
|
2018-01-04 13:22:53 +03:00
|
|
|
#include "chat_helpers/stickers.h"
|
2018-01-04 22:54:35 +03:00
|
|
|
#include "dialogs/dialogs_key.h"
|
2018-01-14 19:02:25 +03:00
|
|
|
#include "data/data_groups.h"
|
2019-01-04 15:09:48 +04:00
|
|
|
#include "data/data_notify_settings.h"
|
2018-10-11 18:54:57 +03:00
|
|
|
#include "history/history_location_manager.h"
|
2018-04-09 21:48:29 +04:00
|
|
|
#include "base/timer.h"
|
2018-01-04 13:22:53 +03:00
|
|
|
|
2018-01-14 19:02:25 +03:00
|
|
|
class HistoryItem;
|
2018-06-28 18:44:07 +01:00
|
|
|
class BoxContent;
|
2018-10-24 15:52:31 +04:00
|
|
|
struct WebPageCollage;
|
2018-10-31 14:11:01 +04:00
|
|
|
enum class WebPageType;
|
2018-01-14 19:02:25 +03:00
|
|
|
|
|
|
|
namespace HistoryView {
|
|
|
|
struct Group;
|
|
|
|
class Element;
|
|
|
|
} // namespace HistoryView
|
2018-01-11 22:33:26 +03:00
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
class AuthSession;
|
|
|
|
|
|
|
|
namespace Media {
|
|
|
|
namespace Clip {
|
|
|
|
class Reader;
|
|
|
|
} // namespace Clip
|
|
|
|
} // namespace Media
|
|
|
|
|
2018-06-20 01:02:36 +01:00
|
|
|
namespace Export {
|
|
|
|
class ControllerWrap;
|
|
|
|
namespace View {
|
|
|
|
class PanelController;
|
|
|
|
} // namespace View
|
|
|
|
} // namespace Export
|
|
|
|
|
2018-07-10 19:41:11 +03:00
|
|
|
namespace Passport {
|
|
|
|
struct SavedCredentials;
|
|
|
|
} // namespace Passport
|
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
class Feed;
|
2018-01-29 16:52:09 +03:00
|
|
|
enum class FeedUpdateFlag;
|
|
|
|
struct FeedUpdate;
|
2018-01-04 13:22:53 +03:00
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
struct WallPaper {
|
|
|
|
int32 id = 0;
|
|
|
|
ImagePtr thumb;
|
|
|
|
ImagePtr full;
|
|
|
|
};
|
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
class Session final {
|
|
|
|
public:
|
2018-01-14 19:02:25 +03:00
|
|
|
using ViewElement = HistoryView::Element;
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
explicit Session(not_null<AuthSession*> session);
|
2018-01-04 13:22:53 +03:00
|
|
|
~Session();
|
|
|
|
|
2018-01-23 19:51:12 +03:00
|
|
|
AuthSession &session() const {
|
|
|
|
return *_session;
|
|
|
|
}
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
void clear();
|
|
|
|
|
2018-07-23 16:11:56 +03:00
|
|
|
void startExport(PeerData *peer = nullptr);
|
|
|
|
void startExport(const MTPInputPeer &singlePeer);
|
2018-06-23 00:18:43 +01:00
|
|
|
void suggestStartExport(TimeId availableAt);
|
2018-06-28 18:44:07 +01:00
|
|
|
void clearExportSuggestion();
|
2018-06-20 01:02:36 +01:00
|
|
|
rpl::producer<Export::View::PanelController*> currentExportView() const;
|
2018-06-20 18:30:57 +01:00
|
|
|
bool exportInProgress() const;
|
|
|
|
void stopExportWithConfirmation(FnMut<void()> callback);
|
|
|
|
void stopExport();
|
2018-06-20 01:02:36 +01:00
|
|
|
|
2018-07-10 19:41:11 +03:00
|
|
|
const Passport::SavedCredentials *passportCredentials() const;
|
|
|
|
void rememberPassportCredentials(
|
|
|
|
Passport::SavedCredentials data,
|
|
|
|
TimeMs rememberFor);
|
|
|
|
void forgetPassportCredentials();
|
|
|
|
|
2018-08-27 14:35:58 +03:00
|
|
|
Storage::Cache::Database &cache();
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
[[nodiscard]] not_null<PeerData*> peer(PeerId id);
|
|
|
|
[[nodiscard]] not_null<UserData*> user(UserId id);
|
|
|
|
[[nodiscard]] not_null<ChatData*> chat(ChatId id);
|
|
|
|
[[nodiscard]] not_null<ChannelData*> channel(ChannelId id);
|
|
|
|
|
|
|
|
[[nodiscard]] PeerData *peerLoaded(PeerId id) const;
|
|
|
|
[[nodiscard]] UserData *userLoaded(UserId id) const;
|
|
|
|
[[nodiscard]] ChatData *chatLoaded(ChatId id) const;
|
|
|
|
[[nodiscard]] ChannelData *channelLoaded(ChannelId id) const;
|
|
|
|
|
|
|
|
not_null<UserData*> user(const MTPUser &data);
|
|
|
|
not_null<PeerData*> chat(const MTPChat &data);
|
|
|
|
|
|
|
|
// Returns last user, if there were any.
|
|
|
|
UserData *processUsers(const MTPVector<MTPUser> &data);
|
|
|
|
PeerData *processChats(const MTPVector<MTPChat> &data);
|
|
|
|
|
|
|
|
void enumerateUsers(Fn<void(not_null<UserData*>)> action) const;
|
|
|
|
void enumerateGroups(Fn<void(not_null<PeerData*>)> action) const;
|
|
|
|
void enumerateChannels(Fn<void(not_null<ChannelData*>)> action) const;
|
|
|
|
[[nodiscard]] PeerData *peerByUsername(const QString &username) const;
|
|
|
|
|
|
|
|
not_null<History*> history(PeerId peerId);
|
|
|
|
History *historyLoaded(PeerId peerId) const;
|
|
|
|
not_null<History*> history(not_null<const PeerData*> peer);
|
|
|
|
History *historyLoaded(const PeerData *peer);
|
|
|
|
|
|
|
|
void registerSendAction(
|
|
|
|
not_null<History*> history,
|
|
|
|
not_null<UserData*> user,
|
|
|
|
const MTPSendMessageAction &action,
|
|
|
|
TimeId when);
|
|
|
|
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] base::Variable<bool> &contactsLoaded() {
|
2018-01-04 13:22:53 +03:00
|
|
|
return _contactsLoaded;
|
|
|
|
}
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] base::Variable<bool> &allChatsLoaded() {
|
2018-01-04 13:22:53 +03:00
|
|
|
return _allChatsLoaded;
|
|
|
|
}
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] base::Observable<void> &moreChatsLoaded() {
|
2018-01-04 13:22:53 +03:00
|
|
|
return _moreChatsLoaded;
|
|
|
|
}
|
2018-01-14 19:02:25 +03:00
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
struct ItemVisibilityQuery {
|
|
|
|
not_null<HistoryItem*> item;
|
|
|
|
not_null<bool*> isVisible;
|
|
|
|
};
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] base::Observable<ItemVisibilityQuery> &queryItemVisibility() {
|
2018-01-04 13:22:53 +03:00
|
|
|
return _queryItemVisibility;
|
|
|
|
}
|
2018-01-14 19:02:25 +03:00
|
|
|
struct IdChange {
|
|
|
|
not_null<HistoryItem*> item;
|
|
|
|
MsgId oldId = 0;
|
|
|
|
};
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifyItemIdChange(IdChange event);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<IdChange> itemIdChanged() const;
|
2018-01-21 22:52:44 +03:00
|
|
|
void notifyItemLayoutChange(not_null<const HistoryItem*> item);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemLayoutChanged() const;
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifyViewLayoutChange(not_null<const ViewElement*> view);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewLayoutChanged() const;
|
2018-01-18 14:46:45 +03:00
|
|
|
void requestItemRepaint(not_null<const HistoryItem*> item);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRepaintRequest() const;
|
2018-01-14 19:02:25 +03:00
|
|
|
void requestViewRepaint(not_null<const ViewElement*> view);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewRepaintRequest() const;
|
2018-01-18 14:46:45 +03:00
|
|
|
void requestItemResize(not_null<const HistoryItem*> item);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemResizeRequest() const;
|
2018-01-18 14:46:45 +03:00
|
|
|
void requestViewResize(not_null<ViewElement*> view);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<ViewElement*>> viewResizeRequest() const;
|
2018-01-18 16:59:22 +03:00
|
|
|
void requestItemViewRefresh(not_null<HistoryItem*> item);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<HistoryItem*>> itemViewRefreshRequest() const;
|
2018-03-13 13:19:06 +03:00
|
|
|
void requestItemTextRefresh(not_null<HistoryItem*> item);
|
2018-01-21 17:49:42 +03:00
|
|
|
void requestAnimationPlayInline(not_null<HistoryItem*> item);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<HistoryItem*>> animationPlayInlineRequest() const;
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifyHistoryUnloaded(not_null<const History*> history);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const History*>> historyUnloaded() const;
|
2018-01-14 19:02:25 +03:00
|
|
|
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifyItemRemoved(not_null<const HistoryItem*> item);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRemoved() const;
|
2018-03-09 14:44:42 +03:00
|
|
|
void notifyViewRemoved(not_null<const ViewElement*> view);
|
|
|
|
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewRemoved() const;
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifyHistoryCleared(not_null<const History*> history);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<const History*>> historyCleared() const;
|
2018-01-18 14:46:45 +03:00
|
|
|
void notifyHistoryChangeDelayed(not_null<History*> history);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<not_null<History*>> historyChanged() const;
|
2018-01-18 12:53:49 +03:00
|
|
|
void sendHistoryChangeNotifications();
|
2018-01-17 21:20:55 +03:00
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
using MegagroupParticipant = std::tuple<
|
|
|
|
not_null<ChannelData*>,
|
|
|
|
not_null<UserData*>>;
|
|
|
|
void removeMegagroupParticipant(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
not_null<UserData*> user);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<MegagroupParticipant> megagroupParticipantRemoved() const;
|
|
|
|
[[nodiscard]] rpl::producer<not_null<UserData*>> megagroupParticipantRemoved(
|
2018-01-04 13:22:53 +03:00
|
|
|
not_null<ChannelData*> channel) const;
|
|
|
|
void addNewMegagroupParticipant(
|
|
|
|
not_null<ChannelData*> channel,
|
|
|
|
not_null<UserData*> user);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<MegagroupParticipant> megagroupParticipantAdded() const;
|
|
|
|
[[nodiscard]] rpl::producer<not_null<UserData*>> megagroupParticipantAdded(
|
2018-01-04 13:22:53 +03:00
|
|
|
not_null<ChannelData*> channel) const;
|
|
|
|
|
2018-01-29 16:52:09 +03:00
|
|
|
void notifyFeedUpdated(not_null<Feed*> feed, FeedUpdateFlag update);
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<FeedUpdate> feedUpdated() const;
|
2018-01-29 16:52:09 +03:00
|
|
|
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifyStickersUpdated();
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<> stickersUpdated() const;
|
2018-01-17 21:20:55 +03:00
|
|
|
void notifySavedGifsUpdated();
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<> savedGifsUpdated() const;
|
2018-01-04 13:22:53 +03:00
|
|
|
|
|
|
|
bool stickersUpdateNeeded(TimeMs now) const {
|
|
|
|
return stickersUpdateNeeded(_lastStickersUpdate, now);
|
|
|
|
}
|
|
|
|
void setLastStickersUpdate(TimeMs update) {
|
|
|
|
_lastStickersUpdate = update;
|
|
|
|
}
|
|
|
|
bool recentStickersUpdateNeeded(TimeMs now) const {
|
|
|
|
return stickersUpdateNeeded(_lastRecentStickersUpdate, now);
|
|
|
|
}
|
|
|
|
void setLastRecentStickersUpdate(TimeMs update) {
|
|
|
|
_lastRecentStickersUpdate = update;
|
|
|
|
}
|
|
|
|
bool favedStickersUpdateNeeded(TimeMs now) const {
|
|
|
|
return stickersUpdateNeeded(_lastFavedStickersUpdate, now);
|
|
|
|
}
|
|
|
|
void setLastFavedStickersUpdate(TimeMs update) {
|
|
|
|
_lastFavedStickersUpdate = update;
|
|
|
|
}
|
|
|
|
bool featuredStickersUpdateNeeded(TimeMs now) const {
|
|
|
|
return stickersUpdateNeeded(_lastFeaturedStickersUpdate, now);
|
|
|
|
}
|
|
|
|
void setLastFeaturedStickersUpdate(TimeMs update) {
|
|
|
|
_lastFeaturedStickersUpdate = update;
|
|
|
|
}
|
|
|
|
bool savedGifsUpdateNeeded(TimeMs now) const {
|
|
|
|
return stickersUpdateNeeded(_lastSavedGifsUpdate, now);
|
|
|
|
}
|
|
|
|
void setLastSavedGifsUpdate(TimeMs update) {
|
|
|
|
_lastSavedGifsUpdate = update;
|
|
|
|
}
|
|
|
|
int featuredStickerSetsUnreadCount() const {
|
|
|
|
return _featuredStickerSetsUnreadCount.current();
|
|
|
|
}
|
|
|
|
void setFeaturedStickerSetsUnreadCount(int count) {
|
|
|
|
_featuredStickerSetsUnreadCount = count;
|
|
|
|
}
|
2018-03-07 16:53:12 +03:00
|
|
|
[[nodiscard]] rpl::producer<int> featuredStickerSetsUnreadCountValue() const {
|
2018-01-04 13:22:53 +03:00
|
|
|
return _featuredStickerSetsUnreadCount.value();
|
|
|
|
}
|
|
|
|
const Stickers::Sets &stickerSets() const {
|
|
|
|
return _stickerSets;
|
|
|
|
}
|
|
|
|
Stickers::Sets &stickerSetsRef() {
|
|
|
|
return _stickerSets;
|
|
|
|
}
|
|
|
|
const Stickers::Order &stickerSetsOrder() const {
|
|
|
|
return _stickerSetsOrder;
|
|
|
|
}
|
|
|
|
Stickers::Order &stickerSetsOrderRef() {
|
|
|
|
return _stickerSetsOrder;
|
|
|
|
}
|
|
|
|
const Stickers::Order &featuredStickerSetsOrder() const {
|
|
|
|
return _featuredStickerSetsOrder;
|
|
|
|
}
|
|
|
|
Stickers::Order &featuredStickerSetsOrderRef() {
|
|
|
|
return _featuredStickerSetsOrder;
|
|
|
|
}
|
|
|
|
const Stickers::Order &archivedStickerSetsOrder() const {
|
|
|
|
return _archivedStickerSetsOrder;
|
|
|
|
}
|
|
|
|
Stickers::Order &archivedStickerSetsOrderRef() {
|
|
|
|
return _archivedStickerSetsOrder;
|
|
|
|
}
|
|
|
|
const Stickers::SavedGifs &savedGifs() const {
|
|
|
|
return _savedGifs;
|
|
|
|
}
|
|
|
|
Stickers::SavedGifs &savedGifsRef() {
|
|
|
|
return _savedGifs;
|
|
|
|
}
|
|
|
|
|
|
|
|
HistoryItemsList idsToItems(const MessageIdsList &ids) const;
|
|
|
|
MessageIdsList itemsToIds(const HistoryItemsList &items) const;
|
2018-01-11 18:51:59 +03:00
|
|
|
MessageIdsList itemOrItsGroup(not_null<HistoryItem*> item) const;
|
2018-01-04 13:22:53 +03:00
|
|
|
|
2018-01-04 22:54:35 +03:00
|
|
|
int pinnedDialogsCount() const;
|
|
|
|
const std::deque<Dialogs::Key> &pinnedDialogsOrder() const;
|
|
|
|
void setPinnedDialog(const Dialogs::Key &key, bool pinned);
|
|
|
|
void applyPinnedDialogs(const QVector<MTPDialog> &list);
|
|
|
|
void applyPinnedDialogs(const QVector<MTPDialogPeer> &list);
|
|
|
|
void reorderTwoPinnedDialogs(
|
|
|
|
const Dialogs::Key &key1,
|
|
|
|
const Dialogs::Key &key2);
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
void photoLoadSettingsChanged();
|
2018-12-06 19:47:28 +04:00
|
|
|
void documentLoadSettingsChanged();
|
2018-01-17 19:21:01 +03:00
|
|
|
|
|
|
|
void notifyPhotoLayoutChanged(not_null<const PhotoData*> photo);
|
|
|
|
void notifyDocumentLayoutChanged(
|
|
|
|
not_null<const DocumentData*> document);
|
|
|
|
void requestDocumentViewRepaint(not_null<const DocumentData*> document);
|
|
|
|
void markMediaRead(not_null<const DocumentData*> document);
|
2018-12-18 09:43:11 +04:00
|
|
|
void requestPollViewRepaint(not_null<const PollData*> poll);
|
2018-01-17 19:21:01 +03:00
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
HistoryItem *addNewMessage(const MTPMessage &data, NewMessageType type);
|
|
|
|
|
|
|
|
struct SendActionAnimationUpdate {
|
|
|
|
not_null<History*> history;
|
|
|
|
int width = 0;
|
|
|
|
int height = 0;
|
|
|
|
bool textUpdated = false;
|
|
|
|
};
|
|
|
|
[[nodiscard]] auto sendActionAnimationUpdated() const
|
|
|
|
-> rpl::producer<SendActionAnimationUpdate>;
|
|
|
|
void updateSendActionAnimation(SendActionAnimationUpdate &&update);
|
|
|
|
|
|
|
|
void updateSendActionAnimation();
|
|
|
|
|
|
|
|
int unreadBadge() const;
|
|
|
|
bool unreadBadgeMuted() const;
|
|
|
|
int unreadBadgeIgnoreOne(History *history) const;
|
|
|
|
bool unreadBadgeMutedIgnoreOne(History *history) const;
|
|
|
|
int unreadOnlyMutedBadge() const;
|
|
|
|
|
|
|
|
void unreadIncrement(int count, bool muted);
|
|
|
|
void unreadMuteChanged(int count, bool muted);
|
|
|
|
void unreadEntriesChanged(
|
|
|
|
int withUnreadDelta,
|
|
|
|
int mutedWithUnreadDelta);
|
|
|
|
|
|
|
|
void selfDestructIn(not_null<HistoryItem*> item, TimeMs delay);
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<PhotoData*> photo(PhotoId id);
|
|
|
|
not_null<PhotoData*> photo(const MTPPhoto &data);
|
|
|
|
not_null<PhotoData*> photo(const MTPDphoto &data);
|
|
|
|
not_null<PhotoData*> photo(
|
|
|
|
const MTPPhoto &data,
|
|
|
|
const PreparedPhotoThumbs &thumbs);
|
|
|
|
not_null<PhotoData*> photo(
|
|
|
|
PhotoId id,
|
|
|
|
const uint64 &access,
|
2018-07-13 19:49:46 +03:00
|
|
|
const QByteArray &fileReference,
|
2018-01-17 19:21:01 +03:00
|
|
|
TimeId date,
|
|
|
|
const ImagePtr &thumb,
|
|
|
|
const ImagePtr &medium,
|
|
|
|
const ImagePtr &full);
|
|
|
|
void photoConvert(
|
|
|
|
not_null<PhotoData*> original,
|
|
|
|
const MTPPhoto &data);
|
2018-10-23 13:08:50 +04:00
|
|
|
PhotoData *photoFromWeb(
|
|
|
|
const MTPWebDocument &data,
|
|
|
|
ImagePtr thumb = ImagePtr(),
|
|
|
|
bool willBecomeNormal = false);
|
2018-01-17 19:21:01 +03:00
|
|
|
|
|
|
|
not_null<DocumentData*> document(DocumentId id);
|
|
|
|
not_null<DocumentData*> document(const MTPDocument &data);
|
|
|
|
not_null<DocumentData*> document(const MTPDdocument &data);
|
|
|
|
not_null<DocumentData*> document(
|
|
|
|
const MTPdocument &data,
|
2018-10-12 19:41:51 +03:00
|
|
|
QImage &&thumb);
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<DocumentData*> document(
|
|
|
|
DocumentId id,
|
|
|
|
const uint64 &access,
|
2018-07-13 19:49:46 +03:00
|
|
|
const QByteArray &fileReference,
|
2018-01-17 19:21:01 +03:00
|
|
|
TimeId date,
|
|
|
|
const QVector<MTPDocumentAttribute> &attributes,
|
|
|
|
const QString &mime,
|
|
|
|
const ImagePtr &thumb,
|
|
|
|
int32 dc,
|
|
|
|
int32 size,
|
|
|
|
const StorageImageLocation &thumbLocation);
|
|
|
|
void documentConvert(
|
|
|
|
not_null<DocumentData*> original,
|
|
|
|
const MTPDocument &data);
|
2018-03-04 23:04:13 +03:00
|
|
|
DocumentData *documentFromWeb(
|
|
|
|
const MTPWebDocument &data,
|
|
|
|
ImagePtr thumb);
|
2018-01-17 19:21:01 +03:00
|
|
|
|
|
|
|
not_null<WebPageData*> webpage(WebPageId id);
|
|
|
|
not_null<WebPageData*> webpage(const MTPWebPage &data);
|
|
|
|
not_null<WebPageData*> webpage(const MTPDwebPage &data);
|
|
|
|
not_null<WebPageData*> webpage(const MTPDwebPagePending &data);
|
|
|
|
not_null<WebPageData*> webpage(
|
|
|
|
WebPageId id,
|
|
|
|
const QString &siteName,
|
|
|
|
const TextWithEntities &content);
|
|
|
|
not_null<WebPageData*> webpage(
|
|
|
|
WebPageId id,
|
2018-10-31 14:11:01 +04:00
|
|
|
WebPageType type,
|
2018-01-17 19:21:01 +03:00
|
|
|
const QString &url,
|
|
|
|
const QString &displayUrl,
|
|
|
|
const QString &siteName,
|
|
|
|
const QString &title,
|
|
|
|
const TextWithEntities &description,
|
|
|
|
PhotoData *photo,
|
|
|
|
DocumentData *document,
|
2018-10-24 15:52:31 +04:00
|
|
|
WebPageCollage &&collage,
|
2018-01-17 19:21:01 +03:00
|
|
|
int duration,
|
|
|
|
const QString &author,
|
|
|
|
TimeId pendingTill);
|
|
|
|
|
|
|
|
not_null<GameData*> game(GameId id);
|
|
|
|
not_null<GameData*> game(const MTPDgame &data);
|
|
|
|
not_null<GameData*> game(
|
|
|
|
GameId id,
|
|
|
|
const uint64 &accessHash,
|
|
|
|
const QString &shortName,
|
|
|
|
const QString &title,
|
|
|
|
const QString &description,
|
|
|
|
PhotoData *photo,
|
|
|
|
DocumentData *document);
|
|
|
|
void gameConvert(
|
|
|
|
not_null<GameData*> original,
|
|
|
|
const MTPGame &data);
|
|
|
|
|
2018-12-18 09:43:11 +04:00
|
|
|
not_null<PollData*> poll(PollId id);
|
|
|
|
not_null<PollData*> poll(const MTPPoll &data);
|
|
|
|
not_null<PollData*> poll(const MTPDmessageMediaPoll &data);
|
|
|
|
void applyPollUpdate(const MTPDupdateMessagePoll &update);
|
|
|
|
|
2018-10-11 18:54:57 +03:00
|
|
|
not_null<LocationData*> location(const LocationCoords &coords);
|
|
|
|
|
2018-01-21 22:52:44 +03:00
|
|
|
void registerPhotoItem(
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const PhotoData*> photo,
|
2018-01-21 22:52:44 +03:00
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void unregisterPhotoItem(
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const PhotoData*> photo,
|
2018-01-21 22:52:44 +03:00
|
|
|
not_null<HistoryItem*> item);
|
2018-01-17 19:21:01 +03:00
|
|
|
void registerDocumentItem(
|
|
|
|
not_null<const DocumentData*> document,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void unregisterDocumentItem(
|
|
|
|
not_null<const DocumentData*> document,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void registerWebPageView(
|
|
|
|
not_null<const WebPageData*> page,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void unregisterWebPageView(
|
|
|
|
not_null<const WebPageData*> page,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void registerWebPageItem(
|
|
|
|
not_null<const WebPageData*> page,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void unregisterWebPageItem(
|
|
|
|
not_null<const WebPageData*> page,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void registerGameView(
|
|
|
|
not_null<const GameData*> game,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void unregisterGameView(
|
|
|
|
not_null<const GameData*> game,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-12-18 09:43:11 +04:00
|
|
|
void registerPollView(
|
|
|
|
not_null<const PollData*> poll,
|
|
|
|
not_null<ViewElement*> view);
|
|
|
|
void unregisterPollView(
|
|
|
|
not_null<const PollData*> poll,
|
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void registerContactView(
|
|
|
|
UserId contactId,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void unregisterContactView(
|
|
|
|
UserId contactId,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void registerContactItem(
|
|
|
|
UserId contactId,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void unregisterContactItem(
|
|
|
|
UserId contactId,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void registerAutoplayAnimation(
|
|
|
|
not_null<::Media::Clip::Reader*> reader,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*> view);
|
2018-01-17 19:21:01 +03:00
|
|
|
void unregisterAutoplayAnimation(
|
|
|
|
not_null<::Media::Clip::Reader*> reader);
|
|
|
|
|
|
|
|
HistoryItem *findWebPageItem(not_null<WebPageData*> page) const;
|
|
|
|
QString findContactPhone(not_null<UserData*> contact) const;
|
|
|
|
QString findContactPhone(UserId contactId) const;
|
|
|
|
|
|
|
|
void notifyWebPageUpdateDelayed(not_null<WebPageData*> page);
|
|
|
|
void notifyGameUpdateDelayed(not_null<GameData*> game);
|
2018-12-18 09:43:11 +04:00
|
|
|
void notifyPollUpdateDelayed(not_null<PollData*> poll);
|
|
|
|
bool hasPendingWebPageGamePollNotification() const;
|
|
|
|
void sendWebPageGamePollNotifications();
|
2018-01-17 19:21:01 +03:00
|
|
|
|
|
|
|
void stopAutoplayAnimations();
|
|
|
|
|
|
|
|
void registerItemView(not_null<ViewElement*> view);
|
|
|
|
void unregisterItemView(not_null<ViewElement*> view);
|
|
|
|
|
2018-01-29 16:52:09 +03:00
|
|
|
not_null<Feed*> feed(FeedId id);
|
|
|
|
Feed *feedLoaded(FeedId id);
|
2018-02-08 12:20:14 +03:00
|
|
|
void setDefaultFeedId(FeedId id);
|
|
|
|
FeedId defaultFeedId() const;
|
|
|
|
rpl::producer<FeedId> defaultFeedIdValue() const;
|
2018-01-04 13:22:53 +03:00
|
|
|
|
2018-04-09 21:48:29 +04:00
|
|
|
void requestNotifySettings(not_null<PeerData*> peer);
|
|
|
|
void applyNotifySetting(
|
|
|
|
const MTPNotifyPeer ¬ifyPeer,
|
|
|
|
const MTPPeerNotifySettings &settings);
|
|
|
|
void updateNotifySettings(
|
|
|
|
not_null<PeerData*> peer,
|
2018-09-21 19:28:46 +03:00
|
|
|
std::optional<int> muteForSeconds,
|
|
|
|
std::optional<bool> silentPosts = std::nullopt);
|
2018-04-09 21:48:29 +04:00
|
|
|
bool notifyIsMuted(
|
|
|
|
not_null<const PeerData*> peer,
|
|
|
|
TimeMs *changesIn = nullptr) const;
|
|
|
|
bool notifySilentPosts(not_null<const PeerData*> peer) const;
|
|
|
|
bool notifyMuteUnknown(not_null<const PeerData*> peer) const;
|
|
|
|
bool notifySilentPostsUnknown(not_null<const PeerData*> peer) const;
|
|
|
|
bool notifySettingsUnknown(not_null<const PeerData*> peer) const;
|
|
|
|
rpl::producer<> defaultUserNotifyUpdates() const;
|
|
|
|
rpl::producer<> defaultChatNotifyUpdates() const;
|
2018-11-06 15:10:20 +04:00
|
|
|
rpl::producer<> defaultBroadcastNotifyUpdates() const;
|
2018-04-09 21:48:29 +04:00
|
|
|
rpl::producer<> defaultNotifyUpdates(
|
|
|
|
not_null<const PeerData*> peer) const;
|
|
|
|
|
2018-09-27 23:31:48 +03:00
|
|
|
void serviceNotification(
|
|
|
|
const TextWithEntities &message,
|
2018-10-05 11:14:00 +03:00
|
|
|
const MTPMessageMedia &media = MTP_messageMediaEmpty());
|
2018-11-20 14:03:44 +04:00
|
|
|
void checkNewAuthorization();
|
|
|
|
rpl::producer<> newAuthorizationChecks() const;
|
2018-09-27 23:31:48 +03:00
|
|
|
|
2018-01-11 18:51:59 +03:00
|
|
|
void setMimeForwardIds(MessageIdsList &&list);
|
|
|
|
MessageIdsList takeMimeForwardIds();
|
|
|
|
|
2018-05-11 17:03:53 +03:00
|
|
|
void setProxyPromoted(PeerData *promoted);
|
|
|
|
PeerData *proxyPromoted() const;
|
|
|
|
|
2018-01-14 19:02:25 +03:00
|
|
|
Groups &groups() {
|
|
|
|
return _groups;
|
|
|
|
}
|
|
|
|
const Groups &groups() const {
|
|
|
|
return _groups;
|
|
|
|
}
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
int wallpapersCount() const;
|
|
|
|
const WallPaper &wallpaper(int index) const;
|
|
|
|
void setWallpapers(const QVector<MTPWallPaper> &data);
|
|
|
|
|
|
|
|
void clearLocalStorage();
|
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
private:
|
2018-06-23 00:18:43 +01:00
|
|
|
void suggestStartExport();
|
|
|
|
|
2018-02-08 12:20:14 +03:00
|
|
|
void setupContactViewsViewer();
|
|
|
|
void setupChannelLeavingViewer();
|
2019-01-03 16:36:01 +04:00
|
|
|
|
|
|
|
void checkSelfDestructItems();
|
|
|
|
int computeUnreadBadge(
|
|
|
|
int full,
|
|
|
|
int muted,
|
|
|
|
int entriesFull,
|
|
|
|
int entriesMuted) const;
|
|
|
|
bool computeUnreadBadgeMuted(
|
|
|
|
int full,
|
|
|
|
int muted,
|
|
|
|
int entriesFull,
|
|
|
|
int entriesMuted) const;
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
void photoApplyFields(
|
|
|
|
not_null<PhotoData*> photo,
|
|
|
|
const MTPPhoto &data);
|
|
|
|
void photoApplyFields(
|
|
|
|
not_null<PhotoData*> photo,
|
|
|
|
const MTPDphoto &data);
|
|
|
|
void photoApplyFields(
|
|
|
|
not_null<PhotoData*> photo,
|
|
|
|
const uint64 &access,
|
2018-07-13 19:49:46 +03:00
|
|
|
const QByteArray &fileReference,
|
2018-01-17 19:21:01 +03:00
|
|
|
TimeId date,
|
|
|
|
const ImagePtr &thumb,
|
|
|
|
const ImagePtr &medium,
|
|
|
|
const ImagePtr &full);
|
|
|
|
|
|
|
|
void documentApplyFields(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
const MTPDocument &data);
|
|
|
|
void documentApplyFields(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
const MTPDdocument &data);
|
|
|
|
void documentApplyFields(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
const uint64 &access,
|
2018-07-13 19:49:46 +03:00
|
|
|
const QByteArray &fileReference,
|
2018-01-17 19:21:01 +03:00
|
|
|
TimeId date,
|
|
|
|
const QVector<MTPDocumentAttribute> &attributes,
|
|
|
|
const QString &mime,
|
|
|
|
const ImagePtr &thumb,
|
|
|
|
int32 dc,
|
|
|
|
int32 size,
|
|
|
|
const StorageImageLocation &thumbLocation);
|
2018-03-04 23:04:13 +03:00
|
|
|
DocumentData *documentFromWeb(
|
|
|
|
const MTPDwebDocument &data,
|
|
|
|
ImagePtr thumb);
|
|
|
|
DocumentData *documentFromWeb(
|
|
|
|
const MTPDwebDocumentNoProxy &data,
|
|
|
|
ImagePtr thumb);
|
2018-01-17 19:21:01 +03:00
|
|
|
|
|
|
|
void webpageApplyFields(
|
|
|
|
not_null<WebPageData*> page,
|
|
|
|
const MTPDwebPage &data);
|
|
|
|
void webpageApplyFields(
|
|
|
|
not_null<WebPageData*> page,
|
2018-10-31 14:11:01 +04:00
|
|
|
WebPageType type,
|
2018-01-17 19:21:01 +03:00
|
|
|
const QString &url,
|
|
|
|
const QString &displayUrl,
|
|
|
|
const QString &siteName,
|
|
|
|
const QString &title,
|
|
|
|
const TextWithEntities &description,
|
|
|
|
PhotoData *photo,
|
|
|
|
DocumentData *document,
|
2018-10-24 15:52:31 +04:00
|
|
|
WebPageCollage &&collage,
|
2018-01-17 19:21:01 +03:00
|
|
|
int duration,
|
|
|
|
const QString &author,
|
|
|
|
TimeId pendingTill);
|
|
|
|
|
|
|
|
void gameApplyFields(
|
|
|
|
not_null<GameData*> game,
|
|
|
|
const MTPDgame &data);
|
|
|
|
void gameApplyFields(
|
|
|
|
not_null<GameData*> game,
|
|
|
|
const uint64 &accessHash,
|
|
|
|
const QString &shortName,
|
|
|
|
const QString &title,
|
|
|
|
const QString &description,
|
|
|
|
PhotoData *photo,
|
|
|
|
DocumentData *document);
|
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
bool stickersUpdateNeeded(TimeMs lastUpdate, TimeMs now) const {
|
|
|
|
constexpr auto kStickersUpdateTimeout = TimeMs(3600'000);
|
|
|
|
return (lastUpdate == 0)
|
|
|
|
|| (now >= lastUpdate + kStickersUpdateTimeout);
|
|
|
|
}
|
|
|
|
void userIsContactUpdated(not_null<UserData*> user);
|
|
|
|
|
2018-01-04 22:54:35 +03:00
|
|
|
void clearPinnedDialogs();
|
|
|
|
void setIsPinned(const Dialogs::Key &key, bool pinned);
|
|
|
|
|
2018-04-09 21:48:29 +04:00
|
|
|
NotifySettings &defaultNotifySettings(not_null<const PeerData*> peer);
|
|
|
|
const NotifySettings &defaultNotifySettings(
|
|
|
|
not_null<const PeerData*> peer) const;
|
|
|
|
void unmuteByFinished();
|
|
|
|
void unmuteByFinishedDelayed(TimeMs delay);
|
|
|
|
void updateNotifySettingsLocal(not_null<PeerData*> peer);
|
|
|
|
void sendNotifySettingsUpdates();
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
template <typename Method>
|
2018-01-18 14:46:45 +03:00
|
|
|
void enumerateItemViews(
|
|
|
|
not_null<const HistoryItem*> item,
|
|
|
|
Method method);
|
2018-01-17 19:21:01 +03:00
|
|
|
|
2018-09-27 23:31:48 +03:00
|
|
|
void insertCheckedServiceNotification(
|
|
|
|
const TextWithEntities &message,
|
|
|
|
const MTPMessageMedia &media,
|
|
|
|
TimeId date);
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
void step_typings(TimeMs ms, bool timer);
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<AuthSession*> _session;
|
|
|
|
|
2018-08-29 16:23:16 +03:00
|
|
|
Storage::DatabasePointer _cache;
|
2018-08-27 14:35:58 +03:00
|
|
|
|
2018-06-20 01:02:36 +01:00
|
|
|
std::unique_ptr<Export::ControllerWrap> _export;
|
|
|
|
std::unique_ptr<Export::View::PanelController> _exportPanel;
|
|
|
|
rpl::event_stream<Export::View::PanelController*> _exportViewChanges;
|
2018-06-23 00:18:43 +01:00
|
|
|
TimeId _exportAvailableAt = 0;
|
2018-06-28 18:44:07 +01:00
|
|
|
QPointer<BoxContent> _exportSuggestion;
|
2018-06-20 01:02:36 +01:00
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
base::Variable<bool> _contactsLoaded = { false };
|
|
|
|
base::Variable<bool> _allChatsLoaded = { false };
|
|
|
|
base::Observable<void> _moreChatsLoaded;
|
|
|
|
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
2018-01-14 19:02:25 +03:00
|
|
|
rpl::event_stream<IdChange> _itemIdChanges;
|
2018-01-21 22:52:44 +03:00
|
|
|
rpl::event_stream<not_null<const HistoryItem*>> _itemLayoutChanges;
|
2018-01-14 19:02:25 +03:00
|
|
|
rpl::event_stream<not_null<const ViewElement*>> _viewLayoutChanges;
|
2018-01-18 14:46:45 +03:00
|
|
|
rpl::event_stream<not_null<const HistoryItem*>> _itemRepaintRequest;
|
2018-01-14 19:02:25 +03:00
|
|
|
rpl::event_stream<not_null<const ViewElement*>> _viewRepaintRequest;
|
2018-01-18 14:46:45 +03:00
|
|
|
rpl::event_stream<not_null<const HistoryItem*>> _itemResizeRequest;
|
|
|
|
rpl::event_stream<not_null<ViewElement*>> _viewResizeRequest;
|
2018-01-18 16:59:22 +03:00
|
|
|
rpl::event_stream<not_null<HistoryItem*>> _itemViewRefreshRequest;
|
2018-03-13 13:19:06 +03:00
|
|
|
rpl::event_stream<not_null<HistoryItem*>> _itemTextRefreshRequest;
|
2018-01-21 17:49:42 +03:00
|
|
|
rpl::event_stream<not_null<HistoryItem*>> _animationPlayInlineRequest;
|
2018-01-04 13:22:53 +03:00
|
|
|
rpl::event_stream<not_null<const HistoryItem*>> _itemRemoved;
|
2018-03-09 14:44:42 +03:00
|
|
|
rpl::event_stream<not_null<const ViewElement*>> _viewRemoved;
|
2018-01-04 13:22:53 +03:00
|
|
|
rpl::event_stream<not_null<const History*>> _historyUnloaded;
|
|
|
|
rpl::event_stream<not_null<const History*>> _historyCleared;
|
2018-01-18 14:46:45 +03:00
|
|
|
base::flat_set<not_null<History*>> _historiesChanged;
|
|
|
|
rpl::event_stream<not_null<History*>> _historyChanged;
|
2018-01-04 13:22:53 +03:00
|
|
|
rpl::event_stream<MegagroupParticipant> _megagroupParticipantRemoved;
|
|
|
|
rpl::event_stream<MegagroupParticipant> _megagroupParticipantAdded;
|
2018-01-29 16:52:09 +03:00
|
|
|
rpl::event_stream<FeedUpdate> _feedUpdates;
|
2018-01-04 13:22:53 +03:00
|
|
|
|
|
|
|
rpl::event_stream<> _stickersUpdated;
|
|
|
|
rpl::event_stream<> _savedGifsUpdated;
|
|
|
|
TimeMs _lastStickersUpdate = 0;
|
|
|
|
TimeMs _lastRecentStickersUpdate = 0;
|
|
|
|
TimeMs _lastFavedStickersUpdate = 0;
|
|
|
|
TimeMs _lastFeaturedStickersUpdate = 0;
|
|
|
|
TimeMs _lastSavedGifsUpdate = 0;
|
|
|
|
rpl::variable<int> _featuredStickerSetsUnreadCount = 0;
|
|
|
|
Stickers::Sets _stickerSets;
|
|
|
|
Stickers::Order _stickerSetsOrder;
|
|
|
|
Stickers::Order _featuredStickerSetsOrder;
|
|
|
|
Stickers::Order _archivedStickerSetsOrder;
|
|
|
|
Stickers::SavedGifs _savedGifs;
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
int _unreadFull = 0;
|
|
|
|
int _unreadMuted = 0;
|
|
|
|
int _unreadEntriesFull = 0;
|
|
|
|
int _unreadEntriesMuted = 0;
|
|
|
|
|
|
|
|
base::Timer _selfDestructTimer;
|
|
|
|
std::vector<FullMsgId> _selfDestructItems;
|
|
|
|
|
|
|
|
// When typing in this history started.
|
|
|
|
base::flat_map<not_null<History*>, TimeMs> _sendActions;
|
|
|
|
BasicAnimation _a_sendActions;
|
|
|
|
|
2018-01-17 19:21:01 +03:00
|
|
|
std::unordered_map<
|
|
|
|
PhotoId,
|
|
|
|
std::unique_ptr<PhotoData>> _photos;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const PhotoData*>,
|
2018-01-21 22:52:44 +03:00
|
|
|
base::flat_set<not_null<HistoryItem*>>> _photoItems;
|
2018-01-17 19:21:01 +03:00
|
|
|
std::unordered_map<
|
|
|
|
DocumentId,
|
|
|
|
std::unique_ptr<DocumentData>> _documents;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const DocumentData*>,
|
|
|
|
base::flat_set<not_null<HistoryItem*>>> _documentItems;
|
|
|
|
std::unordered_map<
|
|
|
|
WebPageId,
|
|
|
|
std::unique_ptr<WebPageData>> _webpages;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const WebPageData*>,
|
|
|
|
base::flat_set<not_null<HistoryItem*>>> _webpageItems;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const WebPageData*>,
|
2018-01-17 21:20:55 +03:00
|
|
|
base::flat_set<not_null<ViewElement*>>> _webpageViews;
|
2018-12-18 09:43:11 +04:00
|
|
|
std::unordered_map<
|
|
|
|
LocationCoords,
|
|
|
|
std::unique_ptr<LocationData>> _locations;
|
|
|
|
std::unordered_map<
|
|
|
|
PollId,
|
|
|
|
std::unique_ptr<PollData>> _polls;
|
2018-01-17 19:21:01 +03:00
|
|
|
std::unordered_map<
|
|
|
|
GameId,
|
|
|
|
std::unique_ptr<GameData>> _games;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<const GameData*>,
|
2018-01-17 21:20:55 +03:00
|
|
|
base::flat_set<not_null<ViewElement*>>> _gameViews;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-12-18 09:43:11 +04:00
|
|
|
not_null<const PollData*>,
|
|
|
|
base::flat_set<not_null<ViewElement*>>> _pollViews;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
UserId,
|
|
|
|
base::flat_set<not_null<HistoryItem*>>> _contactItems;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-17 19:21:01 +03:00
|
|
|
UserId,
|
2018-01-17 21:20:55 +03:00
|
|
|
base::flat_set<not_null<ViewElement*>>> _contactViews;
|
2018-01-17 19:21:01 +03:00
|
|
|
base::flat_map<
|
|
|
|
not_null<::Media::Clip::Reader*>,
|
2018-01-17 21:20:55 +03:00
|
|
|
not_null<ViewElement*>> _autoplayAnimations;
|
2018-01-17 19:21:01 +03:00
|
|
|
|
|
|
|
base::flat_set<not_null<WebPageData*>> _webpagesUpdated;
|
|
|
|
base::flat_set<not_null<GameData*>> _gamesUpdated;
|
2018-12-18 09:43:11 +04:00
|
|
|
base::flat_set<not_null<PollData*>> _pollsUpdated;
|
2018-01-17 19:21:01 +03:00
|
|
|
|
2018-01-04 22:54:35 +03:00
|
|
|
std::deque<Dialogs::Key> _pinnedDialogs;
|
2018-01-29 16:52:09 +03:00
|
|
|
base::flat_map<FeedId, std::unique_ptr<Feed>> _feeds;
|
2018-02-08 12:20:14 +03:00
|
|
|
rpl::variable<FeedId> _defaultFeedId = FeedId();
|
2018-01-14 19:02:25 +03:00
|
|
|
Groups _groups;
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<
|
2018-01-18 14:46:45 +03:00
|
|
|
not_null<const HistoryItem*>,
|
2018-01-17 21:20:55 +03:00
|
|
|
std::vector<not_null<ViewElement*>>> _views;
|
2018-01-04 13:22:53 +03:00
|
|
|
|
2018-05-11 17:03:53 +03:00
|
|
|
PeerData *_proxyPromoted = nullptr;
|
|
|
|
|
2018-04-09 21:48:29 +04:00
|
|
|
NotifySettings _defaultUserNotifySettings;
|
|
|
|
NotifySettings _defaultChatNotifySettings;
|
2018-11-06 15:10:20 +04:00
|
|
|
NotifySettings _defaultBroadcastNotifySettings;
|
2018-04-09 21:48:29 +04:00
|
|
|
rpl::event_stream<> _defaultUserNotifyUpdates;
|
|
|
|
rpl::event_stream<> _defaultChatNotifyUpdates;
|
2018-11-06 15:10:20 +04:00
|
|
|
rpl::event_stream<> _defaultBroadcastNotifyUpdates;
|
2018-04-09 21:48:29 +04:00
|
|
|
std::unordered_set<not_null<const PeerData*>> _mutedPeers;
|
|
|
|
base::Timer _unmuteByFinishedTimer;
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
std::unordered_map<PeerId, std::unique_ptr<PeerData>> _peers;
|
|
|
|
std::unordered_map<PeerId, std::unique_ptr<History>> _histories;
|
|
|
|
|
2018-01-11 18:51:59 +03:00
|
|
|
MessageIdsList _mimeForwardIds;
|
|
|
|
|
2018-07-10 19:41:11 +03:00
|
|
|
using CredentialsWithGeneration = std::pair<
|
|
|
|
const Passport::SavedCredentials,
|
|
|
|
int>;
|
|
|
|
std::unique_ptr<CredentialsWithGeneration> _passportCredentials;
|
|
|
|
|
2018-11-20 14:03:44 +04:00
|
|
|
rpl::event_stream<> _newAuthorizationChecks;
|
|
|
|
|
2019-01-03 16:36:01 +04:00
|
|
|
rpl::event_stream<SendActionAnimationUpdate> _sendActionAnimationUpdate;
|
|
|
|
|
|
|
|
std::vector<WallPaper> _wallpapers;
|
|
|
|
|
2018-01-04 13:22:53 +03:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Data
|