Revert: Ask for microphone permission when launching the app

This partially reverts commit fe2b85ec32

Microphone permission is now only asked on-demand
This commit is contained in:
Duy Tran Khanh committed 2023-01-30 08:31:23 +07:00
1 parent fe2b85ec32
commit 9fb19fa211
1 file changed
+1 -25
+1 -25
View File
@@ -1,4 +1,3 @@
#include <AVFoundation/AVAudioSession.h>
#import <WebKit/WebKit.h>
#import "LauncherNewsViewController.h"
#import "LauncherPreferences.h"
@@ -40,9 +39,7 @@ UIEdgeInsets insets;
[webView.scrollView setShowsHorizontalScrollIndicator:NO];
[webView loadRequest:request];
[self.view addSubview:webView];
[self askForMicrophonePermission];
if(roundf(NSProcessInfo.processInfo.physicalMemory / 1048576) < 1900 && ![getPreference(@"force_unsupported_launch") boolValue]) {
UIAlertController *RAMAlert = [UIAlertController alertControllerWithTitle:localize(@"login.warn.title.a7", nil) message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
@@ -108,25 +105,4 @@ decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
decisionHandler(WKNavigationActionPolicyAllow);
}
- (void)askForMicrophonePermission {
switch ([[AVAudioSession sharedInstance] recordPermission]) {
case AVAudioSessionRecordPermissionGranted:
setenv("POJAV_MIC_ALLOWED", "1", 1);
break;
case AVAudioSessionRecordPermissionDenied:
break;
case AVAudioSessionRecordPermissionUndetermined:
// This is the initial state before a user has made any choice
// You can use this spot to request permission here if you want
[[AVAudioSession sharedInstance]requestRecordPermission:^(BOOL granted) {
if(granted) {
setenv("POJAV_MIC_ALLOWED", "1", 1);
}
}];
break;
default:
break;
}
}
@end