fix: dynamic LSPatch output resolution, local GoonXposed support, and namespace fix
Some checks failed
Build Debug App / build (push) Failing after 7m13s

This commit is contained in:
Rosie Val 2026-09-19 19:02:27 -04:00
parent 2cc79c59d0
commit 16f2fbe3f5
3 changed files with 34 additions and 6 deletions

View file

@ -19,7 +19,7 @@ val gitHasLocalCommits = gitCurrentBranch?.let { providers.execIgnoreCode("git",
val gitHasHasLocalChanges = providers.execIgnoreCode("git", "status", "-s").isNotEmpty()
android {
namespace = "dev.shiggy.manager"
namespace = "dev.goon.manager"
compileSdk = 37
defaultConfig {

View file

@ -9,6 +9,8 @@ import com.aliucord.manager.patcher.steps.base.DownloadStep
import dev.goon.manager.R
import org.koin.core.component.inject
import com.aliucord.manager.patcher.steps.base.StepState
class DownloadShiggyXposedStep : DownloadStep() {
private val paths: PathManager by inject()
private val shiggyGithubService: ShiggyGithubService by inject()
@ -21,6 +23,21 @@ class DownloadShiggyXposedStep : DownloadStep() {
private set
override suspend fun execute(container: StepRunner) {
val localXposed = listOf(
paths.shiggyDir.resolve("GoonXposed.apk"),
paths.shiggyDir.resolve("wt-xposed.apk")
).firstOrNull { it.exists() }
if (localXposed != null) {
container.log("Found local GoonXposed at ${localXposed.absolutePath}")
targetVersion = SemVer(99, 0, 0)
targetFile.parentFile?.mkdirs()
localXposed.copyTo(targetFile, overwrite = true)
state = StepState.Skipped
container.log("Using local GoonXposed instead of remote download")
return
}
val latestRelease = shiggyGithubService.getLatestXposedRelease().getOrThrow()
container.log("Latest GoonXposed release is ${latestRelease.name}")

View file

@ -15,9 +15,9 @@ import org.lsposed.patch.util.Logger
import java.io.File
import java.util.*
class InjectGoonXposedStep : Step() {
class InjectShiggyXposedStep : Step() {
override val group: StepGroup = StepGroup.Install
override val localizedName: Int = R.string.patch_step_inject_goon
override val localizedName: Int = R.string.patch_step_inject_shiggy
suspend fun patch(
container: StepRunner,
@ -92,14 +92,25 @@ class InjectGoonXposedStep : Step() {
baseName,
LSPConfig.instance.VERSION_CODE
)
val patchedApk = File(tempDir, patchedApkName)
var patchedApk = File(tempDir, patchedApkName)
if (!patchedApk.exists()) {
val found = tempDir.listFiles()?.firstOrNull {
it.extension.equals("apk", ignoreCase = true) && (it.name.contains(baseName) || it.name.contains("lspatched"))
} ?: tempDir.listFiles()?.firstOrNull { it.extension.equals("apk", ignoreCase = true) }
if (found != null) {
patchedApk = found
}
}
if (patchedApk.exists()) {
patchedApk.copyTo(originalApk, overwrite = true)
container.log("Replaced ${originalApk.name} with ${patchedApk.name}")
} else {
container.log("Warning: Could not find patched APK for ${originalApk.name}")
container.log("Expected patched APK at: ${patchedApk.absolutePath}")
val availableFiles = tempDir.listFiles()?.map { it.name }?.joinToString(", ") ?: "none"
val errorMsg = "Could not find patched APK for ${originalApk.name} in ${tempDir.absolutePath} (Found files: $availableFiles)"
container.log("Error: $errorMsg")
throw IllegalStateException(errorMsg)
}
}