mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Request mic permission only on unmute.
This commit is contained in:
parent
7feb841081
commit
092e0990e8
4 changed files with 29 additions and 19 deletions
|
@ -354,13 +354,20 @@ void GroupCall::finish(FinishType type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupCall::setMuted(MuteState mute) {
|
void GroupCall::setMuted(MuteState mute) {
|
||||||
const auto wasMuted = (muted() == MuteState::Muted)
|
const auto set = [=] {
|
||||||
|| (muted() == MuteState::PushToTalk);
|
const auto wasMuted = (muted() == MuteState::Muted)
|
||||||
_muted = mute;
|
|| (muted() == MuteState::PushToTalk);
|
||||||
const auto nowMuted = (muted() == MuteState::Muted)
|
_muted = mute;
|
||||||
|| (muted() == MuteState::PushToTalk);
|
const auto nowMuted = (muted() == MuteState::Muted)
|
||||||
if (wasMuted != nowMuted) {
|
|| (muted() == MuteState::PushToTalk);
|
||||||
applySelfInCallLocally();
|
if (wasMuted != nowMuted) {
|
||||||
|
applySelfInCallLocally();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (mute == MuteState::Active || mute == MuteState::PushToTalk) {
|
||||||
|
_delegate->groupCallRequestPermissionsOrFail(crl::guard(this, set));
|
||||||
|
} else {
|
||||||
|
set();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,8 @@ public:
|
||||||
|
|
||||||
virtual void groupCallFinished(not_null<GroupCall*> call) = 0;
|
virtual void groupCallFinished(not_null<GroupCall*> call) = 0;
|
||||||
virtual void groupCallFailed(not_null<GroupCall*> call) = 0;
|
virtual void groupCallFailed(not_null<GroupCall*> call) = 0;
|
||||||
|
virtual void groupCallRequestPermissionsOrFail(
|
||||||
|
Fn<void()> onSuccess) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using GlobalShortcutManager = base::GlobalShortcutManager;
|
using GlobalShortcutManager = base::GlobalShortcutManager;
|
||||||
|
|
|
@ -60,12 +60,11 @@ void Instance::startOutgoingCall(not_null<UserData*> user, bool video) {
|
||||||
|
|
||||||
void Instance::startOrJoinGroupCall(not_null<ChannelData*> channel) {
|
void Instance::startOrJoinGroupCall(not_null<ChannelData*> channel) {
|
||||||
destroyCurrentCall();
|
destroyCurrentCall();
|
||||||
requestPermissionsOrFail(crl::guard(this, [=] {
|
|
||||||
const auto call = channel->call();
|
const auto call = channel->call();
|
||||||
createGroupCall(
|
createGroupCall(
|
||||||
channel,
|
channel,
|
||||||
call ? call->input() : MTP_inputGroupCall(MTPlong(), MTPlong()));
|
call ? call->input() : MTP_inputGroupCall(MTPlong(), MTPlong()));
|
||||||
}), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::callFinished(not_null<Call*> call) {
|
void Instance::callFinished(not_null<Call*> call) {
|
||||||
|
@ -186,9 +185,8 @@ void Instance::destroyGroupCall(not_null<GroupCall*> call) {
|
||||||
void Instance::createGroupCall(
|
void Instance::createGroupCall(
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
const MTPInputGroupCall &inputCall) {
|
const MTPInputGroupCall &inputCall) {
|
||||||
if (_currentGroupCall) {
|
destroyCurrentCall();
|
||||||
destroyGroupCall(_currentGroupCall.get());
|
|
||||||
}
|
|
||||||
auto call = std::make_unique<GroupCall>(
|
auto call = std::make_unique<GroupCall>(
|
||||||
getGroupCallDelegate(),
|
getGroupCallDelegate(),
|
||||||
channel,
|
channel,
|
||||||
|
|
|
@ -55,7 +55,9 @@ public:
|
||||||
[[nodiscard]] bool hasActivePanel(
|
[[nodiscard]] bool hasActivePanel(
|
||||||
not_null<Main::Session*> session) const;
|
not_null<Main::Session*> session) const;
|
||||||
bool activateCurrentCall();
|
bool activateCurrentCall();
|
||||||
std::shared_ptr<tgcalls::VideoCaptureInterface> getVideoCapture() override;
|
auto getVideoCapture()
|
||||||
|
-> std::shared_ptr<tgcalls::VideoCaptureInterface> override;
|
||||||
|
void requestPermissionsOrFail(Fn<void()> onSuccess, bool video = true);
|
||||||
|
|
||||||
void setCurrentAudioDevice(bool input, const QString &deviceId);
|
void setCurrentAudioDevice(bool input, const QString &deviceId);
|
||||||
|
|
||||||
|
@ -82,6 +84,9 @@ private:
|
||||||
|
|
||||||
void groupCallFinished(not_null<GroupCall*> call) override;
|
void groupCallFinished(not_null<GroupCall*> call) override;
|
||||||
void groupCallFailed(not_null<GroupCall*> call) override;
|
void groupCallFailed(not_null<GroupCall*> call) override;
|
||||||
|
void groupCallRequestPermissionsOrFail(Fn<void()> onSuccess) override {
|
||||||
|
requestPermissionsOrFail(std::move(onSuccess), false);
|
||||||
|
}
|
||||||
|
|
||||||
using Sound = Call::Delegate::Sound;
|
using Sound = Call::Delegate::Sound;
|
||||||
void playSound(Sound sound) override;
|
void playSound(Sound sound) override;
|
||||||
|
@ -93,7 +98,6 @@ private:
|
||||||
const MTPInputGroupCall &inputCall);
|
const MTPInputGroupCall &inputCall);
|
||||||
void destroyGroupCall(not_null<GroupCall*> call);
|
void destroyGroupCall(not_null<GroupCall*> call);
|
||||||
|
|
||||||
void requestPermissionsOrFail(Fn<void()> onSuccess, bool video = true);
|
|
||||||
void requestPermissionOrFail(Platform::PermissionType type, Fn<void()> onSuccess);
|
void requestPermissionOrFail(Platform::PermissionType type, Fn<void()> onSuccess);
|
||||||
|
|
||||||
void refreshDhConfig();
|
void refreshDhConfig();
|
||||||
|
|
Loading…
Add table
Reference in a new issue