mirror of
https://github.com/revanced/revanced-manager-compose-old.git
synced 2025-05-03 16:04:25 +02:00
fix: patching errors when patching again
This commit is contained in:
parent
9ead261da4
commit
9a9f0fbf35
@ -38,7 +38,7 @@ fun PatcherScreen(
|
||||
Scaffold(floatingActionButton = {
|
||||
FloatingActionButton(
|
||||
enabled = hasAppSelected && viewModel.anyPatchSelected(),
|
||||
onClick = { if (viewModel.checkSplitApk()) { showDialog = true } else onClickPatch()},
|
||||
onClick = { if (viewModel.checkSplitApk()) { showDialog = true } else {onClickPatch(); viewModel.loadPatches0()}},
|
||||
icon = { Icon(Icons.Default.Build, contentDescription = "Patch") },
|
||||
text = { Text(text = "Patch") }
|
||||
)
|
||||
@ -50,7 +50,7 @@ fun PatcherScreen(
|
||||
.padding(16.dp),
|
||||
) {
|
||||
if (showDialog)
|
||||
SplitAPKDialog(onDismiss = { showDialog = false }, onConfirm = onClickPatch)
|
||||
SplitAPKDialog(onDismiss = { showDialog = false }, onConfirm = onClickPatch) // TODO: replace this with something better
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.padding(4.dp)
|
||||
|
@ -84,16 +84,16 @@ class PatcherScreenViewModel(private val app: Application, private val api: API)
|
||||
try {
|
||||
val file = api.downloadPatchBundle(app.filesDir)
|
||||
patchBundleFile = file.absolutePath
|
||||
loadPatches0(file.absolutePath)
|
||||
loadPatches0()
|
||||
} catch (e: Exception) {
|
||||
Log.e("ReVancedManager", "An error occurred while loading patches", e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadPatches0(path: String) {
|
||||
fun loadPatches0() {
|
||||
val patchClasses = PatchBundle.Dex(
|
||||
path, DexClassLoader(
|
||||
path,
|
||||
patchBundleFile, DexClassLoader(
|
||||
patchBundleFile,
|
||||
app.codeCacheDir.absolutePath,
|
||||
null,
|
||||
javaClass.classLoader
|
||||
|
Loading…
x
Reference in New Issue
Block a user