macos permission: address review comments

This commit is contained in:
Vitor Kiguchi 2022-01-10 15:30:41 +01:00
parent 7bbc94d428
commit 8b0a6b9d5e
6 changed files with 12 additions and 10 deletions

View file

@ -237,8 +237,8 @@ if (APPLE)
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE)
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
target_sources(citra-qt PRIVATE
usage_authorization.h
usage_authorization.mm
macos_authorization.h
macos_authorization.mm
)
elseif(WIN32)
# compile as a win32 gui application instead of a console application

View file

@ -9,7 +9,10 @@
#include <QThread>
#include "citra_qt/camera/qt_multimedia_camera.h"
#include "citra_qt/main.h"
#include "citra_qt/usage_authorization.h"
#if defined(__APPLE__)
#include "citra_qt/macos_authorization.h"
#endif
namespace Camera {
@ -189,8 +192,7 @@ void QtMultimediaCameraHandler::StopCamera() {
void QtMultimediaCameraHandler::StartCamera() {
#if defined(__APPLE__)
bool authorized = AppleAuthorization::CheckAuthorizationForCamera();
if (!authorized) {
if (!AppleAuthorization::CheckAuthorizationForCamera()) {
LOG_ERROR(Service_CAM, "Unable to start camera due to lack of authorization");
return;
}

View file

@ -16,7 +16,7 @@
#include "ui_configure_audio.h"
#if defined(__APPLE__)
#include "citra_qt/usage_authorization.h"
#include "citra_qt/macos_authorization.h"
#endif
constexpr int DEFAULT_INPUT_DEVICE_INDEX = 0;

View file

@ -18,7 +18,7 @@
#include "ui_configure_camera.h"
#if defined(__APPLE__)
#include "citra_qt/usage_authorization.h"
#include "citra_qt/macos_authorization.h"
#endif
const std::array<std::string, 3> ConfigureCamera::Implementations = {

View file

@ -4,7 +4,7 @@
#import <AVFoundation/AVFoundation.h>
#include "citra_qt/usage_authorization.h"
#include "citra_qt/macos_authorization.h"
#include "common/logging/log.h"
namespace AppleAuthorization {
@ -33,8 +33,8 @@ void CheckAuthorization(AuthMediaType type) {
case AVAuthorizationStatusNotDetermined: {
// The app hasn't yet asked the user for camera access.
[AVCaptureDevice requestAccessForMediaType:media_type
completionHandler:^(BOOL) {
authorized = true;
completionHandler:^(BOOL granted) {
authorized = granted;
}];
if (type == AuthMediaType::Camera) {
LOG_INFO(Frontend, "Camera access requested.");