mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
fix: Improve root installations management to fix patching of already patched apps
This commit is contained in:
@ -28,13 +28,21 @@ class MainActivity : FlutterActivity() {
|
||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine)
|
||||
val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL)
|
||||
installerChannel =
|
||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
|
||||
installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
|
||||
mainChannel.setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"copyOriginalApk" -> {
|
||||
val originalFilePath = call.argument<String>("originalFilePath")
|
||||
val backupFilePath = call.argument<String>("backupFilePath")
|
||||
if (originalFilePath != null && backupFilePath != null) {
|
||||
File(originalFilePath).copyTo(File(backupFilePath), true)
|
||||
result.success(null)
|
||||
} else {
|
||||
result.notImplemented()
|
||||
}
|
||||
}
|
||||
"runPatcher" -> {
|
||||
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")
|
||||
val originalFilePath = call.argument<String>("originalFilePath")
|
||||
val inputFilePath = call.argument<String>("inputFilePath")
|
||||
val patchedFilePath = call.argument<String>("patchedFilePath")
|
||||
val outFilePath = call.argument<String>("outFilePath")
|
||||
@ -45,7 +53,6 @@ class MainActivity : FlutterActivity() {
|
||||
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
||||
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
||||
if (patchBundleFilePath != null &&
|
||||
originalFilePath != null &&
|
||||
inputFilePath != null &&
|
||||
patchedFilePath != null &&
|
||||
outFilePath != null &&
|
||||
@ -59,7 +66,6 @@ class MainActivity : FlutterActivity() {
|
||||
runPatcher(
|
||||
result,
|
||||
patchBundleFilePath,
|
||||
originalFilePath,
|
||||
inputFilePath,
|
||||
patchedFilePath,
|
||||
outFilePath,
|
||||
@ -82,7 +88,6 @@ class MainActivity : FlutterActivity() {
|
||||
fun runPatcher(
|
||||
result: MethodChannel.Result,
|
||||
patchBundleFilePath: String,
|
||||
originalFilePath: String,
|
||||
inputFilePath: String,
|
||||
patchedFilePath: String,
|
||||
outFilePath: String,
|
||||
@ -93,7 +98,6 @@ class MainActivity : FlutterActivity() {
|
||||
resourcePatching: Boolean,
|
||||
keyStoreFilePath: String
|
||||
) {
|
||||
val originalFile = File(originalFilePath)
|
||||
val inputFile = File(inputFilePath)
|
||||
val patchedFile = File(patchedFilePath)
|
||||
val outFile = File(outFilePath)
|
||||
@ -115,25 +119,13 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
Thread(
|
||||
Runnable {
|
||||
handler.post {
|
||||
installerChannel.invokeMethod(
|
||||
"update",
|
||||
mapOf(
|
||||
"progress" to 0.1,
|
||||
"header" to "",
|
||||
"log" to "Copying original apk"
|
||||
)
|
||||
)
|
||||
}
|
||||
originalFile.copyTo(inputFile, true)
|
||||
|
||||
handler.post {
|
||||
installerChannel.invokeMethod(
|
||||
"update",
|
||||
mapOf(
|
||||
"progress" to 0.2,
|
||||
"header" to "Unpacking apk...",
|
||||
"log" to "Unpacking copied apk"
|
||||
"log" to "Unpacking input apk"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user