1818using Android . Media . Audiofx ;
1919using Android . OS ;
2020using Android . Provider ;
21+ using AndroidX . Activity . Result ;
2122using Com . Xamarin . Formsviewgroup ;
2223using ComputerUtils . Android ;
2324using Xamarin . Essentials ;
@@ -32,7 +33,9 @@ public class CoreService
3233 public static CoreVars coreVars = new CoreVars ( ) ;
3334 public static Version version = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ;
3435 public static string ua = "Mozilla/5.0 (X11; Linux x86_64; Quest) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/23.2.0.4.49.401374055 SamsungBrowser/4.0 Chrome/104.0.5112.111 VR Safari/537.36" ;
35- public async void Start ( )
36+ public static ActivityResultLauncher launcher ;
37+
38+ public static async void Start ( )
3639 {
3740 // Accept every ssl certificate, may be a security risk but it's the only way to get the mod list (CoPilot)
3841 ServicePointManager . ServerCertificateValidationCallback = new RemoteCertificateValidationCallback ( delegate { return true ; } ) ;
@@ -47,6 +50,7 @@ public async void Start()
4750 {
4851 if ( await Permissions . RequestAsync < Permissions . StorageRead > ( ) != PermissionStatus . Granted ) return ;
4952 }
53+ AfterPermissionGrantStart ( ) ;
5054 }
5155 else
5256 {
@@ -56,15 +60,20 @@ public async void Start()
5660 if ( Directory . Exists ( coreVars . QAVSPermTestDir ) ) Directory . Delete ( coreVars . QAVSPermTestDir , true ) ;
5761 Directory . CreateDirectory ( coreVars . QAVSPermTestDir ) ;
5862 Directory . Delete ( coreVars . QAVSPermTestDir , true ) ;
63+ AfterPermissionGrantStart ( ) ;
5964 }
6065 catch ( Exception e )
6166 {
6267 // Manage storage permission
6368 Android . Net . Uri uri = Android . Net . Uri . Parse ( "package:com.ComputerElite.questappversionswitcher" ) ;
6469 Intent i = new Intent ( Settings . ActionManageAppAllFilesAccessPermission , uri ) ;
65- AndroidCore . context . StartActivity ( i ) ;
70+ launcher . Launch ( i ) ;
6671 }
6772 }
73+ }
74+
75+ public static void AfterPermissionGrantStart ( )
76+ {
6877
6978
7079 //Set webbrowser settings
@@ -105,4 +114,12 @@ public async void Start()
105114 qAVSWebserver . Start ( ) ;
106115 }
107116 }
117+
118+ public class ManageStoragePermissionCallback : Java . Lang . Object , IActivityResultCallback
119+ {
120+ public void OnActivityResult ( Java . Lang . Object result )
121+ {
122+ CoreService . AfterPermissionGrantStart ( ) ;
123+ }
124+ }
108125}
0 commit comments