2018-02-07 12:40:37 +00: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
|
|
|
|
|
|
|
|
#include "boxes/peer_list_box.h"
|
2018-02-13 16:11:00 +00:00
|
|
|
#include "mtproto/sender.h"
|
2018-02-07 12:40:37 +00:00
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
class Feed;
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace Info {
|
|
|
|
|
|
|
|
class Controller;
|
|
|
|
|
|
|
|
namespace FeedProfile {
|
|
|
|
|
|
|
|
class ChannelsController
|
|
|
|
: public PeerListController
|
|
|
|
, private base::Subscriber {
|
|
|
|
public:
|
|
|
|
ChannelsController(not_null<Controller*> controller);
|
|
|
|
|
|
|
|
void prepare() override;
|
|
|
|
void rowClicked(not_null<PeerListRow*> row) override;
|
2018-02-08 09:20:14 +00:00
|
|
|
void rowActionClicked(not_null<PeerListRow*> row) override;
|
2018-02-07 12:40:37 +00:00
|
|
|
|
|
|
|
std::unique_ptr<PeerListRow> createRestoredRow(
|
|
|
|
not_null<PeerData*> peer) override;
|
2018-02-12 11:10:40 +00:00
|
|
|
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
|
|
|
not_null<PeerListRow*> row) override;
|
2018-02-07 12:40:37 +00:00
|
|
|
|
|
|
|
std::unique_ptr<PeerListState> saveState() const override;
|
|
|
|
void restoreState(std::unique_ptr<PeerListState> state) override;
|
|
|
|
|
|
|
|
private:
|
2018-02-08 09:20:14 +00:00
|
|
|
class Row;
|
2018-02-07 12:40:37 +00:00
|
|
|
struct SavedState : SavedStateBase {
|
|
|
|
rpl::lifetime lifetime;
|
|
|
|
};
|
|
|
|
|
|
|
|
void rebuildRows();
|
2018-02-12 11:10:40 +00:00
|
|
|
std::unique_ptr<Row> createRow(not_null<History*> history);
|
2018-02-07 12:40:37 +00:00
|
|
|
|
|
|
|
const not_null<Controller*> _controller;
|
|
|
|
not_null<Data::Feed*> _feed;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-02-20 16:56:41 +00:00
|
|
|
class NotificationsController
|
2018-02-13 16:11:00 +00:00
|
|
|
: public PeerListController
|
|
|
|
, private MTP::Sender {
|
|
|
|
public:
|
|
|
|
static void Start(not_null<Data::Feed*> feed);
|
|
|
|
|
2018-02-20 16:56:41 +00:00
|
|
|
NotificationsController(not_null<Data::Feed*> feed);
|
2018-02-13 16:11:00 +00:00
|
|
|
|
|
|
|
void prepare() override;
|
|
|
|
void rowClicked(not_null<PeerListRow*> row) override;
|
|
|
|
|
|
|
|
void loadMoreRows() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<PeerListRow> createRow(not_null<ChannelData*> channel);
|
|
|
|
void applyFeedDialogs(const MTPmessages_Dialogs &result);
|
|
|
|
|
|
|
|
not_null<Data::Feed*> _feed;
|
|
|
|
mtpRequestId _preloadRequestId = 0;
|
2018-03-06 17:07:42 +00:00
|
|
|
//TimeId _preloadOffsetDate = TimeId(0); // #feed
|
|
|
|
//MsgId _preloadOffsetId = MsgId(0);
|
|
|
|
//PeerData *_preloadPeer = nullptr;
|
2018-02-13 16:11:00 +00:00
|
|
|
bool _allLoaded = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-02-20 16:56:41 +00:00
|
|
|
class EditController
|
|
|
|
: public PeerListController
|
|
|
|
, private MTP::Sender {
|
|
|
|
public:
|
|
|
|
static void Start(
|
|
|
|
not_null<Data::Feed*> feed,
|
|
|
|
ChannelData *channel = nullptr);
|
|
|
|
|
|
|
|
EditController(
|
|
|
|
not_null<Data::Feed*> feed,
|
|
|
|
ChannelData *channel);
|
|
|
|
|
|
|
|
void prepare() override;
|
|
|
|
void rowClicked(not_null<PeerListRow*> row) override;
|
|
|
|
|
|
|
|
void loadMoreRows() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<PeerListRow> createRow(not_null<ChannelData*> channel);
|
2018-03-06 17:07:42 +00:00
|
|
|
// void applyFeedSources(const MTPchannels_FeedSources &result); // #feed
|
2018-02-20 16:56:41 +00:00
|
|
|
|
|
|
|
not_null<Data::Feed*> _feed;
|
2018-03-06 17:07:42 +00:00
|
|
|
// ChannelData *_startWithChannel = nullptr; // #feed
|
2018-02-20 16:56:41 +00:00
|
|
|
mtpRequestId _preloadRequestId = 0;
|
|
|
|
bool _allLoaded = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-02-07 12:40:37 +00:00
|
|
|
} // namespace FeedProfile
|
|
|
|
} // namespace Info
|