mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added confirm box for stream key revoking from settings of group call.
This commit is contained in:
parent
d49649b3a3
commit
13f1ab7965
3 changed files with 40 additions and 34 deletions
|
@ -1036,6 +1036,14 @@ QString GroupCall::rtmpKey() const {
|
||||||
return _rtmpKey;
|
return _rtmpKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupCall::setRtmpUrl(const QString &value) {
|
||||||
|
_rtmpUrl = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroupCall::setRtmpKey(const QString &value) {
|
||||||
|
_rtmpKey = value;
|
||||||
|
}
|
||||||
|
|
||||||
Data::GroupCall *GroupCall::lookupReal() const {
|
Data::GroupCall *GroupCall::lookupReal() const {
|
||||||
const auto real = _peer->groupCall();
|
const auto real = _peer->groupCall();
|
||||||
return (real && real->id() == _id) ? real : nullptr;
|
return (real && real->id() == _id) ? real : nullptr;
|
||||||
|
|
|
@ -239,6 +239,9 @@ public:
|
||||||
[[nodiscard]] QString rtmpUrl() const;
|
[[nodiscard]] QString rtmpUrl() const;
|
||||||
[[nodiscard]] QString rtmpKey() const;
|
[[nodiscard]] QString rtmpKey() const;
|
||||||
|
|
||||||
|
void setRtmpUrl(const QString &value);
|
||||||
|
void setRtmpKey(const QString &value);
|
||||||
|
|
||||||
[[nodiscard]] Data::GroupCall *lookupReal() const;
|
[[nodiscard]] Data::GroupCall *lookupReal() const;
|
||||||
[[nodiscard]] rpl::producer<not_null<Data::GroupCall*>> real() const;
|
[[nodiscard]] rpl::producer<not_null<Data::GroupCall*>> real() const;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/widgets/dropdown_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/toasts/common_toasts.h"
|
#include "ui/toasts/common_toasts.h"
|
||||||
|
@ -630,16 +630,13 @@ void SettingsBox(
|
||||||
}
|
}
|
||||||
if (rtmp) {
|
if (rtmp) {
|
||||||
struct State {
|
struct State {
|
||||||
base::unique_qptr<Ui::DropdownMenu> menu;
|
base::unique_qptr<Ui::PopupMenu> menu;
|
||||||
mtpRequestId requestId;
|
mtpRequestId requestId;
|
||||||
rpl::event_stream<StartRtmpProcess::Data> data;
|
rpl::event_stream<StartRtmpProcess::Data> data;
|
||||||
};
|
};
|
||||||
const auto top = box->addTopButton(st::groupCallMenuToggle);
|
const auto top = box->addTopButton(st::groupCallMenuToggle);
|
||||||
const auto state = top->lifetime().make_state<State>();
|
const auto state = top->lifetime().make_state<State>();
|
||||||
const auto revoke = [=] {
|
const auto revokeSure = [=] {
|
||||||
if (state->requestId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto session = &peer->session();
|
const auto session = &peer->session();
|
||||||
state->requestId = session->api().request(
|
state->requestId = session->api().request(
|
||||||
MTPphone_GetGroupCallStreamRtmpUrl(
|
MTPphone_GetGroupCallStreamRtmpUrl(
|
||||||
|
@ -653,48 +650,46 @@ void SettingsBox(
|
||||||
.key = qs(data.vkey()),
|
.key = qs(data.vkey()),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
if (const auto call = weakCall.get()) {
|
||||||
|
call->setRtmpUrl(data.url);
|
||||||
|
call->setRtmpKey(data.key);
|
||||||
|
}
|
||||||
|
if (!top) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state->requestId = 0;
|
||||||
state->data.fire(std::move(data));
|
state->data.fire(std::move(data));
|
||||||
}).fail([=] {
|
}).fail([=] {
|
||||||
state->requestId = 0;
|
state->requestId = 0;
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
const auto revoke = [=] {
|
||||||
|
if (state->requestId || !top) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
box->getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
|
.text = tr::lng_group_call_rtmp_revoke_sure(),
|
||||||
|
.confirmed = [=](Fn<void()> &&close) {
|
||||||
|
revokeSure();
|
||||||
|
close();
|
||||||
|
},
|
||||||
|
.confirmText = tr::lng_group_invite_context_revoke(),
|
||||||
|
.labelStyle = &st::groupCallBoxLabel,
|
||||||
|
}));
|
||||||
|
};
|
||||||
top->setClickedCallback([=] {
|
top->setClickedCallback([=] {
|
||||||
state->menu = base::make_unique_q<Ui::DropdownMenu>(
|
state->menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
box,
|
box,
|
||||||
st::groupCallDropdownMenu);
|
st::groupCallPopupMenu);
|
||||||
state->menu->addAction(
|
state->menu->addAction(
|
||||||
tr::lng_group_call_rtmp_revoke(tr::now),
|
tr::lng_group_call_rtmp_revoke(tr::now),
|
||||||
revoke);
|
revoke);
|
||||||
state->menu->moveToRight(
|
state->menu->moveToRight(
|
||||||
st::groupCallRtmpTopBarMenuPosition.x(),
|
st::groupCallRtmpTopBarMenuPosition.x(),
|
||||||
st::groupCallRtmpTopBarMenuPosition.y());
|
st::groupCallRtmpTopBarMenuPosition.y());
|
||||||
state->menu->showAnimated(
|
state->menu->setForcedOrigin(
|
||||||
Ui::PanelAnimation::Origin::TopRight);
|
Ui::PanelAnimation::Origin::TopRight);
|
||||||
const auto raw = state->menu.get();
|
state->menu->popup(QCursor::pos());
|
||||||
raw->setHiddenCallback([=] {
|
|
||||||
raw->deleteLater();
|
|
||||||
if (state->menu == raw) {
|
|
||||||
state->menu = nullptr;
|
|
||||||
if (top) {
|
|
||||||
top->setForceRippled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
raw->setShowStartCallback([=] {
|
|
||||||
if (state->menu == raw) {
|
|
||||||
if (top) {
|
|
||||||
top->setForceRippled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
raw->setHideStartCallback([=] {
|
|
||||||
if (state->menu == raw) {
|
|
||||||
if (top) {
|
|
||||||
top->setForceRippled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
top->installEventFilter(state->menu);
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue