mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: handle resource patching hardcoded for now
This commit is contained in:
parent
2cd9f99aa3
commit
31ca694f4e
@ -68,8 +68,9 @@ class MainActivity : FlutterActivity() {
|
|||||||
"createPatcher" -> {
|
"createPatcher" -> {
|
||||||
val inputFilePath = call.argument<String>("inputFilePath")
|
val inputFilePath = call.argument<String>("inputFilePath")
|
||||||
val cacheDirPath = call.argument<String>("cacheDirPath")
|
val cacheDirPath = call.argument<String>("cacheDirPath")
|
||||||
if (inputFilePath != null && cacheDirPath != null) {
|
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
||||||
result.success(createPatcher(inputFilePath, cacheDirPath))
|
if (inputFilePath != null && cacheDirPath != null && resourcePatching != null) {
|
||||||
|
result.success(createPatcher(inputFilePath, cacheDirPath, resourcePatching))
|
||||||
} else {
|
} else {
|
||||||
result.notImplemented()
|
result.notImplemented()
|
||||||
}
|
}
|
||||||
@ -178,10 +179,10 @@ class MainActivity : FlutterActivity() {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createPatcher(inputFilePath: String, cacheDirPath: String): Boolean {
|
fun createPatcher(inputFilePath: String, cacheDirPath: String, resourcePatching: Boolean): Boolean {
|
||||||
val inputFile = File(inputFilePath)
|
val inputFile = File(inputFilePath)
|
||||||
val aaptPath = Aapt.binary(applicationContext).absolutePath
|
val aaptPath = Aapt.binary(applicationContext).absolutePath
|
||||||
patcher = Patcher(PatcherOptions(inputFile, cacheDirPath, true, aaptPath, cacheDirPath))
|
patcher = Patcher(PatcherOptions(inputFile, cacheDirPath, resourcePatching, aaptPath, cacheDirPath))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class PatcherAPI {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> createPatcher() async {
|
Future<bool?> createPatcher(bool resourcePatching) async {
|
||||||
if (_inputFile != null && _cacheDir != null) {
|
if (_inputFile != null && _cacheDir != null) {
|
||||||
try {
|
try {
|
||||||
return await platform.invokeMethod<bool>(
|
return await platform.invokeMethod<bool>(
|
||||||
@ -186,6 +186,7 @@ class PatcherAPI {
|
|||||||
{
|
{
|
||||||
'inputFilePath': _inputFile!.path,
|
'inputFilePath': _inputFile!.path,
|
||||||
'cacheDirPath': _cacheDir!.path,
|
'cacheDirPath': _cacheDir!.path,
|
||||||
|
'resourcePatching': resourcePatching,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} on Exception {
|
} on Exception {
|
||||||
|
@ -55,7 +55,15 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
addLog('Done');
|
addLog('Done');
|
||||||
updateProgress(0.2);
|
updateProgress(0.2);
|
||||||
addLog('Creating patcher...');
|
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 (isSuccess != null && isSuccess) {
|
||||||
if (selectedApp.packageName == 'com.google.android.youtube') {
|
if (selectedApp.packageName == 'com.google.android.youtube') {
|
||||||
addLog('Done');
|
addLog('Done');
|
||||||
|
Loading…
Reference in New Issue
Block a user