mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Inform about join request being sent.
This commit is contained in:
parent
3af3f85f82
commit
9e05e44a14
27 changed files with 197 additions and 126 deletions
|
@ -2933,6 +2933,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_view_button_message" = "View message";
|
"lng_view_button_message" = "View message";
|
||||||
"lng_view_button_voice_chat" = "Voice chat";
|
"lng_view_button_voice_chat" = "Voice chat";
|
||||||
"lng_view_button_voice_chat_channel" = "Live stream";
|
"lng_view_button_voice_chat_channel" = "Live stream";
|
||||||
|
"lng_view_button_request_join" = "Request to Join";
|
||||||
|
|
||||||
"lng_sponsored_title" = "What are sponsored messages?";
|
"lng_sponsored_title" = "What are sponsored messages?";
|
||||||
"lng_sponsored_info_description1" = "Unlike other apps, Telegram never uses your private data to target ads. Sponsored messages on Telegram are based solely on the topic of the public channels in which they are shown. This means that no user data is mined or analyzed to display ads, and every user viewing a channel on Telegram sees the same sponsored messages.\n\nUnlike other apps, Telegram doesn't track whether you tapped on a sponsored message and doesn't profile you based on your activity. We also prevent external links in sponsored messages to ensure that third parties can’t spy on our users. We believe that everyone has the right to privacy, and technological platforms should respect that.\n\nTelegram offers a free and unlimited service to hundreds of millions of users, which involves significant server and traffic costs. In order to remain independent and stay true to its values, Telegram developed a paid tool to promote messages with user privacy in mind. We welcome responsible advertisers at:";
|
"lng_sponsored_info_description1" = "Unlike other apps, Telegram never uses your private data to target ads. Sponsored messages on Telegram are based solely on the topic of the public channels in which they are shown. This means that no user data is mined or analyzed to display ads, and every user viewing a channel on Telegram sees the same sponsored messages.\n\nUnlike other apps, Telegram doesn't track whether you tapped on a sponsored message and doesn't profile you based on your activity. We also prevent external links in sponsored messages to ensure that third parties can’t spy on our users. We believe that everyone has the right to privacy, and technological platforms should respect that.\n\nTelegram offers a free and unlimited service to hundreds of millions of users, which involves significant server and traffic costs. In order to remain independent and stay true to its values, Telegram developed a paid tool to promote messages with user privacy in mind. We welcome responsible advertisers at:";
|
||||||
|
|
|
@ -38,11 +38,12 @@ void CheckChatInvite(
|
||||||
if (!strongController) {
|
if (!strongController) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const auto isGroup = !data.is_broadcast();
|
||||||
const auto box = strongController->show(Box<ConfirmInviteBox>(
|
const auto box = strongController->show(Box<ConfirmInviteBox>(
|
||||||
session,
|
session,
|
||||||
data,
|
data,
|
||||||
invitePeekChannel,
|
invitePeekChannel,
|
||||||
[=] { session->api().importChatInvite(hash); }));
|
[=] { session->api().importChatInvite(hash, isGroup); }));
|
||||||
if (invitePeekChannel) {
|
if (invitePeekChannel) {
|
||||||
box->boxClosing(
|
box->boxClosing(
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
|
@ -104,7 +105,8 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||||
, _title(this, st::confirmInviteTitle)
|
, _title(this, st::confirmInviteTitle)
|
||||||
, _status(this, st::confirmInviteStatus)
|
, _status(this, st::confirmInviteStatus)
|
||||||
, _participants(GetParticipants(_session, data))
|
, _participants(GetParticipants(_session, data))
|
||||||
, _isChannel(data.is_channel() && !data.is_megagroup()) {
|
, _isChannel(data.is_channel() && !data.is_megagroup())
|
||||||
|
, _requestApprove(data.is_request_needed()) {
|
||||||
const auto title = qs(data.vtitle());
|
const auto title = qs(data.vtitle());
|
||||||
const auto count = data.vparticipants_count().v;
|
const auto count = data.vparticipants_count().v;
|
||||||
const auto status = [&] {
|
const auto status = [&] {
|
||||||
|
@ -166,7 +168,9 @@ auto ConfirmInviteBox::GetParticipants(
|
||||||
|
|
||||||
void ConfirmInviteBox::prepare() {
|
void ConfirmInviteBox::prepare() {
|
||||||
addButton(
|
addButton(
|
||||||
(_isChannel
|
(_requestApprove
|
||||||
|
? tr::lng_group_request_to_join()
|
||||||
|
: _isChannel
|
||||||
? tr::lng_profile_join_channel()
|
? tr::lng_profile_join_channel()
|
||||||
: tr::lng_profile_join_group()),
|
: tr::lng_profile_join_group()),
|
||||||
_submit);
|
_submit);
|
||||||
|
|
|
@ -72,6 +72,7 @@ private:
|
||||||
std::unique_ptr<Ui::EmptyUserpic> _photoEmpty;
|
std::unique_ptr<Ui::EmptyUserpic> _photoEmpty;
|
||||||
std::vector<Participant> _participants;
|
std::vector<Participant> _participants;
|
||||||
bool _isChannel = false;
|
bool _isChannel = false;
|
||||||
|
bool _requestApprove = false;
|
||||||
|
|
||||||
int _userWidth = 0;
|
int _userWidth = 0;
|
||||||
|
|
||||||
|
|
|
@ -239,11 +239,12 @@ Updates::Updates(not_null<Main::Session*> session)
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
base::ObservableViewer(
|
session->changes().peerUpdates(
|
||||||
api().fullPeerUpdated()
|
Data::PeerUpdate::Flag::FullInfo
|
||||||
) | rpl::filter([](not_null<PeerData*> peer) {
|
) | rpl::filter([](const Data::PeerUpdate &update) {
|
||||||
return peer->isChat() || peer->isMegagroup();
|
return update.peer->isChat() || update.peer->isMegagroup();
|
||||||
}) | rpl::start_with_next([=](not_null<PeerData*> peer) {
|
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||||
|
const auto peer = update.peer;
|
||||||
if (const auto list = _pendingSpeakingCallParticipants.take(peer)) {
|
if (const auto list = _pendingSpeakingCallParticipants.take(peer)) {
|
||||||
if (const auto call = peer->groupCall()) {
|
if (const auto call = peer->groupCall()) {
|
||||||
for (const auto &[participantPeerId, when] : *list) {
|
for (const auto &[participantPeerId, when] : *list) {
|
||||||
|
|
|
@ -74,6 +74,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/item_text_options.h"
|
#include "ui/item_text_options.h"
|
||||||
#include "ui/emoji_config.h"
|
#include "ui/emoji_config.h"
|
||||||
#include "ui/chat/attach/attach_prepare.h"
|
#include "ui/chat/attach/attach_prepare.h"
|
||||||
|
#include "ui/toasts/common_toasts.h"
|
||||||
#include "support/support_helper.h"
|
#include "support/support_helper.h"
|
||||||
#include "storage/localimageloader.h"
|
#include "storage/localimageloader.h"
|
||||||
#include "storage/download_manager_mtproto.h"
|
#include "storage/download_manager_mtproto.h"
|
||||||
|
@ -114,6 +115,7 @@ constexpr auto kStickersByEmojiInvalidateTimeout = crl::time(6 * 1000);
|
||||||
constexpr auto kNotifySettingSaveTimeout = crl::time(1000);
|
constexpr auto kNotifySettingSaveTimeout = crl::time(1000);
|
||||||
constexpr auto kDialogsFirstLoad = 20;
|
constexpr auto kDialogsFirstLoad = 20;
|
||||||
constexpr auto kDialogsPerPage = 500;
|
constexpr auto kDialogsPerPage = 500;
|
||||||
|
constexpr auto kJoinErrorDuration = 5 * crl::time(1000);
|
||||||
|
|
||||||
using PhotoFileLocationId = Data::PhotoFileLocationId;
|
using PhotoFileLocationId = Data::PhotoFileLocationId;
|
||||||
using DocumentFileLocationId = Data::DocumentFileLocationId;
|
using DocumentFileLocationId = Data::DocumentFileLocationId;
|
||||||
|
@ -354,7 +356,7 @@ void ApiWrap::checkChatInvite(
|
||||||
)).done(std::move(done)).fail(std::move(fail)).send();
|
)).done(std::move(done)).fail(std::move(fail)).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::importChatInvite(const QString &hash) {
|
void ApiWrap::importChatInvite(const QString &hash, bool isGroup) {
|
||||||
request(MTPmessages_ImportChatInvite(
|
request(MTPmessages_ImportChatInvite(
|
||||||
MTP_string(hash)
|
MTP_string(hash)
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
|
@ -391,13 +393,20 @@ void ApiWrap::importChatInvite(const QString &hash) {
|
||||||
});
|
});
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
const auto &type = error.type();
|
const auto &type = error.type();
|
||||||
if (type == qstr("CHANNELS_TOO_MUCH")) {
|
Ui::hideLayer();
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_join_channel_error(tr::now)));
|
Ui::ShowMultilineToast({ .text = { [&] {
|
||||||
} else if (error.code() == 400) {
|
if (type == qstr("INVITE_REQUEST_SENT")) {
|
||||||
Ui::show(Box<Ui::InformBox>((type == qstr("USERS_TOO_MUCH"))
|
return isGroup
|
||||||
? tr::lng_group_invite_no_room(tr::now)
|
? tr::lng_group_request_sent(tr::now)
|
||||||
: tr::lng_group_invite_bad_link(tr::now)));
|
: tr::lng_group_request_sent_channel(tr::now);
|
||||||
}
|
} else if (type == qstr("CHANNELS_TOO_MUCH")) {
|
||||||
|
return tr::lng_join_channel_error(tr::now);
|
||||||
|
} else if (type == qstr("USERS_TOO_MUCH")) {
|
||||||
|
return tr::lng_group_invite_no_room(tr::now);
|
||||||
|
} else {
|
||||||
|
return tr::lng_group_invite_bad_link(tr::now);
|
||||||
|
}
|
||||||
|
}() }, .duration = kJoinErrorDuration });
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,7 +1105,9 @@ void ApiWrap::gotChatFull(
|
||||||
_fullPeerRequests.erase(i);
|
_fullPeerRequests.erase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullPeerUpdated().notify(peer);
|
_session->changes().peerUpdated(
|
||||||
|
peer,
|
||||||
|
Data::PeerUpdate::Flag::FullInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::gotUserFull(
|
void ApiWrap::gotUserFull(
|
||||||
|
@ -1119,7 +1130,9 @@ void ApiWrap::gotUserFull(
|
||||||
_fullPeerRequests.erase(i);
|
_fullPeerRequests.erase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullPeerUpdated().notify(user);
|
_session->changes().peerUpdated(
|
||||||
|
user,
|
||||||
|
Data::PeerUpdate::Flag::FullInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::requestPeer(not_null<PeerData*> peer) {
|
void ApiWrap::requestPeer(not_null<PeerData*> peer) {
|
||||||
|
@ -1544,7 +1557,9 @@ void ApiWrap::applyLastParticipantsList(
|
||||||
(Data::PeerUpdate::Flag::Members | Data::PeerUpdate::Flag::Admins));
|
(Data::PeerUpdate::Flag::Members | Data::PeerUpdate::Flag::Admins));
|
||||||
|
|
||||||
channel->mgInfo->botStatus = botStatus;
|
channel->mgInfo->botStatus = botStatus;
|
||||||
fullPeerUpdated().notify(channel);
|
_session->changes().peerUpdated(
|
||||||
|
channel,
|
||||||
|
Data::PeerUpdate::Flag::FullInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::applyBotsList(
|
void ApiWrap::applyBotsList(
|
||||||
|
@ -1593,7 +1608,9 @@ void ApiWrap::applyBotsList(
|
||||||
}
|
}
|
||||||
|
|
||||||
channel->mgInfo->botStatus = botStatus;
|
channel->mgInfo->botStatus = botStatus;
|
||||||
fullPeerUpdated().notify(channel);
|
_session->changes().peerUpdated(
|
||||||
|
channel,
|
||||||
|
Data::PeerUpdate::Flag::FullInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
|
void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
|
||||||
|
@ -2078,20 +2095,35 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
|
||||||
_channelAmInRequests.remove(channel);
|
_channelAmInRequests.remove(channel);
|
||||||
applyUpdates(result);
|
applyUpdates(result);
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
if (error.type() == qstr("CHANNEL_PRIVATE")
|
const auto &type = error.type();
|
||||||
|
if (type == qstr("CHANNEL_PRIVATE")
|
||||||
&& channel->invitePeekExpires()) {
|
&& channel->invitePeekExpires()) {
|
||||||
channel->privateErrorReceived();
|
channel->privateErrorReceived();
|
||||||
} else if (error.type() == qstr("CHANNEL_PRIVATE")
|
} else {
|
||||||
|| error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA")
|
const auto text = [&] {
|
||||||
|| error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
|
if (type == qstr("INVITE_REQUEST_SENT")) {
|
||||||
Ui::show(Box<Ui::InformBox>(channel->isMegagroup()
|
return channel->isMegagroup()
|
||||||
? tr::lng_group_not_accessible(tr::now)
|
? tr::lng_group_request_sent(tr::now)
|
||||||
: tr::lng_channel_not_accessible(tr::now)));
|
: tr::lng_group_request_sent_channel(tr::now);
|
||||||
} else if (error.type() == qstr("CHANNELS_TOO_MUCH")) {
|
} else if (type == qstr("CHANNEL_PRIVATE")
|
||||||
Ui::show(Box<Ui::InformBox>(
|
|| type == qstr("CHANNEL_PUBLIC_GROUP_NA")
|
||||||
tr::lng_join_channel_error(tr::now)));
|
|| type == qstr("USER_BANNED_IN_CHANNEL")) {
|
||||||
} else if (error.type() == qstr("USERS_TOO_MUCH")) {
|
return channel->isMegagroup()
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_group_full(tr::now)));
|
? tr::lng_group_not_accessible(tr::now)
|
||||||
|
: tr::lng_channel_not_accessible(tr::now);
|
||||||
|
} else if (type == qstr("CHANNELS_TOO_MUCH")) {
|
||||||
|
return tr::lng_join_channel_error(tr::now);
|
||||||
|
} else if (type == qstr("USERS_TOO_MUCH")) {
|
||||||
|
return tr::lng_group_full(tr::now);
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}();
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
Ui::ShowMultilineToast({
|
||||||
|
.text = { text },
|
||||||
|
.duration = kJoinErrorDuration,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_channelAmInRequests.remove(channel);
|
_channelAmInRequests.remove(channel);
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -2194,7 +2226,7 @@ void ApiWrap::saveDraftToCloudDelayed(not_null<History*> history) {
|
||||||
void ApiWrap::updatePrivacyLastSeens() {
|
void ApiWrap::updatePrivacyLastSeens() {
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
_session->data().enumerateUsers([&](UserData *user) {
|
_session->data().enumerateUsers([&](UserData *user) {
|
||||||
if (user->isSelf() || !user->isFullLoaded()) {
|
if (user->isSelf() || !user->isLoaded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (user->onlineTill <= 0) {
|
if (user->onlineTill <= 0) {
|
||||||
|
|
|
@ -202,7 +202,7 @@ public:
|
||||||
const QString &hash,
|
const QString &hash,
|
||||||
FnMut<void(const MTPChatInvite &)> done,
|
FnMut<void(const MTPChatInvite &)> done,
|
||||||
Fn<void(const MTP::Error &)> fail);
|
Fn<void(const MTP::Error &)> fail);
|
||||||
void importChatInvite(const QString &hash);
|
void importChatInvite(const QString &hash, bool isGroup);
|
||||||
|
|
||||||
void requestChannelMembersForAdd(
|
void requestChannelMembersForAdd(
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
|
@ -270,10 +270,6 @@ public:
|
||||||
void clearHistory(not_null<PeerData*> peer, bool revoke);
|
void clearHistory(not_null<PeerData*> peer, bool revoke);
|
||||||
void deleteConversation(not_null<PeerData*> peer, bool revoke);
|
void deleteConversation(not_null<PeerData*> peer, bool revoke);
|
||||||
|
|
||||||
base::Observable<PeerData*> &fullPeerUpdated() {
|
|
||||||
return _fullPeerUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isQuitPrevent();
|
bool isQuitPrevent();
|
||||||
|
|
||||||
void jumpToDate(Dialogs::Key chat, const QDate &date);
|
void jumpToDate(Dialogs::Key chat, const QDate &date);
|
||||||
|
@ -663,8 +659,6 @@ private:
|
||||||
std::unique_ptr<TaskQueue> _fileLoader;
|
std::unique_ptr<TaskQueue> _fileLoader;
|
||||||
base::flat_map<uint64, std::shared_ptr<SendingAlbum>> _sendingAlbums;
|
base::flat_map<uint64, std::shared_ptr<SendingAlbum>> _sendingAlbums;
|
||||||
|
|
||||||
base::Observable<PeerData*> _fullPeerUpdated;
|
|
||||||
|
|
||||||
mtpRequestId _topPromotionRequestId = 0;
|
mtpRequestId _topPromotionRequestId = 0;
|
||||||
std::pair<QString, uint32> _topPromotionKey;
|
std::pair<QString, uint32> _topPromotionKey;
|
||||||
TimeId _topPromotionNextRequestTime = TimeId(0);
|
TimeId _topPromotionNextRequestTime = TimeId(0);
|
||||||
|
|
|
@ -746,6 +746,7 @@ void GroupInfoBox::createChannel(
|
||||||
channel,
|
channel,
|
||||||
std::move(image));
|
std::move(image));
|
||||||
}
|
}
|
||||||
|
channel->session().api().requestFullPeer(channel);
|
||||||
_createdChannel = channel;
|
_createdChannel = channel;
|
||||||
checkInviteLink();
|
checkInviteLink();
|
||||||
};
|
};
|
||||||
|
@ -772,12 +773,19 @@ void GroupInfoBox::checkInviteLink() {
|
||||||
|
|
||||||
if (!_createdChannel->inviteLink().isEmpty()) {
|
if (!_createdChannel->inviteLink().isEmpty()) {
|
||||||
channelReady();
|
channelReady();
|
||||||
return;
|
} else if (_createdChannel->isFullLoaded() && !_creatingInviteLink) {
|
||||||
|
_creatingInviteLink = true;
|
||||||
|
_createdChannel->session().api().inviteLinks().create(
|
||||||
|
_createdChannel,
|
||||||
|
crl::guard(this, [=](auto&&) { channelReady(); }));
|
||||||
|
} else {
|
||||||
|
_createdChannel->session().changes().peerUpdates(
|
||||||
|
_createdChannel,
|
||||||
|
Data::PeerUpdate::Flag::FullInfo
|
||||||
|
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||||
|
checkInviteLink();
|
||||||
|
}, lifetime());
|
||||||
}
|
}
|
||||||
_creatingInviteLink = true;
|
|
||||||
_createdChannel->session().api().inviteLinks().create(
|
|
||||||
_createdChannel,
|
|
||||||
crl::guard(this, [=](auto&&) { channelReady(); }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInfoBox::channelReady() {
|
void GroupInfoBox::channelReady() {
|
||||||
|
@ -871,6 +879,10 @@ SetupChannelBox::SetupChannelBox(
|
||||||
void SetupChannelBox::prepare() {
|
void SetupChannelBox::prepare() {
|
||||||
_aboutPublicHeight = _aboutPublic.countHeight(_aboutPublicWidth);
|
_aboutPublicHeight = _aboutPublic.countHeight(_aboutPublicWidth);
|
||||||
|
|
||||||
|
if (_channel->inviteLink().isEmpty()) {
|
||||||
|
_channel->session().api().requestFullPeer(_channel);
|
||||||
|
}
|
||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
_checkRequestId = _api.request(MTPchannels_CheckUsername(
|
_checkRequestId = _api.request(MTPchannels_CheckUsername(
|
||||||
|
@ -1068,13 +1080,14 @@ void SetupChannelBox::mouseMoveEvent(QMouseEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupChannelBox::mousePressEvent(QMouseEvent *e) {
|
void SetupChannelBox::mousePressEvent(QMouseEvent *e) {
|
||||||
if (_linkOver) {
|
if (!_linkOver) {
|
||||||
if (_channel->inviteLink().isEmpty()) {
|
return;
|
||||||
_channel->session().api().inviteLinks().create(_channel);
|
} else if (!_channel->inviteLink().isEmpty()) {
|
||||||
} else {
|
QGuiApplication::clipboard()->setText(_channel->inviteLink());
|
||||||
QGuiApplication::clipboard()->setText(_channel->inviteLink());
|
Ui::Toast::Show(tr::lng_create_channel_link_copied(tr::now));
|
||||||
Ui::Toast::Show(tr::lng_create_channel_link_copied(tr::now));
|
} else if (_channel->isFullLoaded() && !_creatingInviteLink) {
|
||||||
}
|
_creatingInviteLink = true;
|
||||||
|
_channel->session().api().inviteLinks().create(_channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,7 @@ private:
|
||||||
MTP::Sender _api;
|
MTP::Sender _api;
|
||||||
|
|
||||||
bool _existing = false;
|
bool _existing = false;
|
||||||
|
bool _creatingInviteLink = false;
|
||||||
|
|
||||||
std::shared_ptr<Ui::RadioenumGroup<Privacy>> _privacyGroup;
|
std::shared_ptr<Ui::RadioenumGroup<Privacy>> _privacyGroup;
|
||||||
object_ptr<Ui::Radioenum<Privacy>> _public;
|
object_ptr<Ui::Radioenum<Privacy>> _public;
|
||||||
|
|
|
@ -71,6 +71,9 @@ void MaxInviteBox::prepare() {
|
||||||
+ st::boxTextFont->height * 2
|
+ st::boxTextFont->height * 2
|
||||||
+ st::newGroupLinkPadding.bottom());
|
+ st::newGroupLinkPadding.bottom());
|
||||||
|
|
||||||
|
if (_channel->inviteLink().isEmpty()) {
|
||||||
|
_channel->session().api().requestFullPeer(_channel);
|
||||||
|
}
|
||||||
_channel->session().changes().peerUpdates(
|
_channel->session().changes().peerUpdates(
|
||||||
_channel,
|
_channel,
|
||||||
Data::PeerUpdate::Flag::InviteLinks
|
Data::PeerUpdate::Flag::InviteLinks
|
||||||
|
@ -86,11 +89,12 @@ void MaxInviteBox::mouseMoveEvent(QMouseEvent *e) {
|
||||||
void MaxInviteBox::mousePressEvent(QMouseEvent *e) {
|
void MaxInviteBox::mousePressEvent(QMouseEvent *e) {
|
||||||
mouseMoveEvent(e);
|
mouseMoveEvent(e);
|
||||||
if (_linkOver) {
|
if (_linkOver) {
|
||||||
if (_channel->inviteLink().isEmpty()) {
|
if (!_channel->inviteLink().isEmpty()) {
|
||||||
_channel->session().api().inviteLinks().create(_channel);
|
|
||||||
} else {
|
|
||||||
QGuiApplication::clipboard()->setText(_channel->inviteLink());
|
QGuiApplication::clipboard()->setText(_channel->inviteLink());
|
||||||
Ui::Toast::Show(tr::lng_create_channel_link_copied(tr::now));
|
Ui::Toast::Show(tr::lng_create_channel_link_copied(tr::now));
|
||||||
|
} else if (_channel->isFullLoaded() && !_creatingInviteLink) {
|
||||||
|
_creatingInviteLink = true;
|
||||||
|
_channel->session().api().inviteLinks().create(_channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ private:
|
||||||
|
|
||||||
QRect _invitationLink;
|
QRect _invitationLink;
|
||||||
bool _linkOver = false;
|
bool _linkOver = false;
|
||||||
|
bool _creatingInviteLink = false;
|
||||||
|
|
||||||
QPoint _lastMousePos;
|
QPoint _lastMousePos;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
|
#include "data/data_changes.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
@ -63,12 +64,12 @@ Controller::Controller(
|
||||||
, _chat(chat)
|
, _chat(chat)
|
||||||
, _chats(std::move(chats))
|
, _chats(std::move(chats))
|
||||||
, _callback(std::move(callback)) {
|
, _callback(std::move(callback)) {
|
||||||
base::ObservableViewer(
|
channel->session().changes().peerUpdates(
|
||||||
channel->session().api().fullPeerUpdated()
|
Data::PeerUpdate::Flag::FullInfo
|
||||||
) | rpl::start_with_next([=](PeerData *peer) {
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
if (peer == _waitForFull) {
|
return (update.peer == _waitForFull);
|
||||||
choose(std::exchange(_waitForFull, nullptr));
|
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||||
}
|
choose(std::exchange(_waitForFull, nullptr));
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,7 @@ void Controller::loadMoreRows() {
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
_peer->input,
|
_peer->input,
|
||||||
MTP_string(_link),
|
MTP_string(_link),
|
||||||
MTPstring(), // q // #TODO requests
|
MTPstring(), // q
|
||||||
MTP_int(_lastUser ? _lastUser->date : 0),
|
MTP_int(_lastUser ? _lastUser->date : 0),
|
||||||
_lastUser ? _lastUser->user->inputUser : MTP_inputUserEmpty(),
|
_lastUser ? _lastUser->user->inputUser : MTP_inputUserEmpty(),
|
||||||
MTP_int(_lastUser ? kPerPage : kFirstPage)
|
MTP_int(_lastUser ? kPerPage : kFirstPage)
|
||||||
|
|
|
@ -584,7 +584,12 @@ void SettingsBox(
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
if (!lookupLink().isEmpty() || canCreateLink()) {
|
const auto alreadyHasLink = !lookupLink().isEmpty();
|
||||||
|
if (alreadyHasLink || canCreateLink()) {
|
||||||
|
if (!alreadyHasLink) {
|
||||||
|
// Request invite link.
|
||||||
|
peer->session().api().requestFullPeer(peer);
|
||||||
|
}
|
||||||
const auto copyLink = [=] {
|
const auto copyLink = [=] {
|
||||||
const auto link = lookupLink();
|
const auto link = lookupLink();
|
||||||
if (link.isEmpty()) {
|
if (link.isEmpty()) {
|
||||||
|
|
|
@ -64,38 +64,39 @@ struct PeerUpdate {
|
||||||
ChatThemeEmoji = (1ULL << 7),
|
ChatThemeEmoji = (1ULL << 7),
|
||||||
IsBlocked = (1ULL << 8),
|
IsBlocked = (1ULL << 8),
|
||||||
MessagesTTL = (1ULL << 9),
|
MessagesTTL = (1ULL << 9),
|
||||||
|
FullInfo = (1ULL << 10),
|
||||||
|
|
||||||
// For users
|
// For users
|
||||||
CanShareContact = (1ULL << 10),
|
CanShareContact = (1ULL << 11),
|
||||||
IsContact = (1ULL << 11),
|
IsContact = (1ULL << 12),
|
||||||
PhoneNumber = (1ULL << 12),
|
PhoneNumber = (1ULL << 13),
|
||||||
OnlineStatus = (1ULL << 13),
|
OnlineStatus = (1ULL << 14),
|
||||||
BotCommands = (1ULL << 14),
|
BotCommands = (1ULL << 15),
|
||||||
BotCanBeInvited = (1ULL << 15),
|
BotCanBeInvited = (1ULL << 16),
|
||||||
BotStartToken = (1ULL << 16),
|
BotStartToken = (1ULL << 17),
|
||||||
CommonChats = (1ULL << 17),
|
CommonChats = (1ULL << 18),
|
||||||
HasCalls = (1ULL << 18),
|
HasCalls = (1ULL << 19),
|
||||||
SupportInfo = (1ULL << 19),
|
SupportInfo = (1ULL << 20),
|
||||||
IsBot = (1ULL << 20),
|
IsBot = (1ULL << 21),
|
||||||
|
|
||||||
// For chats and channels
|
// For chats and channels
|
||||||
InviteLinks = (1ULL << 21),
|
InviteLinks = (1ULL << 22),
|
||||||
Members = (1ULL << 22),
|
Members = (1ULL << 23),
|
||||||
Admins = (1ULL << 23),
|
Admins = (1ULL << 24),
|
||||||
BannedUsers = (1ULL << 24),
|
BannedUsers = (1ULL << 25),
|
||||||
Rights = (1ULL << 25),
|
Rights = (1ULL << 26),
|
||||||
PendingRequests = (1ULL << 26),
|
PendingRequests = (1ULL << 27),
|
||||||
|
|
||||||
// For channels
|
// For channels
|
||||||
ChannelAmIn = (1ULL << 27),
|
ChannelAmIn = (1ULL << 28),
|
||||||
StickersSet = (1ULL << 28),
|
StickersSet = (1ULL << 29),
|
||||||
ChannelLinkedChat = (1ULL << 29),
|
ChannelLinkedChat = (1ULL << 30),
|
||||||
ChannelLocation = (1ULL << 30),
|
ChannelLocation = (1ULL << 31),
|
||||||
Slowmode = (1ULL << 31),
|
Slowmode = (1ULL << 32),
|
||||||
GroupCall = (1ULL << 32),
|
GroupCall = (1ULL << 33),
|
||||||
|
|
||||||
// For iteration
|
// For iteration
|
||||||
LastUsedBit = (1ULL << 32),
|
LastUsedBit = (1ULL << 33),
|
||||||
};
|
};
|
||||||
using Flags = base::flags<Flag>;
|
using Flags = base::flags<Flag>;
|
||||||
friend inline constexpr auto is_flag_type(Flag) { return true; }
|
friend inline constexpr auto is_flag_type(Flag) { return true; }
|
||||||
|
|
|
@ -643,6 +643,7 @@ void PeerData::updateFullForced() {
|
||||||
|
|
||||||
void PeerData::fullUpdated() {
|
void PeerData::fullUpdated() {
|
||||||
_lastFullUpdate = crl::now();
|
_lastFullUpdate = crl::now();
|
||||||
|
setLoadedStatus(LoadedStatus::Full);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserData *PeerData::asUser() {
|
UserData *PeerData::asUser() {
|
||||||
|
|
|
@ -440,6 +440,7 @@ public:
|
||||||
enum class LoadedStatus : char {
|
enum class LoadedStatus : char {
|
||||||
Not,
|
Not,
|
||||||
Minimal,
|
Minimal,
|
||||||
|
Normal,
|
||||||
Full,
|
Full,
|
||||||
};
|
};
|
||||||
[[nodiscard]] LoadedStatus loadedStatus() const {
|
[[nodiscard]] LoadedStatus loadedStatus() const {
|
||||||
|
@ -448,6 +449,9 @@ public:
|
||||||
[[nodiscard]] bool isMinimalLoaded() const {
|
[[nodiscard]] bool isMinimalLoaded() const {
|
||||||
return (loadedStatus() != LoadedStatus::Not);
|
return (loadedStatus() != LoadedStatus::Not);
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool isLoaded() const {
|
||||||
|
return (loadedStatus() == LoadedStatus::Normal) || isFullLoaded();
|
||||||
|
}
|
||||||
[[nodiscard]] bool isFullLoaded() const {
|
[[nodiscard]] bool isFullLoaded() const {
|
||||||
return (loadedStatus() == LoadedStatus::Full);
|
return (loadedStatus() == LoadedStatus::Full);
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ PeerData *Session::peerLoaded(PeerId id) const {
|
||||||
const auto i = _peers.find(id);
|
const auto i = _peers.find(id);
|
||||||
if (i == end(_peers)) {
|
if (i == end(_peers)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else if (!i->second->isFullLoaded()) {
|
} else if (!i->second->isLoaded()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return i->second.get();
|
return i->second.get();
|
||||||
|
@ -556,9 +556,9 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
||||||
if (!result->isMinimalLoaded()) {
|
if (!result->isMinimalLoaded()) {
|
||||||
result->setLoadedStatus(PeerData::LoadedStatus::Minimal);
|
result->setLoadedStatus(PeerData::LoadedStatus::Minimal);
|
||||||
}
|
}
|
||||||
} else if (!result->isFullLoaded()
|
} else if (!result->isLoaded()
|
||||||
&& (!result->isSelf() || !result->phone().isEmpty())) {
|
&& (!result->isSelf() || !result->phone().isEmpty())) {
|
||||||
result->setLoadedStatus(PeerData::LoadedStatus::Full);
|
result->setLoadedStatus(PeerData::LoadedStatus::Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status && !minimal) {
|
if (status && !minimal) {
|
||||||
|
@ -680,7 +680,7 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
||||||
const auto channel = result->asChannel();
|
const auto channel = result->asChannel();
|
||||||
|
|
||||||
minimal = data.is_min();
|
minimal = data.is_min();
|
||||||
if (minimal && !result->isFullLoaded()) {
|
if (minimal && !result->isLoaded()) {
|
||||||
LOG(("API Warning: not loaded minimal channel applied."));
|
LOG(("API Warning: not loaded minimal channel applied."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,8 +825,8 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
||||||
if (!result->isMinimalLoaded()) {
|
if (!result->isMinimalLoaded()) {
|
||||||
result->setLoadedStatus(PeerData::LoadedStatus::Minimal);
|
result->setLoadedStatus(PeerData::LoadedStatus::Minimal);
|
||||||
}
|
}
|
||||||
} else if (!result->isFullLoaded()) {
|
} else if (!result->isLoaded()) {
|
||||||
result->setLoadedStatus(PeerData::LoadedStatus::Full);
|
result->setLoadedStatus(PeerData::LoadedStatus::Normal);
|
||||||
}
|
}
|
||||||
if (flags) {
|
if (flags) {
|
||||||
session().changes().peerUpdated(result, flags);
|
session().changes().peerUpdated(result, flags);
|
||||||
|
@ -1171,7 +1171,7 @@ void Session::setupUserIsContactViewer() {
|
||||||
requestViewResize(view);
|
requestViewResize(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!user->isFullLoaded()) {
|
if (!user->isLoaded()) {
|
||||||
LOG(("API Error: "
|
LOG(("API Error: "
|
||||||
"userIsContactChanged() called for a not loaded user!"));
|
"userIsContactChanged() called for a not loaded user!"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -149,12 +149,18 @@ WebPageType ParseWebPageType(
|
||||||
return WebPageType::Theme;
|
return WebPageType::Theme;
|
||||||
} else if (type == qstr("telegram_channel")) {
|
} else if (type == qstr("telegram_channel")) {
|
||||||
return WebPageType::Channel;
|
return WebPageType::Channel;
|
||||||
|
} else if (type == qstr("telegram_channel_request")) {
|
||||||
|
return WebPageType::ChannelWithRequest;
|
||||||
|
} else if (type == qstr("telegram_megagroup")
|
||||||
|
|| type == qstr("telegram_chat")) {
|
||||||
|
return WebPageType::Group;
|
||||||
|
} else if (type == qstr("telegram_megagroup_request")
|
||||||
|
|| type == qstr("telegram_chat_request")) {
|
||||||
|
return WebPageType::GroupWithRequest;
|
||||||
} else if (type == qstr("telegram_message")) {
|
} else if (type == qstr("telegram_message")) {
|
||||||
return WebPageType::Message;
|
return WebPageType::Message;
|
||||||
} else if (type == qstr("telegram_bot")) {
|
} else if (type == qstr("telegram_bot")) {
|
||||||
return WebPageType::Bot;
|
return WebPageType::Bot;
|
||||||
} else if (type == qstr("telegram_megagroup")) {
|
|
||||||
return WebPageType::Group;
|
|
||||||
} else if (type == qstr("telegram_voicechat")) {
|
} else if (type == qstr("telegram_voicechat")) {
|
||||||
return WebPageType::VoiceChat;
|
return WebPageType::VoiceChat;
|
||||||
} else if (type == qstr("telegram_livestream")) {
|
} else if (type == qstr("telegram_livestream")) {
|
||||||
|
|
|
@ -20,7 +20,9 @@ enum class WebPageType {
|
||||||
Message,
|
Message,
|
||||||
|
|
||||||
Group,
|
Group,
|
||||||
|
GroupWithRequest,
|
||||||
Channel,
|
Channel,
|
||||||
|
ChannelWithRequest,
|
||||||
|
|
||||||
Photo,
|
Photo,
|
||||||
Video,
|
Video,
|
||||||
|
|
|
@ -651,6 +651,7 @@ HistoryWidget::HistoryWidget(
|
||||||
| PeerUpdateFlag::BotStartToken
|
| PeerUpdateFlag::BotStartToken
|
||||||
| PeerUpdateFlag::MessagesTTL
|
| PeerUpdateFlag::MessagesTTL
|
||||||
| PeerUpdateFlag::ChatThemeEmoji
|
| PeerUpdateFlag::ChatThemeEmoji
|
||||||
|
| PeerUpdateFlag::FullInfo
|
||||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
return (update.peer.get() == _peer);
|
return (update.peer.get() == _peer);
|
||||||
}) | rpl::map([](const Data::PeerUpdate &update) {
|
}) | rpl::map([](const Data::PeerUpdate &update) {
|
||||||
|
@ -720,6 +721,9 @@ HistoryWidget::HistoryWidget(
|
||||||
}, _list->lifetime());
|
}, _list->lifetime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (flags & PeerUpdateFlag::FullInfo) {
|
||||||
|
fullInfoUpdated();
|
||||||
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
|
@ -1264,9 +1268,6 @@ void HistoryWidget::start() {
|
||||||
updateStickersByEmoji();
|
updateStickersByEmoji();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
session().data().stickers().notifySavedGifsUpdated();
|
session().data().stickers().notifySavedGifsUpdated();
|
||||||
subscribe(session().api().fullPeerUpdated(), [this](PeerData *peer) {
|
|
||||||
fullPeerUpdated(peer);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::insertMention(UserData *user) {
|
void HistoryWidget::insertMention(UserData *user) {
|
||||||
|
@ -6585,9 +6586,9 @@ void HistoryWidget::updatePreview() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::fullPeerUpdated(PeerData *peer) {
|
void HistoryWidget::fullInfoUpdated() {
|
||||||
auto refresh = false;
|
auto refresh = false;
|
||||||
if (_list && peer == _peer) {
|
if (_list) {
|
||||||
auto newCanSendMessages = _peer->canWrite();
|
auto newCanSendMessages = _peer->canWrite();
|
||||||
if (newCanSendMessages != _canSendMessages) {
|
if (newCanSendMessages != _canSendMessages) {
|
||||||
_canSendMessages = newCanSendMessages;
|
_canSendMessages = newCanSendMessages;
|
||||||
|
|
|
@ -381,7 +381,7 @@ private:
|
||||||
[[nodiscard]] SendMenu::Type sendMenuType() const;
|
[[nodiscard]] SendMenu::Type sendMenuType() const;
|
||||||
[[nodiscard]] SendMenu::Type sendButtonMenuType() const;
|
[[nodiscard]] SendMenu::Type sendButtonMenuType() const;
|
||||||
void handlePendingHistoryUpdate();
|
void handlePendingHistoryUpdate();
|
||||||
void fullPeerUpdated(PeerData *peer);
|
void fullInfoUpdated();
|
||||||
void toggleTabbedSelectorMode();
|
void toggleTabbedSelectorMode();
|
||||||
void recountChatWidth();
|
void recountChatWidth();
|
||||||
void historyDownClicked();
|
void historyDownClicked();
|
||||||
|
|
|
@ -2272,6 +2272,7 @@ void ComposeControls::initWebpageProcess() {
|
||||||
Data::PeerUpdate::Flag::Rights
|
Data::PeerUpdate::Flag::Rights
|
||||||
| Data::PeerUpdate::Flag::Notifications
|
| Data::PeerUpdate::Flag::Notifications
|
||||||
| Data::PeerUpdate::Flag::MessagesTTL
|
| Data::PeerUpdate::Flag::MessagesTTL
|
||||||
|
| Data::PeerUpdate::Flag::FullInfo
|
||||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
return (update.peer.get() == peer);
|
return (update.peer.get() == peer);
|
||||||
}) | rpl::map([](const Data::PeerUpdate &update) {
|
}) | rpl::map([](const Data::PeerUpdate &update) {
|
||||||
|
@ -2288,16 +2289,11 @@ void ComposeControls::initWebpageProcess() {
|
||||||
if (flags & Data::PeerUpdate::Flag::MessagesTTL) {
|
if (flags & Data::PeerUpdate::Flag::MessagesTTL) {
|
||||||
updateMessagesTTLShown();
|
updateMessagesTTLShown();
|
||||||
}
|
}
|
||||||
}, lifetime);
|
if (flags & Data::PeerUpdate::Flag::FullInfo) {
|
||||||
|
if (updateBotCommandShown()) {
|
||||||
base::ObservableViewer(
|
updateControlsVisibility();
|
||||||
session().api().fullPeerUpdated()
|
updateControlsGeometry(_wrap->size());
|
||||||
) | rpl::filter([=](PeerData *peer) {
|
}
|
||||||
return _history && (_history->peer == peer);
|
|
||||||
}) | rpl::start_with_next([=] {
|
|
||||||
if (updateBotCommandShown()) {
|
|
||||||
updateControlsVisibility();
|
|
||||||
updateControlsGeometry(_wrap->size());
|
|
||||||
}
|
}
|
||||||
}, lifetime);
|
}, lifetime);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,9 @@ inline auto WebPageToPhrase(not_null<WebPageData*> webpage) {
|
||||||
? tr::lng_view_button_background(tr::now)
|
? tr::lng_view_button_background(tr::now)
|
||||||
: (type == WebPageType::Channel)
|
: (type == WebPageType::Channel)
|
||||||
? tr::lng_view_button_channel(tr::now)
|
? tr::lng_view_button_channel(tr::now)
|
||||||
|
: (type == WebPageType::GroupWithRequest
|
||||||
|
|| type == WebPageType::ChannelWithRequest)
|
||||||
|
? tr::lng_view_button_request_join(tr::now)
|
||||||
: (type == WebPageType::VoiceChat)
|
: (type == WebPageType::VoiceChat)
|
||||||
? tr::lng_view_button_voice_chat(tr::now)
|
? tr::lng_view_button_voice_chat(tr::now)
|
||||||
: (type == WebPageType::Livestream)
|
: (type == WebPageType::Livestream)
|
||||||
|
|
|
@ -69,13 +69,13 @@ Session::Session(
|
||||||
std::unique_ptr<SessionSettings> settings)
|
std::unique_ptr<SessionSettings> settings)
|
||||||
: _account(account)
|
: _account(account)
|
||||||
, _settings(std::move(settings))
|
, _settings(std::move(settings))
|
||||||
|
, _changes(std::make_unique<Data::Changes>(this))
|
||||||
, _api(std::make_unique<ApiWrap>(this))
|
, _api(std::make_unique<ApiWrap>(this))
|
||||||
, _updates(std::make_unique<Api::Updates>(this))
|
, _updates(std::make_unique<Api::Updates>(this))
|
||||||
, _sendProgressManager(std::make_unique<Api::SendProgressManager>(this))
|
, _sendProgressManager(std::make_unique<Api::SendProgressManager>(this))
|
||||||
, _downloader(std::make_unique<Storage::DownloadManagerMtproto>(_api.get()))
|
, _downloader(std::make_unique<Storage::DownloadManagerMtproto>(_api.get()))
|
||||||
, _uploader(std::make_unique<Storage::Uploader>(_api.get()))
|
, _uploader(std::make_unique<Storage::Uploader>(_api.get()))
|
||||||
, _storage(std::make_unique<Storage::Facade>())
|
, _storage(std::make_unique<Storage::Facade>())
|
||||||
, _changes(std::make_unique<Data::Changes>(this))
|
|
||||||
, _data(std::make_unique<Data::Session>(this))
|
, _data(std::make_unique<Data::Session>(this))
|
||||||
, _user(_data->processUser(user))
|
, _user(_data->processUser(user))
|
||||||
, _emojiStickersPack(std::make_unique<Stickers::EmojiPack>(this))
|
, _emojiStickersPack(std::make_unique<Stickers::EmojiPack>(this))
|
||||||
|
|
|
@ -83,6 +83,9 @@ public:
|
||||||
}
|
}
|
||||||
bool validateSelf(const MTPUser &user);
|
bool validateSelf(const MTPUser &user);
|
||||||
|
|
||||||
|
[[nodiscard]] Data::Changes &changes() const {
|
||||||
|
return *_changes;
|
||||||
|
}
|
||||||
[[nodiscard]] Api::Updates &updates() const {
|
[[nodiscard]] Api::Updates &updates() const {
|
||||||
return *_updates;
|
return *_updates;
|
||||||
}
|
}
|
||||||
|
@ -104,9 +107,6 @@ public:
|
||||||
[[nodiscard]] Stickers::DicePacks &diceStickersPacks() const {
|
[[nodiscard]] Stickers::DicePacks &diceStickersPacks() const {
|
||||||
return *_diceStickersPacks;
|
return *_diceStickersPacks;
|
||||||
}
|
}
|
||||||
[[nodiscard]] Data::Changes &changes() const {
|
|
||||||
return *_changes;
|
|
||||||
}
|
|
||||||
[[nodiscard]] Data::Session &data() const {
|
[[nodiscard]] Data::Session &data() const {
|
||||||
return *_data;
|
return *_data;
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,7 @@ private:
|
||||||
const not_null<Account*> _account;
|
const not_null<Account*> _account;
|
||||||
|
|
||||||
const std::unique_ptr<SessionSettings> _settings;
|
const std::unique_ptr<SessionSettings> _settings;
|
||||||
|
const std::unique_ptr<Data::Changes> _changes;
|
||||||
const std::unique_ptr<ApiWrap> _api;
|
const std::unique_ptr<ApiWrap> _api;
|
||||||
const std::unique_ptr<Api::Updates> _updates;
|
const std::unique_ptr<Api::Updates> _updates;
|
||||||
const std::unique_ptr<Api::SendProgressManager> _sendProgressManager;
|
const std::unique_ptr<Api::SendProgressManager> _sendProgressManager;
|
||||||
|
@ -173,7 +174,6 @@ private:
|
||||||
const std::unique_ptr<Storage::Facade> _storage;
|
const std::unique_ptr<Storage::Facade> _storage;
|
||||||
|
|
||||||
// _data depends on _downloader / _uploader.
|
// _data depends on _downloader / _uploader.
|
||||||
const std::unique_ptr<Data::Changes> _changes;
|
|
||||||
const std::unique_ptr<Data::Session> _data;
|
const std::unique_ptr<Data::Session> _data;
|
||||||
const not_null<UserData*> _user;
|
const not_null<UserData*> _user;
|
||||||
|
|
||||||
|
|
|
@ -206,10 +206,10 @@ PeerData *readPeer(
|
||||||
const auto loaded = (peerId == selfId)
|
const auto loaded = (peerId == selfId)
|
||||||
? session->user().get()
|
? session->user().get()
|
||||||
: session->data().peerLoaded(peerId);
|
: session->data().peerLoaded(peerId);
|
||||||
const auto apply = !loaded || !loaded->isFullLoaded();
|
const auto apply = !loaded || !loaded->isLoaded();
|
||||||
const auto result = loaded ? loaded : session->data().peer(peerId).get();
|
const auto result = loaded ? loaded : session->data().peer(peerId).get();
|
||||||
if (apply) {
|
if (apply) {
|
||||||
result->setLoadedStatus(PeerData::LoadedStatus::Full);
|
result->setLoadedStatus(PeerData::LoadedStatus::Normal);
|
||||||
}
|
}
|
||||||
if (const auto user = result->asUser()) {
|
if (const auto user = result->asUser()) {
|
||||||
QString first, last, phone, username, inlinePlaceholder;
|
QString first, last, phone, username, inlinePlaceholder;
|
||||||
|
|
|
@ -553,13 +553,12 @@ SessionController::SessionController(
|
||||||
enableGifPauseReason(GifPauseReason::RoundPlaying);
|
enableGifPauseReason(GifPauseReason::RoundPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
base::ObservableViewer(
|
session->changes().peerUpdates(
|
||||||
session->api().fullPeerUpdated()
|
Data::PeerUpdate::Flag::FullInfo
|
||||||
) | rpl::start_with_next([=](PeerData *peer) {
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
if (peer == _showEditPeer) {
|
return (update.peer == _showEditPeer);
|
||||||
_showEditPeer = nullptr;
|
}) | rpl::start_with_next([=] {
|
||||||
show(Box<EditPeerInfoBox>(this, peer));
|
show(Box<EditPeerInfoBox>(this, base::take(_showEditPeer)));
|
||||||
}
|
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
session->data().chatsListChanges(
|
session->data().chatsListChanges(
|
||||||
|
|
Loading…
Add table
Reference in a new issue