mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 09:07:47 +01:00
fix: handle resource patching hardcoded for now
This commit is contained in:
parent
2cd9f99aa3
commit
31ca694f4e
3 changed files with 16 additions and 6 deletions
|
@ -68,8 +68,9 @@ class MainActivity : FlutterActivity() {
|
|||
"createPatcher" -> {
|
||||
val inputFilePath = call.argument<String>("inputFilePath")
|
||||
val cacheDirPath = call.argument<String>("cacheDirPath")
|
||||
if (inputFilePath != null && cacheDirPath != null) {
|
||||
result.success(createPatcher(inputFilePath, cacheDirPath))
|
||||
val resourcePatching = call.argument<Boolean>("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
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ class PatcherAPI {
|
|||
return false;
|
||||
}
|
||||
|
||||
Future<bool?> createPatcher() async {
|
||||
Future<bool?> createPatcher(bool resourcePatching) async {
|
||||
if (_inputFile != null && _cacheDir != null) {
|
||||
try {
|
||||
return await platform.invokeMethod<bool>(
|
||||
|
@ -186,6 +186,7 @@ class PatcherAPI {
|
|||
{
|
||||
'inputFilePath': _inputFile!.path,
|
||||
'cacheDirPath': _cacheDir!.path,
|
||||
'resourcePatching': resourcePatching,
|
||||
},
|
||||
);
|
||||
} on Exception {
|
||||
|
|
|
@ -55,7 +55,15 @@ class InstallerViewModel extends BaseViewModel {
|
|||
addLog('Done');
|
||||
updateProgress(0.2);
|
||||
addLog('Creating patcher...');
|
||||
isSuccess = await locator<PatcherAPI>().createPatcher();
|
||||
bool resourcePatching = false;
|
||||
if (selectedApp.packageName == 'com.google.android.youtube' ||
|
||||
selectedApp.packageName ==
|
||||
'com.google.android.apps.youtube.music') {
|
||||
resourcePatching = true;
|
||||
}
|
||||
isSuccess = await locator<PatcherAPI>().createPatcher(
|
||||
resourcePatching,
|
||||
);
|
||||
if (isSuccess != null && isSuccess) {
|
||||
if (selectedApp.packageName == 'com.google.android.youtube') {
|
||||
addLog('Done');
|
||||
|
|
Loading…
Reference in a new issue