Commit 91b44e39 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

10.14 compatibility: ask for permissions

Add keys for using camera microphone and photo library.

Change-Id: I7761189ba54af89df1ce4f135d0a9b213069de5f
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 4e39aa5c
......@@ -46,6 +46,12 @@
<string>${MACOSX_BUNDLE_NSMAIN_NIB_FILE}</string>
<key>NSPrincipalClass</key>
<string>${MACOSX_BUNDLE_NSPRINCIPAL_CLASS}</string>
<key>NSCameraUsageDescription</key>
<string>Ring requires to access your camera to make calls and record video</string>
<key>NSMicrophoneUsageDescription</key>
<string>Ring requires to access your microphone to make calls and record audio</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Ring requires to access your photo library to show image on profile and send via chat</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......
......@@ -21,6 +21,7 @@
//cocoa
#import <Quartz/Quartz.h>
#import <AVFoundation/AVFoundation.h>
//Qt
......@@ -356,7 +357,22 @@ typedef NS_ENUM(NSInteger, TagViews) {
- (IBAction)editPhoto:(id)sender
{
auto pictureTaker = [IKPictureTaker pictureTaker];
if (@available(macOS 10.14, *)) {
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)
{
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
if(authStatus == AVAuthorizationStatusNotDetermined)
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if(!granted){
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
}];
}
}
[pictureTaker beginPictureTakerSheetForWindow:[self.view window]
withDelegate:self
didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:)
......
......@@ -20,6 +20,7 @@
//cocoa
#import <Quartz/Quartz.h>
#import <AVFoundation/AVFoundation.h>
//Qt
#import <QSize>
......@@ -160,6 +161,22 @@ typedef NS_ENUM(NSInteger, TagViews) {
- (IBAction)editPhoto:(id)sender
{
auto pictureTaker = [IKPictureTaker pictureTaker];
if (@available(macOS 10.14, *)) {
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)
{
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
if(authStatus == AVAuthorizationStatusNotDetermined)
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if(!granted){
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
}];
}
}
[pictureTaker beginPictureTakerSheetForWindow:[self.view window]
withDelegate:self
......
......@@ -20,6 +20,7 @@
//cocoa
#import <Quartz/Quartz.h>
#import <AVFoundation/AVFoundation.h>
//LRC
#import <api/lrc.h>
......@@ -121,7 +122,22 @@ NSTimer* timeoutTimer;
- (IBAction)editPhoto:(id)sender
{
auto pictureTaker = [IKPictureTaker pictureTaker];
if (@available(macOS 10.14, *)) {
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)
{
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
if(authStatus == AVAuthorizationStatusNotDetermined)
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if(!granted){
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
}];
}
}
[pictureTaker beginPictureTakerSheetForWindow:[self.delegate window]
withDelegate:self
didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:)
......
......@@ -23,6 +23,7 @@
//Cocoa
#import <Quartz/Quartz.h>
#import <AVFoundation/AVFoundation.h>
//Qt
#import <QUrl>
......@@ -150,7 +151,22 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2;
- (IBAction)editPhoto:(id)sender
{
auto pictureTaker = [IKPictureTaker pictureTaker];
if (@available(macOS 10.14, *)) {
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied)
{
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
if(authStatus == AVAuthorizationStatusNotDetermined)
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if(!granted){
[pictureTaker setValue:0 forKey:IKPictureTakerAllowsVideoCaptureKey];
}
}];
}
}
[pictureTaker beginPictureTakerSheetForWindow:[self.delegate window]
withDelegate:self
didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:)
......
......@@ -31,7 +31,6 @@
#import <localprofilecollection.h>
#import <profilemodel.h>
#import "backends/AddressBookBackend.h"
#import "delegates/ImageManipulationDelegate.h"
int main(int argc, const char *argv[]) {
......@@ -61,7 +60,5 @@ int main(int argc, const char *argv[]) {
GlobalInstances::setPixmapManipulator(std::unique_ptr<Interfaces::ImageManipulationDelegate>(new Interfaces::ImageManipulationDelegate()));
ProfileModel::instance().addCollection<LocalProfileCollection>(LoadOptions::FORCE_ENABLED);
return NSApplicationMain(argc, argv);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment