Cleanup const
This commit is contained in:
parent
0d03833cff
commit
5aafc78847
@ -1,19 +1,12 @@
|
|||||||
package com.topjohnwu.magisk
|
package com.topjohnwu.magisk
|
||||||
|
|
||||||
import android.os.Environment
|
|
||||||
import android.os.Process
|
import android.os.Process
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object Const {
|
object Const {
|
||||||
|
|
||||||
const val DEBUG_TAG = "MagiskManager"
|
|
||||||
|
|
||||||
// Paths
|
// Paths
|
||||||
const val MAGISK_PATH = "/sbin/.magisk/img"
|
const val MAGISK_PATH = "/sbin/.magisk/img"
|
||||||
@JvmField
|
|
||||||
val EXTERNAL_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)!!
|
|
||||||
@JvmField
|
|
||||||
var MAGISK_DISABLE_FILE = File("xxx")
|
var MAGISK_DISABLE_FILE = File("xxx")
|
||||||
const val TMP_FOLDER_PATH = "/dev/tmp"
|
const val TMP_FOLDER_PATH = "/dev/tmp"
|
||||||
const val MAGISK_LOG = "/cache/magisk.log"
|
const val MAGISK_LOG = "/cache/magisk.log"
|
||||||
@ -27,13 +20,8 @@ object Const {
|
|||||||
const val ANDROID_MANIFEST = "AndroidManifest.xml"
|
const val ANDROID_MANIFEST = "AndroidManifest.xml"
|
||||||
const val MAGISK_INSTALL_LOG_FILENAME = "magisk_install_log_%s.log"
|
const val MAGISK_INSTALL_LOG_FILENAME = "magisk_install_log_%s.log"
|
||||||
const val MANAGER_CONFIGS = ".tmp.magisk.config"
|
const val MANAGER_CONFIGS = ".tmp.magisk.config"
|
||||||
@JvmField
|
|
||||||
val USER_ID = Process.myUid() / 100000
|
val USER_ID = Process.myUid() / 100000
|
||||||
|
|
||||||
init {
|
|
||||||
EXTERNAL_PATH.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
object MagiskVersion {
|
object MagiskVersion {
|
||||||
const val MIN_SUPPORT = 18000
|
const val MIN_SUPPORT = 18000
|
||||||
}
|
}
|
||||||
@ -59,14 +47,9 @@ object Const {
|
|||||||
const val TWITTER_URL = "https://twitter.com/topjohnwu"
|
const val TWITTER_URL = "https://twitter.com/topjohnwu"
|
||||||
const val XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382"
|
const val XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382"
|
||||||
const val SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk"
|
const val SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk"
|
||||||
@JvmField
|
|
||||||
val BOOTCTL_URL = getRaw("9c5dfc1b8245c0b5b524901ef0ff0f8335757b77", "bootctl")
|
|
||||||
|
|
||||||
const val GITHUB_RAW_URL = "https://raw.githubusercontent.com/"
|
const val GITHUB_RAW_URL = "https://raw.githubusercontent.com/"
|
||||||
const val GITHUB_API_URL = "https://api.github.com/users/Magisk-Modules-Repo/"
|
const val GITHUB_API_URL = "https://api.github.com/users/Magisk-Modules-Repo/"
|
||||||
|
|
||||||
private fun getRaw(where: String, name: String) =
|
|
||||||
"${GITHUB_RAW_URL}topjohnwu/magisk_files/$where/$name"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object Key {
|
object Key {
|
||||||
@ -92,5 +75,4 @@ object Const {
|
|||||||
const val UNINSTALL = "uninstall"
|
const val UNINSTALL = "uninstall"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import com.skoumal.teanity.util.DiffObservableList
|
|||||||
import com.skoumal.teanity.util.KObservableField
|
import com.skoumal.teanity.util.KObservableField
|
||||||
import com.skoumal.teanity.viewevents.SnackbarEvent
|
import com.skoumal.teanity.viewevents.SnackbarEvent
|
||||||
import com.topjohnwu.magisk.BR
|
import com.topjohnwu.magisk.BR
|
||||||
|
import com.topjohnwu.magisk.Config
|
||||||
import com.topjohnwu.magisk.Const
|
import com.topjohnwu.magisk.Const
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
import com.topjohnwu.magisk.extensions.*
|
import com.topjohnwu.magisk.extensions.*
|
||||||
@ -90,7 +91,7 @@ class FlashViewModel(
|
|||||||
.map { now }
|
.map { now }
|
||||||
.map { it.toTime(timeFormatStandard) }
|
.map { it.toTime(timeFormatStandard) }
|
||||||
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
||||||
.map { File(Const.EXTERNAL_PATH, it) }
|
.map { File(Config.downloadDirectory, it) }
|
||||||
.map { file ->
|
.map { file ->
|
||||||
file.bufferedWriter().use { writer ->
|
file.bufferedWriter().use { writer ->
|
||||||
logItems.forEach {
|
logItems.forEach {
|
||||||
|
Loading…
Reference in New Issue
Block a user