2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Support new attach bot deeplinks.

This commit is contained in:
John Preston
2022-06-03 00:26:41 +04:00
parent 092474fdb9
commit 6454f67e74
7 changed files with 109 additions and 12 deletions

View File

@@ -480,10 +480,12 @@ std::unique_ptr<PeerListRow> ContactsBoxController::createRow(
ChooseRecipientBoxController::ChooseRecipientBoxController(
not_null<Main::Session*> session,
FnMut<void(not_null<PeerData*>)> callback)
FnMut<void(not_null<PeerData*>)> callback,
Fn<bool(not_null<PeerData*>)> filter)
: ChatsListBoxController(session)
, _session(session)
, _callback(std::move(callback)) {
, _callback(std::move(callback))
, _filter(std::move(filter)) {
}
Main::Session &ChooseRecipientBoxController::session() const {
@@ -506,7 +508,9 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
auto ChooseRecipientBoxController::createRow(
not_null<History*> history) -> std::unique_ptr<Row> {
const auto peer = history->peer;
const auto skip = (peer->isBroadcast() && !peer->canWrite())
|| peer->isRepliesChat();
const auto skip = _filter
? !_filter(peer)
: ((peer->isBroadcast() && !peer->canWrite())
|| peer->isRepliesChat());
return skip ? nullptr : std::make_unique<Row>(history);
}

View File

@@ -173,7 +173,8 @@ class ChooseRecipientBoxController
public:
ChooseRecipientBoxController(
not_null<Main::Session*> session,
FnMut<void(not_null<PeerData*>)> callback);
FnMut<void(not_null<PeerData*>)> callback,
Fn<bool(not_null<PeerData*>)> filter = nullptr);
Main::Session &session() const override;
void rowClicked(not_null<PeerListRow*> row) override;
@@ -189,5 +190,6 @@ protected:
private:
const not_null<Main::Session*> _session;
FnMut<void(not_null<PeerData*>)> _callback;
Fn<bool(not_null<PeerData*>)> _filter;
};