diff --git a/android/app/src/main/kotlin/app/revanced/manager/MainActivity.kt b/android/app/src/main/kotlin/app/revanced/manager/MainActivity.kt index 334c5954..971836df 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/MainActivity.kt +++ b/android/app/src/main/kotlin/app/revanced/manager/MainActivity.kt @@ -68,8 +68,9 @@ class MainActivity : FlutterActivity() { "createPatcher" -> { val inputFilePath = call.argument("inputFilePath") val cacheDirPath = call.argument("cacheDirPath") - if (inputFilePath != null && cacheDirPath != null) { - result.success(createPatcher(inputFilePath, cacheDirPath)) + val resourcePatching = call.argument("resourcePatching") + if (inputFilePath != null && cacheDirPath != null && resourcePatching != null) { + result.success(createPatcher(inputFilePath, cacheDirPath, resourcePatching)) } else { result.notImplemented() } @@ -178,10 +179,10 @@ class MainActivity : FlutterActivity() { return true } - fun createPatcher(inputFilePath: String, cacheDirPath: String): Boolean { + fun createPatcher(inputFilePath: String, cacheDirPath: String, resourcePatching: Boolean): Boolean { val inputFile = File(inputFilePath) val aaptPath = Aapt.binary(applicationContext).absolutePath - patcher = Patcher(PatcherOptions(inputFile, cacheDirPath, true, aaptPath, cacheDirPath)) + patcher = Patcher(PatcherOptions(inputFile, cacheDirPath, resourcePatching, aaptPath, cacheDirPath)) return true } diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index 96925e7a..159ed8cd 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -178,7 +178,7 @@ class PatcherAPI { return false; } - Future createPatcher() async { + Future createPatcher(bool resourcePatching) async { if (_inputFile != null && _cacheDir != null) { try { return await platform.invokeMethod( @@ -186,6 +186,7 @@ class PatcherAPI { { 'inputFilePath': _inputFile!.path, 'cacheDirPath': _cacheDir!.path, + 'resourcePatching': resourcePatching, }, ); } on Exception { diff --git a/lib/ui/views/installer/installer_viewmodel.dart b/lib/ui/views/installer/installer_viewmodel.dart index 34507825..eacf67af 100644 --- a/lib/ui/views/installer/installer_viewmodel.dart +++ b/lib/ui/views/installer/installer_viewmodel.dart @@ -55,7 +55,15 @@ class InstallerViewModel extends BaseViewModel { addLog('Done'); updateProgress(0.2); addLog('Creating patcher...'); - isSuccess = await locator().createPatcher(); + bool resourcePatching = false; + if (selectedApp.packageName == 'com.google.android.youtube' || + selectedApp.packageName == + 'com.google.android.apps.youtube.music') { + resourcePatching = true; + } + isSuccess = await locator().createPatcher( + resourcePatching, + ); if (isSuccess != null && isSuccess) { if (selectedApp.packageName == 'com.google.android.youtube') { addLog('Done');