From 0bfa776ce7402074618516435a750898ab318b7b Mon Sep 17 00:00:00 2001 From: Ushie Date: Sat, 23 Sep 2023 00:24:17 +0300 Subject: [PATCH 1/2] fix: npe when loading patch bundle on android 8 --- .../kotlin/app/revanced/manager/flutter/MainActivity.kt | 5 ++++- lib/services/manager_api.dart | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt b/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt index ef7a2a65ca..22463f8c19 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt +++ b/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt @@ -94,9 +94,12 @@ class MainActivity : FlutterActivity() { "getPatches" -> { val patchBundleFilePath = call.argument("patchBundleFilePath") + val cacheDirPath = call.argument("cacheDirPath") + if (patchBundleFilePath != null) { val patches = PatchBundleLoader.Dex( - File(patchBundleFilePath) + File(patchBundleFilePath), + optimizedDexDirectory = File(cacheDirPath) ).map { patch -> val map = HashMap() map["\"name\""] = "\"${patch.patchName.replace("\"","\\\"")}\"" diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index af996fe2fe..3401432bdd 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -306,12 +306,20 @@ class ManagerAPI { return patches; } final File? patchBundleFile = await downloadPatches(); + final Directory appCache = await getTemporaryDirectory(); + Directory('${appCache.path}/cache').createSync(); + final Directory workDir = + Directory('${appCache.path}/cache').createTempSync('tmp-'); + final Directory cacheDir = Directory('${workDir.path}/cache'); + cacheDir.createSync(); + if (patchBundleFile != null) { try { final patchesObject = await PatcherAPI.patcherChannel.invokeMethod( 'getPatches', { 'patchBundleFilePath': patchBundleFile.path, + 'cacheDirPath': cacheDir.path, }, ); final List> patchesMap = []; From 0983ba8a0f5700122c93f8cd1015c6b6295a3b43 Mon Sep 17 00:00:00 2001 From: Benjamin <73490201+BenjaminHalko@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:51:25 -0700 Subject: [PATCH 2/2] fix: search bar overflow (#1301) --- lib/ui/views/app_selector/app_selector_view.dart | 2 +- lib/ui/views/patches_selector/patches_selector_view.dart | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart index 7877a226fa..26eae3204e 100644 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ b/lib/ui/views/app_selector/app_selector_view.dart @@ -54,7 +54,7 @@ class _AppSelectorViewState extends State { onPressed: () => Navigator.of(context).pop(), ), bottom: PreferredSize( - preferredSize: const Size.fromHeight(64.0), + preferredSize: const Size.fromHeight(66.0), child: Padding( padding: const EdgeInsets.symmetric( vertical: 8.0, diff --git a/lib/ui/views/patches_selector/patches_selector_view.dart b/lib/ui/views/patches_selector/patches_selector_view.dart index 2ad050d048..26766f4e4c 100644 --- a/lib/ui/views/patches_selector/patches_selector_view.dart +++ b/lib/ui/views/patches_selector/patches_selector_view.dart @@ -81,7 +81,7 @@ class _PatchesSelectorViewState extends State { child: Container( margin: const EdgeInsets.only(top: 12, bottom: 12), padding: - const EdgeInsets.symmetric(horizontal: 6, vertical: 6), + const EdgeInsets.symmetric(horizontal: 6, vertical: 6), decoration: BoxDecoration( color: Theme.of(context) .colorScheme @@ -99,7 +99,7 @@ class _PatchesSelectorViewState extends State { ), CustomPopupMenu( onSelected: (value) => - {model.onMenuSelection(value, context)}, + {model.onMenuSelection(value, context)}, children: { 0: I18nText( 'patchesSelectorView.loadPatchesSelection', @@ -114,7 +114,7 @@ class _PatchesSelectorViewState extends State { ), ], bottom: PreferredSize( - preferredSize: const Size.fromHeight(64.0), + preferredSize: const Size.fromHeight(66.0), child: Padding( padding: const EdgeInsets.symmetric( vertical: 8.0,