tam
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#import <CoreWLAN/CoreWLAN.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static CLLocationManager *locationManager = nil;
|
||||
@@ -15,6 +17,60 @@ void RequestLocationPermission() {
|
||||
});
|
||||
}
|
||||
|
||||
void RequestCameraAndMicPermission() {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (@available(macOS 10.14, *)) {
|
||||
// Request Camera
|
||||
AVAuthorizationStatus cameraStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
||||
if (cameraStatus == AVAuthorizationStatusNotDetermined) {
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
|
||||
// Camera permission requested
|
||||
}];
|
||||
}
|
||||
|
||||
// Request Microphone
|
||||
AVAuthorizationStatus micStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
|
||||
if (micStatus == AVAuthorizationStatusNotDetermined) {
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
|
||||
// Mic permission requested
|
||||
}];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void RequestScreenCapturePermission() {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (@available(macOS 11.0, *)) {
|
||||
BOOL hasAccess = CGPreflightScreenCaptureAccess();
|
||||
if (!hasAccess) {
|
||||
CGRequestScreenCaptureAccess();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int GetCameraPermissionStatus() {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
return (int)[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GetMicrophonePermissionStatus() {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
return (int)[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GetScreenCapturePermissionStatus() {
|
||||
if (@available(macOS 11.0, *)) {
|
||||
return CGPreflightScreenCaptureAccess() ? 1 : 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
char* ssid;
|
||||
char* bssid;
|
||||
|
||||
Reference in New Issue
Block a user