fix: permanent keystore path if available (#375)

This commit is contained in:
aliernfrog 2022-10-09 21:35:43 +03:00 committed by GitHub
parent f2b03b6e69
commit e46ad3595d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ class PatcherAPI {
MethodChannel('app.revanced.manager.flutter/patcher'); MethodChannel('app.revanced.manager.flutter/patcher');
final ManagerAPI _managerAPI = locator<ManagerAPI>(); final ManagerAPI _managerAPI = locator<ManagerAPI>();
final RootAPI _rootAPI = RootAPI(); final RootAPI _rootAPI = RootAPI();
late Directory _dataDir;
late Directory _tmpDir; late Directory _tmpDir;
late File _keyStoreFile; late File _keyStoreFile;
List<Patch> _patches = []; List<Patch> _patches = [];
@ -26,8 +27,9 @@ class PatcherAPI {
Future<void> initialize() async { Future<void> initialize() async {
await _loadPatches(); await _loadPatches();
Directory appCache = await getTemporaryDirectory(); Directory appCache = await getTemporaryDirectory();
_dataDir = await getExternalStorageDirectory() ?? appCache;
_tmpDir = Directory('${appCache.path}/patcher'); _tmpDir = Directory('${appCache.path}/patcher');
_keyStoreFile = File('${appCache.path}/revanced-manager.keystore'); _keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore');
cleanPatcher(); cleanPatcher();
} }
@ -163,6 +165,7 @@ class PatcherAPI {
integrationsFile = await _managerAPI.downloadIntegrations(); integrationsFile = await _managerAPI.downloadIntegrations();
} }
if (patchBundleFile != null) { if (patchBundleFile != null) {
_dataDir.createSync();
_tmpDir.createSync(); _tmpDir.createSync();
Directory workDir = _tmpDir.createTempSync('tmp-'); Directory workDir = _tmpDir.createTempSync('tmp-');
File inputFile = File('${workDir.path}/base.apk'); File inputFile = File('${workDir.path}/base.apk');