From 9fb19fa211b66dd4ce258eee50292cb395a51c23 Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Mon, 30 Jan 2023 08:31:23 +0700 Subject: [PATCH] Revert: Ask for microphone permission when launching the app This partially reverts commit fe2b85ec32d14db7097021864f4198623c681e40 Microphone permission is now only asked on-demand --- Natives/LauncherNewsViewController.m | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/Natives/LauncherNewsViewController.m b/Natives/LauncherNewsViewController.m index 14e64d52..eb28d7b3 100644 --- a/Natives/LauncherNewsViewController.m +++ b/Natives/LauncherNewsViewController.m @@ -1,4 +1,3 @@ -#include #import #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