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 = {
|
Scaffold(floatingActionButton = {
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
enabled = hasAppSelected && viewModel.anyPatchSelected(),
|
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") },
|
icon = { Icon(Icons.Default.Build, contentDescription = "Patch") },
|
||||||
text = { Text(text = "Patch") }
|
text = { Text(text = "Patch") }
|
||||||
)
|
)
|
||||||
@ -50,7 +50,7 @@ fun PatcherScreen(
|
|||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
) {
|
) {
|
||||||
if (showDialog)
|
if (showDialog)
|
||||||
SplitAPKDialog(onDismiss = { showDialog = false }, onConfirm = onClickPatch)
|
SplitAPKDialog(onDismiss = { showDialog = false }, onConfirm = onClickPatch) // TODO: replace this with something better
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
|
@ -84,16 +84,16 @@ class PatcherScreenViewModel(private val app: Application, private val api: API)
|
|||||||
try {
|
try {
|
||||||
val file = api.downloadPatchBundle(app.filesDir)
|
val file = api.downloadPatchBundle(app.filesDir)
|
||||||
patchBundleFile = file.absolutePath
|
patchBundleFile = file.absolutePath
|
||||||
loadPatches0(file.absolutePath)
|
loadPatches0()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("ReVancedManager", "An error occurred while loading patches", e)
|
Log.e("ReVancedManager", "An error occurred while loading patches", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadPatches0(path: String) {
|
fun loadPatches0() {
|
||||||
val patchClasses = PatchBundle.Dex(
|
val patchClasses = PatchBundle.Dex(
|
||||||
path, DexClassLoader(
|
patchBundleFile, DexClassLoader(
|
||||||
path,
|
patchBundleFile,
|
||||||
app.codeCacheDir.absolutePath,
|
app.codeCacheDir.absolutePath,
|
||||||
null,
|
null,
|
||||||
javaClass.classLoader
|
javaClass.classLoader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user