From 6d6054162634f4a8ec6838cc40909a3e58df80fb Mon Sep 17 00:00:00 2001 From: Ushie Date: Fri, 3 Mar 2023 03:11:44 +0300 Subject: [PATCH] chore(deps): meet patcher breaking changes --- .../revanced/manager/flutter/MainActivity.kt | 24 ++++++---------- lib/services/patcher_api.dart | 28 ++----------------- 2 files changed, 11 insertions(+), 41 deletions(-) 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 3611bf42..352174a8 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 @@ -43,7 +43,6 @@ class MainActivity : FlutterActivity() { val integrationsPath = call.argument("integrationsPath") val selectedPatches = call.argument>("selectedPatches") val cacheDirPath = call.argument("cacheDirPath") - val mergeIntegrations = call.argument("mergeIntegrations") val keyStoreFilePath = call.argument("keyStoreFilePath") if (patchBundleFilePath != null && originalFilePath != null && @@ -53,7 +52,6 @@ class MainActivity : FlutterActivity() { integrationsPath != null && selectedPatches != null && cacheDirPath != null && - mergeIntegrations != null && keyStoreFilePath != null ) { runPatcher( @@ -66,7 +64,6 @@ class MainActivity : FlutterActivity() { integrationsPath, selectedPatches, cacheDirPath, - mergeIntegrations, keyStoreFilePath ) } else { @@ -88,7 +85,6 @@ class MainActivity : FlutterActivity() { integrationsPath: String, selectedPatches: List, cacheDirPath: String, - mergeIntegrations: Boolean, keyStoreFilePath: String ) { val originalFile = File(originalFilePath) @@ -139,19 +135,17 @@ class MainActivity : FlutterActivity() { mapOf("progress" to 0.3, "header" to "", "log" to "") ) } - if (mergeIntegrations) { - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.4, - "header" to "Merging integrations...", - "log" to "Merging integrations" - ) + handler.post { + installerChannel.invokeMethod( + "update", + mapOf( + "progress" to 0.4, + "header" to "Merging integrations...", + "log" to "Merging integrations" ) - } - patcher.addIntegrations(listOf(integrations)) {} + ) } + patcher.addIntegrations(listOf(integrations)) {} handler.post { installerChannel.invokeMethod( diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index 17bd1808..7e208b4d 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -122,25 +122,6 @@ class PatcherAPI { .toList(); } - bool dependencyNeedsIntegrations(String name) { - return name.contains('integrations') || - _patches.any( - (patch) => - patch.name == name && - (patch.dependencies.any( - (dep) => dependencyNeedsIntegrations(dep), - )), - ); - } - - Future needsIntegrations(List selectedPatches) async { - return selectedPatches.any( - (patch) => patch.dependencies.any( - (dep) => dependencyNeedsIntegrations(dep), - ), - ); - } - Future needsResourcePatching(List selectedPatches) async { return selectedPatches.any( (patch) => patch.dependencies.any( @@ -181,7 +162,6 @@ class PatcherAPI { String originalFilePath, List selectedPatches, ) async { - final bool mergeIntegrations = await needsIntegrations(selectedPatches); final bool includeSettings = await needsSettingsPatch(selectedPatches); if (includeSettings) { try { @@ -199,10 +179,7 @@ class PatcherAPI { } } final File? patchBundleFile = await _managerAPI.downloadPatches(); - File? integrationsFile; - if (mergeIntegrations) { - integrationsFile = await _managerAPI.downloadIntegrations(); - } + final File? integrationsFile = await _managerAPI.downloadIntegrations(); if (patchBundleFile != null) { _dataDir.createSync(); _tmpDir.createSync(); @@ -224,10 +201,9 @@ class PatcherAPI { 'inputFilePath': inputFile.path, 'patchedFilePath': patchedFile.path, 'outFilePath': _outFile!.path, - 'integrationsPath': mergeIntegrations ? integrationsFile!.path : '', + 'integrationsPath': integrationsFile!.path, 'selectedPatches': selectedPatches.map((p) => p.name).toList(), 'cacheDirPath': cacheDir.path, - 'mergeIntegrations': mergeIntegrations, 'keyStoreFilePath': _keyStoreFile.path, }, );