mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Add confirm for starting scheduled voice chat early.
This commit is contained in:
parent
8c7217ad56
commit
27fc61c676
6 changed files with 37 additions and 3 deletions
|
@ -2079,6 +2079,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_group_call_starts_short_tomorrow" = "Tomorrow, {time}";
|
||||
"lng_group_call_starts_short_date" = "{date}, {time}";
|
||||
"lng_group_call_start_now" = "Start Now";
|
||||
"lng_group_call_start_now_sure" = "Are you sure you want to start the voice chat now?";
|
||||
"lng_group_call_set_reminder" = "Set Reminder";
|
||||
"lng_group_call_cancel_reminder" = "Cancel Reminder";
|
||||
"lng_group_call_join_as_personal" = "personal account";
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace {
|
|||
constexpr auto kSpacePushToTalkDelay = crl::time(250);
|
||||
constexpr auto kRecordingAnimationDuration = crl::time(1200);
|
||||
constexpr auto kRecordingOpacity = 0.6;
|
||||
constexpr auto kStartNoConfirmation = TimeId(10);
|
||||
|
||||
class InviteController final : public ParticipantsBoxController {
|
||||
public:
|
||||
|
@ -373,6 +374,7 @@ std::unique_ptr<PeerListRow> InviteContactsController::createRow(
|
|||
Panel::Panel(not_null<GroupCall*> call)
|
||||
: _call(call)
|
||||
, _peer(call->peer())
|
||||
, _window(std::make_unique<Ui::Window>())
|
||||
, _layerBg(std::make_unique<Ui::LayerManager>(_window->body()))
|
||||
#ifndef Q_OS_MAC
|
||||
, _controls(std::make_unique<Ui::Platform::TitleControls>(
|
||||
|
@ -539,6 +541,31 @@ void Panel::endCall() {
|
|||
BoxContext::GroupCallPanel));
|
||||
}
|
||||
|
||||
void Panel::startScheduledNow() {
|
||||
const auto date = _call->scheduleDate();
|
||||
const auto now = base::unixtime::now();
|
||||
if (!date) {
|
||||
return;
|
||||
} else if (now + kStartNoConfirmation >= date) {
|
||||
_call->startScheduledNow();
|
||||
} else {
|
||||
const auto box = std::make_shared<QPointer<Ui::GenericBox>>();
|
||||
const auto done = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
_call->startScheduledNow();
|
||||
};
|
||||
auto owned = Box(
|
||||
ConfirmBox,
|
||||
TextWithEntities{ tr::lng_group_call_start_now_sure(tr::now) },
|
||||
tr::lng_group_call_start_now(),
|
||||
done);
|
||||
*box = owned.data();
|
||||
_layerBg->showBox(std::move(owned));
|
||||
}
|
||||
}
|
||||
|
||||
void Panel::initControls() {
|
||||
_mute->clicks(
|
||||
) | rpl::filter([=](Qt::MouseButton button) {
|
||||
|
@ -546,7 +573,7 @@ void Panel::initControls() {
|
|||
}) | rpl::start_with_next([=] {
|
||||
if (_call->scheduleDate()) {
|
||||
if (_peer->canManageGroupCall()) {
|
||||
_call->startScheduledNow();
|
||||
startScheduledNow();
|
||||
} else if (const auto real = _call->lookupReal()) {
|
||||
_call->toggleScheduleStartSubscribed(
|
||||
!real->scheduleStartSubscribed());
|
||||
|
|
|
@ -84,6 +84,7 @@ private:
|
|||
void setupRealMuteButtonState(not_null<Data::GroupCall*> real);
|
||||
|
||||
bool handleClose();
|
||||
void startScheduledNow();
|
||||
|
||||
void updateControlsGeometry();
|
||||
void updateMembersGeometry();
|
||||
|
|
|
@ -184,6 +184,7 @@ void Panel::Incoming::fillBottomShadow(QPainter &p) {
|
|||
Panel::Panel(not_null<Call*> call)
|
||||
: _call(call)
|
||||
, _user(call->user())
|
||||
, _window(std::make_unique<Ui::Window>())
|
||||
#ifndef Q_OS_MAC
|
||||
, _controls(std::make_unique<Ui::Platform::TitleControls>(
|
||||
_window->body(),
|
||||
|
|
|
@ -125,6 +125,9 @@ GroupCallBar::GroupCallBar(
|
|||
_inner->update();
|
||||
refreshScheduledProcess();
|
||||
}, lifetime());
|
||||
if (!_open && !_join) {
|
||||
refreshScheduledProcess();
|
||||
}
|
||||
|
||||
std::move(
|
||||
copy
|
||||
|
@ -170,13 +173,14 @@ void GroupCallBar::refreshScheduledProcess() {
|
|||
_scheduledProcess = nullptr;
|
||||
_open = nullptr;
|
||||
_openBrushForWidth = 0;
|
||||
}
|
||||
if (!_join) {
|
||||
_join = std::make_unique<RoundButton>(
|
||||
_inner.get(),
|
||||
tr::lng_group_call_join(),
|
||||
st::groupCallTopBarJoin);
|
||||
setupRightButton(_join.get());
|
||||
}
|
||||
return;
|
||||
} else if (!_scheduledProcess) {
|
||||
_scheduledProcess = std::make_unique<GroupCallScheduledLeft>(date);
|
||||
_join = nullptr;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7a5fd82692d2fb5df9b48c08c354f4400157a999
|
||||
Subproject commit 32b7db64c5ec44dadd95a4024dfd1e8c8d23fa12
|
Loading…
Add table
Reference in a new issue