2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fixed permissions requesting for different call types.

This commit is contained in:
23rd
2020-11-30 23:56:43 +03:00
committed by John Preston
parent c4c18d16ab
commit 80597e190a
5 changed files with 30 additions and 16 deletions

View File

@@ -55,7 +55,7 @@ void Instance::startOutgoingCall(not_null<UserData*> user, bool video) {
}
requestPermissionsOrFail(crl::guard(this, [=] {
createCall(user, Call::Type::Outgoing, video);
}));
}), video);
}
void Instance::startGroupCall(not_null<ChannelData*> channel) {
@@ -64,7 +64,7 @@ void Instance::startGroupCall(not_null<ChannelData*> channel) {
}
requestPermissionsOrFail(crl::guard(this, [=] {
createGroupCall(channel, MTP_inputGroupCall(MTPlong(), MTPlong()));
}));
}), false);
}
void Instance::joinGroupCall(
@@ -75,7 +75,7 @@ void Instance::joinGroupCall(
}
requestPermissionsOrFail(crl::guard(this, [=] {
createGroupCall(channel, call);
}));
}), false);
}
void Instance::callFinished(not_null<Call*> call) {
@@ -462,12 +462,15 @@ rpl::producer<GroupCall*> Instance::currentGroupCallValue() const {
return _currentGroupCallChanges.events_starting_with(currentGroupCall());
}
void Instance::requestPermissionsOrFail(Fn<void()> onSuccess) {
void Instance::requestPermissionsOrFail(Fn<void()> onSuccess, bool video) {
using Type = Platform::PermissionType;
requestPermissionOrFail(Type::Microphone, [=] {
requestPermissionOrFail(Type::Camera, [=] {
crl::on_main(onSuccess);
});
auto callback = [=] { crl::on_main(onSuccess); };
if (video) {
requestPermissionOrFail(Type::Camera, std::move(callback));
} else {
callback();
}
});
}