diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 58fc9402e..825d07dac 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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"; diff --git a/Telegram/SourceFiles/calls/calls_group_panel.cpp b/Telegram/SourceFiles/calls/calls_group_panel.cpp index 15d2e6137..8ada11c79 100644 --- a/Telegram/SourceFiles/calls/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_group_panel.cpp @@ -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 InviteContactsController::createRow( Panel::Panel(not_null call) : _call(call) , _peer(call->peer()) +, _window(std::make_unique()) , _layerBg(std::make_unique(_window->body())) #ifndef Q_OS_MAC , _controls(std::make_unique( @@ -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>(); + 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()); diff --git a/Telegram/SourceFiles/calls/calls_group_panel.h b/Telegram/SourceFiles/calls/calls_group_panel.h index 586aa712b..c05ba7be9 100644 --- a/Telegram/SourceFiles/calls/calls_group_panel.h +++ b/Telegram/SourceFiles/calls/calls_group_panel.h @@ -84,6 +84,7 @@ private: void setupRealMuteButtonState(not_null real); bool handleClose(); + void startScheduledNow(); void updateControlsGeometry(); void updateMembersGeometry(); diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 1411d02d0..b3812ca2a 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -184,6 +184,7 @@ void Panel::Incoming::fillBottomShadow(QPainter &p) { Panel::Panel(not_null call) : _call(call) , _user(call->user()) +, _window(std::make_unique()) #ifndef Q_OS_MAC , _controls(std::make_unique( _window->body(), diff --git a/Telegram/SourceFiles/ui/chat/group_call_bar.cpp b/Telegram/SourceFiles/ui/chat/group_call_bar.cpp index 586975023..0092d638e 100644 --- a/Telegram/SourceFiles/ui/chat/group_call_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/group_call_bar.cpp @@ -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( _inner.get(), tr::lng_group_call_join(), st::groupCallTopBarJoin); setupRightButton(_join.get()); } - return; } else if (!_scheduledProcess) { _scheduledProcess = std::make_unique(date); _join = nullptr; diff --git a/Telegram/lib_base b/Telegram/lib_base index 7a5fd8269..32b7db64c 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 7a5fd82692d2fb5df9b48c08c354f4400157a999 +Subproject commit 32b7db64c5ec44dadd95a4024dfd1e8c8d23fa12