feat: add Reset Loader Config in Recovery dialog, show Recovery option in Update Failed dialog
This commit is contained in:
parent
12e35d8d04
commit
614f9ced6f
2 changed files with 33 additions and 14 deletions
|
|
@ -62,22 +62,31 @@ class LogBoxModule : Module() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun showRecoveryAlert(context: Context) {
|
||||
AlertDialog.Builder(context).setTitle("Revenge Recovery Options")
|
||||
.setItems(arrayOf("Reload", "Delete bundle.js")) { _, which ->
|
||||
when (which) {
|
||||
0 -> {
|
||||
reloadApp()
|
||||
}
|
||||
companion object {
|
||||
fun showRecoveryAlert(context: Context) {
|
||||
AlertDialog.Builder(context).setTitle("Revenge Recovery Options")
|
||||
.setItems(arrayOf("Reload", "Delete Script", "Reset Loader Config")) { _, which ->
|
||||
when (which) {
|
||||
0 -> {
|
||||
reloadApp()
|
||||
}
|
||||
|
||||
1 -> {
|
||||
val bundleFile =
|
||||
File(packageParam.appInfo.dataDir, "${Constants.CACHE_DIR}/${Constants.MAIN_SCRIPT_FILE}")
|
||||
if (bundleFile.exists()) bundleFile.delete()
|
||||
1 -> {
|
||||
val bundleFile = File(
|
||||
context.dataDir, "${Constants.CACHE_DIR}/${Constants.MAIN_SCRIPT_FILE}"
|
||||
)
|
||||
|
||||
reloadApp()
|
||||
if (bundleFile.exists()) bundleFile.delete()
|
||||
|
||||
reloadApp()
|
||||
}
|
||||
|
||||
2 -> {
|
||||
UpdaterModule.resetLoaderConfig(context)
|
||||
reloadApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}.show()
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package io.github.revenge.xposed.modules
|
|||
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.util.AtomicFile
|
||||
import android.widget.Toast
|
||||
import androidx.core.util.writeBytes
|
||||
|
|
@ -155,7 +156,16 @@ object UpdaterModule : Module() {
|
|||
downloadScript(activity)
|
||||
Toast.makeText(activity, "Retrying download in background...", Toast.LENGTH_SHORT).show()
|
||||
dialog.dismiss()
|
||||
}.setNeutralButton("Recovery") { dialog, _ ->
|
||||
LogBoxModule.showRecoveryAlert(activity)
|
||||
dialog.dismiss()
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun resetLoaderConfig(context: Context) {
|
||||
val filesDir = File(context.dataDir, Constants.FILES_DIR)
|
||||
val config = File(filesDir, CONFIG_FILE)
|
||||
if (config.exists()) config.delete()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue