From 5aafc788472a68f21d70cd892d0b61e7694f6966 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 11 Aug 2019 23:53:43 -0700 Subject: [PATCH] Cleanup const --- .../main/java/com/topjohnwu/magisk/Const.kt | 18 ------------------ .../magisk/ui/flash/FlashViewModel.kt | 3 ++- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/Const.kt b/app/src/main/java/com/topjohnwu/magisk/Const.kt index 344bca741..60ae1284e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/Const.kt +++ b/app/src/main/java/com/topjohnwu/magisk/Const.kt @@ -1,19 +1,12 @@ package com.topjohnwu.magisk -import android.os.Environment import android.os.Process - import java.io.File object Const { - const val DEBUG_TAG = "MagiskManager" - // Paths const val MAGISK_PATH = "/sbin/.magisk/img" - @JvmField - val EXTERNAL_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)!! - @JvmField var MAGISK_DISABLE_FILE = File("xxx") const val TMP_FOLDER_PATH = "/dev/tmp" const val MAGISK_LOG = "/cache/magisk.log" @@ -27,13 +20,8 @@ object Const { const val ANDROID_MANIFEST = "AndroidManifest.xml" const val MAGISK_INSTALL_LOG_FILENAME = "magisk_install_log_%s.log" const val MANAGER_CONFIGS = ".tmp.magisk.config" - @JvmField val USER_ID = Process.myUid() / 100000 - init { - EXTERNAL_PATH.mkdirs() - } - object MagiskVersion { const val MIN_SUPPORT = 18000 } @@ -59,14 +47,9 @@ object Const { const val TWITTER_URL = "https://twitter.com/topjohnwu" const val XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382" 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_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 { @@ -92,5 +75,4 @@ object Const { const val UNINSTALL = "uninstall" } - } diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt index 46a38f2c7..92fe4210c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt @@ -13,6 +13,7 @@ import com.skoumal.teanity.util.DiffObservableList import com.skoumal.teanity.util.KObservableField import com.skoumal.teanity.viewevents.SnackbarEvent import com.topjohnwu.magisk.BR +import com.topjohnwu.magisk.Config import com.topjohnwu.magisk.Const import com.topjohnwu.magisk.R import com.topjohnwu.magisk.extensions.* @@ -90,7 +91,7 @@ class FlashViewModel( .map { now } .map { it.toTime(timeFormatStandard) } .map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) } - .map { File(Const.EXTERNAL_PATH, it) } + .map { File(Config.downloadDirectory, it) } .map { file -> file.bufferedWriter().use { writer -> logItems.forEach {