mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
Request audio/video permissions at app startup on Mac
This commit is contained in:
parent
4d426962d2
commit
656fdc8093
4 changed files with 23 additions and 9 deletions
|
|
@ -432,6 +432,8 @@ void App::initCore() {
|
|||
if (!settings) settings = SettingsCore::create();
|
||||
lDebug() << log().arg("Creating Ui");
|
||||
QMetaObject::invokeMethod(App::getInstance()->thread(), [this, settings] {
|
||||
// Initialize DestopTools here to have logs into files in case of errors.
|
||||
DesktopTools::init();
|
||||
// QML
|
||||
mEngine = new QQmlApplicationEngine(this);
|
||||
assert(mEngine);
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@
|
|||
#ifndef DESKTOP_TOOLS_MAC_OS_H_
|
||||
#define DESKTOP_TOOLS_MAC_OS_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QImage>
|
||||
#include <QVariantList>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QVariantList>
|
||||
// =============================================================================
|
||||
class VideoSourceDescriptorModel;
|
||||
|
||||
|
|
@ -44,6 +44,9 @@ public:
|
|||
static void init(); // Do first initialization
|
||||
static void applicationStateChanged(Qt::ApplicationState currentState);
|
||||
|
||||
// Not used yet because AVSession request automatically permissions when trying to record something.
|
||||
static void requestPermissions();
|
||||
|
||||
static QList<QVariantMap> getWindows();
|
||||
static QImage takeScreenshot(void *window);
|
||||
static QImage getWindowIcon(void *window);
|
||||
|
|
|
|||
|
|
@ -8,15 +8,24 @@
|
|||
#include <QThread>
|
||||
|
||||
void DesktopTools::init(){
|
||||
}
|
||||
|
||||
void DesktopTools::requestPermissions(){
|
||||
// Request permissions
|
||||
if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] != AVAuthorizationStatusAuthorized) {
|
||||
qDebug() << "Requesting Video permission";
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL) {}];
|
||||
}
|
||||
qInfo() << "Requesting Video permission";
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
|
||||
qInfo() << "Video permission has" << (granted ? "" : " not") << " been granted";
|
||||
}];
|
||||
} else
|
||||
qInfo() << "Video permission is already granted";
|
||||
if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio] != AVAuthorizationStatusAuthorized){
|
||||
qDebug() << "Requesting Audio permission";
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL) {}];
|
||||
}
|
||||
qInfo() << "Requesting Audio permission";
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
|
||||
qInfo() << "Audio permission has" << (granted ? "" : " not") << " been granted";
|
||||
}];
|
||||
} else
|
||||
qInfo() << "Audio permission is already granted";
|
||||
}
|
||||
|
||||
bool isWindowMinimized(CGWindowID id) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ if(APPLE)
|
|||
#CPack doesn't sign all files.
|
||||
if (DO_SIGNING)
|
||||
execute_process(COMMAND bash "@CMAKE_SOURCE_DIR@/cmake/install/sign_package.sh" codesign "@LINPHONE_BUILDER_SIGNING_IDENTITY@" "${CPACK_TEMPORARY_INSTALL_DIRECTORY}")
|
||||
#execute_process(COMMAND codesign --entitlements" "@CMAKE_CURRENT_BINARY_DIR@/../../entitlements.xml" "--force" "--deep" "--timestamp" "--options" "runtime,library" "--verbose" "-s" "@LINPHONE_BUILDER_SIGNING_IDENTITY@" "@APPLICATION_OUTPUT_DIR@/@APPLICATION_NAME@.app")
|
||||
execute_process(COMMAND codesign "--entitlements" "@CMAKE_CURRENT_BINARY_DIR@/cmake/install/macos/entitlements.xml" "--force" "--deep" "--timestamp" "--options" "runtime,library" "--verbose" "-s" "@LINPHONE_BUILDER_SIGNING_IDENTITY@" "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@APPLICATION_NAME@.app")
|
||||
else()
|
||||
execute_process(COMMAND codesign --force --deep --sign "-" "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@APPLICATION_NAME@.app" )#If not code signed, app can crash because of APPLE on "Code Signature Invalid" (spotted for ARM64)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue