2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Added support for platform-specific microphone permission in calls

This commit is contained in:
Grishka
2018-09-30 18:42:50 +03:00
committed by John Preston
parent 500ecb464c
commit 44eac2bf07
9 changed files with 140 additions and 1 deletions

View File

@@ -626,6 +626,37 @@ void RegisterCustomScheme() {
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
}
PermissionStatus GetPermissionStatus(PermissionType type) {
if(type==PermissionType::Microphone) {
PermissionStatus result=PermissionStatus::Granted;
HKEY hKey;
LSTATUS res=RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\CapabilityAccessManager\\ConsentStore\\microphone", 0, KEY_QUERY_VALUE, &hKey);
if(res==ERROR_SUCCESS) {
wchar_t buf[20];
DWORD length=sizeof(buf);
res=RegQueryValueEx(hKey, L"Value", NULL, NULL, (LPBYTE)buf, &length);
if(res==ERROR_SUCCESS) {
if(wcscmp(buf, L"Deny")==0) {
result=PermissionStatus::Denied;
}
}
RegCloseKey(hKey);
}
return result;
}
return PermissionStatus::Granted;
}
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback) {
}
void OpenSystemSettingsForPermission(PermissionType type) {
if(type==PermissionType::Microphone) {
ShellExecute(NULL, L"open", L"ms-settings:privacy-microphone", NULL, NULL, SW_SHOWDEFAULT);
}
}
} // namespace Platform
void psNewVersion() {