mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-26 03:03:45 +01:00 
			
		
		
		
	Attempt to workaround export bug (#385)
This commit is contained in:
		| @@ -848,12 +848,6 @@ class AppsProvider with ChangeNotifier { | ||||
|   } | ||||
|  | ||||
|   Future<String> exportApps() async { | ||||
|     Directory? exportDir = Directory('/storage/emulated/0/Download'); | ||||
|     String path = 'Downloads'; // TODO: See if hardcoding this can be avoided | ||||
|     if (!exportDir.existsSync()) { | ||||
|       exportDir = await getExternalStorageDirectory(); | ||||
|       path = exportDir!.path; | ||||
|     } | ||||
|     if ((await DeviceInfoPlugin().androidInfo).version.sdkInt <= 29) { | ||||
|       if (await Permission.storage.isDenied) { | ||||
|         await Permission.storage.request(); | ||||
| @@ -862,6 +856,18 @@ class AppsProvider with ChangeNotifier { | ||||
|         throw ObtainiumError(tr('storagePermissionDenied')); | ||||
|       } | ||||
|     } | ||||
|     Directory? exportDir = Directory('/storage/emulated/0/Download'); | ||||
|     String path = 'Downloads'; // TODO: See if hardcoding this can be avoided | ||||
|     var downloadsAccessible = false; | ||||
|     try { | ||||
|       downloadsAccessible = exportDir.existsSync(); | ||||
|     } catch (e) { | ||||
|       logs.add('Error accessing Downloads (will use fallback): $e'); | ||||
|     } | ||||
|     if (!downloadsAccessible) { | ||||
|       exportDir = await getExternalStorageDirectory(); | ||||
|       path = exportDir!.path; | ||||
|     } | ||||
|     File export = File( | ||||
|         '${exportDir.path}/${tr('obtainiumExportHyphenatedLowercase')}-${DateTime.now().millisecondsSinceEpoch}.json'); | ||||
|     export.writeAsStringSync( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user