2021-03-05 08:14:34 +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 "base/weak_ptr.h"
|
2021-03-05 15:21:11 +00:00
|
|
|
#include "base/object_ptr.h"
|
2021-03-05 08:14:34 +00:00
|
|
|
|
|
|
|
class PeerData;
|
|
|
|
|
2021-03-05 11:36:07 +00:00
|
|
|
namespace Ui {
|
2022-08-08 15:19:04 +00:00
|
|
|
class Show;
|
2021-03-05 11:36:07 +00:00
|
|
|
class BoxContent;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2021-03-05 15:21:11 +00:00
|
|
|
namespace Calls::Group {
|
|
|
|
|
|
|
|
struct JoinInfo;
|
2021-03-05 08:14:34 +00:00
|
|
|
|
|
|
|
class ChooseJoinAsProcess final {
|
|
|
|
public:
|
|
|
|
ChooseJoinAsProcess() = default;
|
|
|
|
~ChooseJoinAsProcess();
|
|
|
|
|
|
|
|
enum class Context {
|
|
|
|
Create,
|
2022-02-26 05:07:20 +00:00
|
|
|
CreateScheduled,
|
2021-03-05 08:14:34 +00:00
|
|
|
Join,
|
2021-03-16 13:16:01 +00:00
|
|
|
JoinWithConfirm,
|
2021-03-05 08:14:34 +00:00
|
|
|
Switch,
|
|
|
|
};
|
|
|
|
|
|
|
|
void start(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Context context,
|
2022-08-08 15:19:04 +00:00
|
|
|
std::shared_ptr<Ui::Show> show,
|
2021-03-05 15:21:11 +00:00
|
|
|
Fn<void(JoinInfo)> done,
|
2021-03-16 10:32:52 +00:00
|
|
|
PeerData *changingJoinAsFrom = nullptr);
|
2021-03-05 08:14:34 +00:00
|
|
|
|
|
|
|
private:
|
2022-02-26 02:59:21 +00:00
|
|
|
void requestList();
|
|
|
|
void processList(std::vector<not_null<PeerData*>> &&list);
|
|
|
|
void finish(JoinInfo info);
|
|
|
|
|
2021-03-05 08:14:34 +00:00
|
|
|
struct ChannelsListRequest {
|
|
|
|
not_null<PeerData*> peer;
|
2022-08-08 15:19:04 +00:00
|
|
|
std::shared_ptr<Ui::Show> show;
|
2021-03-05 15:21:11 +00:00
|
|
|
Fn<void(JoinInfo)> done;
|
2021-03-05 08:14:34 +00:00
|
|
|
base::has_weak_ptr guard;
|
2021-03-05 11:36:07 +00:00
|
|
|
QPointer<Ui::BoxContent> box;
|
2021-03-05 08:14:34 +00:00
|
|
|
rpl::lifetime lifetime;
|
|
|
|
Context context = Context();
|
|
|
|
mtpRequestId id = 0;
|
2022-02-26 02:59:21 +00:00
|
|
|
PeerData *changingJoinAsFrom = nullptr;
|
2021-03-05 08:14:34 +00:00
|
|
|
};
|
|
|
|
std::unique_ptr<ChannelsListRequest> _request;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-03-05 15:21:11 +00:00
|
|
|
} // namespace Calls::Group
|