mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add schedule voice chat link in ConfirmBox.
This commit is contained in:
parent
27fc61c676
commit
96bc4858c1
7 changed files with 87 additions and 49 deletions
|
@ -1995,8 +1995,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_leave_title" = "Leave voice chat";
|
"lng_group_call_leave_title" = "Leave voice chat";
|
||||||
"lng_group_call_leave_sure" = "Are you sure you want to leave this voice chat?";
|
"lng_group_call_leave_sure" = "Are you sure you want to leave this voice chat?";
|
||||||
"lng_group_call_close" = "Close";
|
"lng_group_call_close" = "Close";
|
||||||
"lng_group_call_close_sure" = "Voice chat is scheduled. You can cancel it or just close this panel.";
|
"lng_group_call_close_sure" = "Voice chat is scheduled. You can abort it or just close this panel.";
|
||||||
"lng_group_call_also_cancel" = "Cancel voice chat";
|
"lng_group_call_also_cancel" = "Abort voice chat";
|
||||||
"lng_group_call_leave_to_other_sure" = "Do you want to leave your active voice chat and join a voice chat in this group?";
|
"lng_group_call_leave_to_other_sure" = "Do you want to leave your active voice chat and join a voice chat in this group?";
|
||||||
"lng_group_call_create_sure" = "Do you really want to start a voice chat in this group?";
|
"lng_group_call_create_sure" = "Do you really want to start a voice chat in this group?";
|
||||||
"lng_group_call_create_sure_channel" = "Are you sure you want to start a voice chat in this channel as your personal account?";
|
"lng_group_call_create_sure_channel" = "Are you sure you want to start a voice chat in this channel as your personal account?";
|
||||||
|
@ -2027,7 +2027,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_copy_speaker_link" = "Copy Speaker Link";
|
"lng_group_call_copy_speaker_link" = "Copy Speaker Link";
|
||||||
"lng_group_call_copy_listener_link" = "Copy Listener Link";
|
"lng_group_call_copy_listener_link" = "Copy Listener Link";
|
||||||
"lng_group_call_end" = "End Voice Chat";
|
"lng_group_call_end" = "End Voice Chat";
|
||||||
"lng_group_call_cancel" = "Cancel Voice Chat";
|
"lng_group_call_cancel" = "Abort Voice Chat";
|
||||||
"lng_group_call_join" = "Join";
|
"lng_group_call_join" = "Join";
|
||||||
"lng_group_call_join_confirm" = "Do you want to join the voice chat {chat}?";
|
"lng_group_call_join_confirm" = "Do you want to join the voice chat {chat}?";
|
||||||
"lng_group_call_invite_done_user" = "You invited {user} to the voice chat.";
|
"lng_group_call_invite_done_user" = "You invited {user} to the voice chat.";
|
||||||
|
@ -2062,8 +2062,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_join_as_header" = "Join Voice Chat as...";
|
"lng_group_call_join_as_header" = "Join Voice Chat as...";
|
||||||
"lng_group_call_display_as_header" = "Display me as...";
|
"lng_group_call_display_as_header" = "Display me as...";
|
||||||
"lng_group_call_join_as_about" = "Choose whether you want to be displayed as your personal account or as your channel.";
|
"lng_group_call_join_as_about" = "Choose whether you want to be displayed as your personal account or as your channel.";
|
||||||
"lng_group_call_or_schedule" = "Or you can {link}.";
|
"lng_group_call_or_schedule" = "You can also {link}.";
|
||||||
"lng_group_call_schedule" = "Schedule Voice Chat";
|
"lng_group_call_schedule" = "schedule a voice chat";
|
||||||
"lng_group_call_schedule_title" = "Schedule Voice Chat";
|
"lng_group_call_schedule_title" = "Schedule Voice Chat";
|
||||||
"lng_group_call_schedule_notified_group" = "The members of the group will be notified that the voice chat will start in {duration}.";
|
"lng_group_call_schedule_notified_group" = "The members of the group will be notified that the voice chat will start in {duration}.";
|
||||||
"lng_group_call_schedule_notified_channel" = "The subscribers of the channel will be notified that the voice chat will start in {duration}.";
|
"lng_group_call_schedule_notified_channel" = "The subscribers of the channel will be notified that the voice chat will start in {duration}.";
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "calls/calls_choose_join_as.h"
|
#include "calls/calls_choose_join_as.h"
|
||||||
|
|
||||||
#include "calls/calls_group_common.h"
|
#include "calls/calls_group_common.h"
|
||||||
|
#include "calls/calls_group_menu.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
@ -21,10 +22,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/boxes/choose_date_time.h"
|
#include "ui/boxes/choose_date_time.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
#include "boxes/confirm_box.h"
|
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "base/timer_rpl.h"
|
#include "base/timer_rpl.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_calls.h"
|
#include "styles/style_calls.h"
|
||||||
|
|
||||||
namespace Calls::Group {
|
namespace Calls::Group {
|
||||||
|
@ -230,10 +231,8 @@ void ChooseJoinAsBox(
|
||||||
label->setClickHandlerFilter([=](const auto&...) {
|
label->setClickHandlerFilter([=](const auto&...) {
|
||||||
auto withJoinAs = info;
|
auto withJoinAs = info;
|
||||||
withJoinAs.joinAs = controller->selected();
|
withJoinAs.joinAs = controller->selected();
|
||||||
box->getDelegate()->show(Box(
|
box->getDelegate()->show(
|
||||||
ScheduleGroupCallBox,
|
Box(ScheduleGroupCallBox, withJoinAs, done));
|
||||||
withJoinAs,
|
|
||||||
done));
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -378,7 +377,7 @@ void ChooseJoinAsProcess::start(
|
||||||
&& (peer->groupCall() != nullptr);
|
&& (peer->groupCall() != nullptr);
|
||||||
|
|
||||||
if (!changingJoinAsFrom && (onlyByMe || byAlreadyUsed)) {
|
if (!changingJoinAsFrom && (onlyByMe || byAlreadyUsed)) {
|
||||||
const auto confirmation = CreateOrJoinConfirmation(
|
auto confirmation = CreateOrJoinConfirmation(
|
||||||
peer,
|
peer,
|
||||||
context,
|
context,
|
||||||
byAlreadyUsed);
|
byAlreadyUsed);
|
||||||
|
@ -386,12 +385,36 @@ void ChooseJoinAsProcess::start(
|
||||||
finish(info);
|
finish(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto box = Box<::ConfirmBox>(
|
const auto creating = !peer->groupCall();
|
||||||
confirmation,
|
if (creating) {
|
||||||
(peer->groupCall()
|
confirmation
|
||||||
? tr::lng_group_call_join(tr::now)
|
.append("\n\n")
|
||||||
: tr::lng_create_group_create(tr::now)),
|
.append(tr::lng_group_call_or_schedule(
|
||||||
crl::guard(&_request->guard, [=] { finish(info); }));
|
tr::now,
|
||||||
|
lt_link,
|
||||||
|
Ui::Text::Link(tr::lng_group_call_schedule(tr::now)),
|
||||||
|
Ui::Text::WithEntities));
|
||||||
|
}
|
||||||
|
const auto guard = base::make_weak(&_request->guard);
|
||||||
|
const auto safeFinish = crl::guard(guard, [=] { finish(info); });
|
||||||
|
const auto filter = [=](const auto &...) {
|
||||||
|
if (guard) {
|
||||||
|
_request->showBox(Box(
|
||||||
|
ScheduleGroupCallBox,
|
||||||
|
info,
|
||||||
|
crl::guard(guard, finish)));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
auto box = ConfirmBox({
|
||||||
|
.text = confirmation,
|
||||||
|
.button = (creating
|
||||||
|
? tr::lng_create_group_create()
|
||||||
|
: tr::lng_group_call_join()),
|
||||||
|
.callback = crl::guard(guard, [=] { finish(info); }),
|
||||||
|
.st = &st::boxLabel,
|
||||||
|
.filter = filter,
|
||||||
|
});
|
||||||
box->boxClosing(
|
box->boxClosing(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
_request = nullptr;
|
_request = nullptr;
|
||||||
|
|
|
@ -395,12 +395,7 @@ void GroupCall::join(const MTPInputGroupCall &inputCall) {
|
||||||
_id = data.vid().v;
|
_id = data.vid().v;
|
||||||
_accessHash = data.vaccess_hash().v;
|
_accessHash = data.vaccess_hash().v;
|
||||||
});
|
});
|
||||||
if (_scheduleDate) {
|
setState(_scheduleDate ? State::Waiting : State::Joining);
|
||||||
setState(State::Waiting);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setState(State::Joining);
|
|
||||||
if (const auto chat = _peer->asChat()) {
|
if (const auto chat = _peer->asChat()) {
|
||||||
chat->setGroupCall(inputCall);
|
chat->setGroupCall(inputCall);
|
||||||
} else if (const auto group = _peer->asChannel()) {
|
} else if (const auto group = _peer->asChannel()) {
|
||||||
|
@ -408,6 +403,10 @@ void GroupCall::join(const MTPInputGroupCall &inputCall) {
|
||||||
} else {
|
} else {
|
||||||
Unexpected("Peer type in GroupCall::join.");
|
Unexpected("Peer type in GroupCall::join.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_scheduleDate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rejoin();
|
rejoin();
|
||||||
|
|
||||||
using Update = Data::GroupCall::ParticipantUpdate;
|
using Update = Data::GroupCall::ParticipantUpdate;
|
||||||
|
|
|
@ -568,19 +568,20 @@ void LeaveBox(
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmBox(
|
void ConfirmBoxBuilder(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
const TextWithEntities &text,
|
ConfirmBoxArgs &&args) {
|
||||||
rpl::producer<QString> button,
|
const auto label = box->addRow(
|
||||||
Fn<void()> callback) {
|
|
||||||
box->addRow(
|
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
box.get(),
|
box.get(),
|
||||||
rpl::single(text),
|
rpl::single(args.text),
|
||||||
st::groupCallBoxLabel),
|
args.st ? *args.st : st::groupCallBoxLabel),
|
||||||
st::boxPadding);
|
st::boxPadding);
|
||||||
if (callback) {
|
if (args.callback) {
|
||||||
box->addButton(std::move(button), callback);
|
box->addButton(std::move(args.button), std::move(args.callback));
|
||||||
|
}
|
||||||
|
if (args.filter) {
|
||||||
|
label->setClickHandlerFilter(std::move(args.filter));
|
||||||
}
|
}
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "base/object_ptr.h"
|
#include "base/object_ptr.h"
|
||||||
#include "base/unique_qptr.h"
|
#include "base/unique_qptr.h"
|
||||||
|
#include "ui/layers/generic_box.h"
|
||||||
|
|
||||||
|
namespace style {
|
||||||
|
struct FlatLabel;
|
||||||
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class DropdownMenu;
|
class DropdownMenu;
|
||||||
|
@ -38,11 +43,19 @@ void LeaveBox(
|
||||||
bool discardChecked,
|
bool discardChecked,
|
||||||
BoxContext context);
|
BoxContext context);
|
||||||
|
|
||||||
void ConfirmBox(
|
struct ConfirmBoxArgs {
|
||||||
not_null<Ui::GenericBox*> box,
|
TextWithEntities text;
|
||||||
const TextWithEntities &text,
|
rpl::producer<QString> button;
|
||||||
rpl::producer<QString> button,
|
Fn<void()> callback;
|
||||||
Fn<void()> callback);
|
const style::FlatLabel *st = nullptr;
|
||||||
|
Fn<bool(const ClickHandlerPtr&, Qt::MouseButton)> filter;
|
||||||
|
};
|
||||||
|
|
||||||
|
void ConfirmBoxBuilder(not_null<Ui::GenericBox*> box, ConfirmBoxArgs &&args);
|
||||||
|
|
||||||
|
inline auto ConfirmBox(ConfirmBoxArgs &&args) {
|
||||||
|
return Box(ConfirmBoxBuilder, std::move(args));
|
||||||
|
}
|
||||||
|
|
||||||
void FillMenu(
|
void FillMenu(
|
||||||
not_null<Ui::DropdownMenu*> menu,
|
not_null<Ui::DropdownMenu*> menu,
|
||||||
|
|
|
@ -556,11 +556,11 @@ void Panel::startScheduledNow() {
|
||||||
}
|
}
|
||||||
_call->startScheduledNow();
|
_call->startScheduledNow();
|
||||||
};
|
};
|
||||||
auto owned = Box(
|
auto owned = ConfirmBox({
|
||||||
ConfirmBox,
|
.text = { tr::lng_group_call_start_now_sure(tr::now) },
|
||||||
TextWithEntities{ tr::lng_group_call_start_now_sure(tr::now) },
|
.button = tr::lng_group_call_start_now(),
|
||||||
tr::lng_group_call_start_now(),
|
.callback = done,
|
||||||
done);
|
});
|
||||||
*box = owned.data();
|
*box = owned.data();
|
||||||
_layerBg->showBox(std::move(owned));
|
_layerBg->showBox(std::move(owned));
|
||||||
}
|
}
|
||||||
|
@ -1153,11 +1153,14 @@ void Panel::addMembers() {
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
};
|
};
|
||||||
auto box = Box(
|
const auto done = [=] {
|
||||||
ConfirmBox,
|
inviteWithAdd(users, nonMembers, finishWithConfirm);
|
||||||
TextWithEntities{ text },
|
};
|
||||||
tr::lng_participant_invite(),
|
auto box = ConfirmBox({
|
||||||
[=] { inviteWithAdd(users, nonMembers, finishWithConfirm); });
|
.text = { text },
|
||||||
|
.button = tr::lng_participant_invite(),
|
||||||
|
.callback = done,
|
||||||
|
});
|
||||||
*shared = box.data();
|
*shared = box.data();
|
||||||
_layerBg->showBox(std::move(box));
|
_layerBg->showBox(std::move(box));
|
||||||
};
|
};
|
||||||
|
|
|
@ -149,8 +149,7 @@ object_ptr<ShareBox> ShareInviteLinkBox(
|
||||||
}
|
}
|
||||||
text.append(error.first);
|
text.append(error.first);
|
||||||
if (const auto weak = *box) {
|
if (const auto weak = *box) {
|
||||||
weak->getDelegate()->show(
|
weak->getDelegate()->show(ConfirmBox({ .text = text }));
|
||||||
Box(ConfirmBox, text, nullptr, nullptr));
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue