mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-11-19 01:59:25 +01:00
feat: support for --install
This commit is contained in:
parent
cf1d512f4b
commit
d1ceab45c8
@ -2,11 +2,12 @@ package app.revanced.utils.adb
|
||||
|
||||
import se.vidstige.jadb.JadbConnection
|
||||
import se.vidstige.jadb.JadbDevice
|
||||
import se.vidstige.jadb.managers.PackageManager
|
||||
import java.io.File
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
internal class Adb(
|
||||
private val apk: File,
|
||||
private val file: File,
|
||||
private val packageName: String,
|
||||
deviceName: String,
|
||||
private val install: Boolean = false,
|
||||
@ -27,13 +28,11 @@ internal class Adb(
|
||||
}
|
||||
|
||||
internal fun deploy() {
|
||||
|
||||
if (install) {
|
||||
TODO("support installing the apk")
|
||||
device.run(Constants.COMMAND_INSTALL_APK.replacePlaceholder("\"$apk\""))
|
||||
PackageManager(device).install(file)
|
||||
} else {
|
||||
// push patched file
|
||||
device.copy(Constants.PATH_INIT_PUSH, apk)
|
||||
device.copy(Constants.PATH_INIT_PUSH, file)
|
||||
|
||||
// create revanced path
|
||||
device.run("${Constants.COMMAND_CREATE_DIR} ${Constants.PATH_REVANCED}")
|
||||
@ -61,13 +60,13 @@ internal class Adb(
|
||||
device.run(Constants.PATH_UMOUNT.replacePlaceholder())
|
||||
// mount the apk
|
||||
device.run(Constants.PATH_MOUNT.replacePlaceholder())
|
||||
|
||||
// relaunch app
|
||||
device.run(Constants.COMMAND_RESTART.replacePlaceholder())
|
||||
|
||||
// log the app
|
||||
log()
|
||||
}
|
||||
|
||||
// relaunch app
|
||||
device.run(Constants.COMMAND_RESTART.replacePlaceholder())
|
||||
|
||||
// log the app
|
||||
log()
|
||||
}
|
||||
|
||||
private fun log() {
|
||||
|
@ -15,7 +15,7 @@ internal object Constants {
|
||||
private const val NAME_MOUNT_SCRIPT = "mount_revanced_$PLACEHOLDER.sh"
|
||||
|
||||
// initial directory to push files to via adb push
|
||||
internal const val PATH_INIT_PUSH = "/sdcard/revanced.delete"
|
||||
internal const val PATH_INIT_PUSH = "/data/local/tmp/revanced.delete"
|
||||
|
||||
// revanced path
|
||||
internal const val PATH_REVANCED = "/data/adb/revanced/"
|
||||
@ -37,9 +37,6 @@ internal object Constants {
|
||||
// install umount script & set permissions
|
||||
internal const val COMMAND_INSTALL_UMOUNT = "mv $PATH_INIT_PUSH $PATH_UMOUNT && $COMMAND_CHMOD_MOUNT $PATH_UMOUNT"
|
||||
|
||||
// install apk & cleanup
|
||||
internal const val COMMAND_INSTALL_APK = "install $PLACEHOLDER"
|
||||
|
||||
// unmount script
|
||||
internal val CONTENT_UMOUNT_SCRIPT =
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user