Proper canary version detection
This commit is contained in:
parent
8453282fa6
commit
1e7e06d1cc
@ -106,7 +106,7 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val defaultChannel =
|
private val defaultChannel =
|
||||||
if (Utils.isCanary) {
|
if (isCanaryVersion) {
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
Value.CANARY_DEBUG_CHANNEL
|
Value.CANARY_DEBUG_CHANNEL
|
||||||
else
|
else
|
||||||
@ -116,24 +116,12 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
var bootId by preference(Key.BOOT_ID, "")
|
var bootId by preference(Key.BOOT_ID, "")
|
||||||
|
|
||||||
var downloadPath by preference(Key.DOWNLOAD_PATH, Environment.DIRECTORY_DOWNLOADS)
|
var downloadPath by preference(Key.DOWNLOAD_PATH, Environment.DIRECTORY_DOWNLOADS)
|
||||||
var repoOrder by preference(
|
var repoOrder by preference(Key.REPO_ORDER, Value.ORDER_DATE)
|
||||||
Key.REPO_ORDER,
|
|
||||||
Value.ORDER_DATE
|
|
||||||
)
|
|
||||||
|
|
||||||
var suDefaultTimeout by preferenceStrInt(Key.SU_REQUEST_TIMEOUT, 10)
|
var suDefaultTimeout by preferenceStrInt(Key.SU_REQUEST_TIMEOUT, 10)
|
||||||
var suAutoReponse by preferenceStrInt(
|
var suAutoReponse by preferenceStrInt(Key.SU_AUTO_RESPONSE, Value.SU_PROMPT)
|
||||||
Key.SU_AUTO_RESPONSE,
|
var suNotification by preferenceStrInt(Key.SU_NOTIFICATION, Value.NOTIFICATION_TOAST)
|
||||||
Value.SU_PROMPT
|
var updateChannel by preferenceStrInt(Key.UPDATE_CHANNEL, defaultChannel)
|
||||||
)
|
|
||||||
var suNotification by preferenceStrInt(
|
|
||||||
Key.SU_NOTIFICATION,
|
|
||||||
Value.NOTIFICATION_TOAST
|
|
||||||
)
|
|
||||||
var updateChannel by preferenceStrInt(
|
|
||||||
Key.UPDATE_CHANNEL,
|
|
||||||
defaultChannel
|
|
||||||
)
|
|
||||||
|
|
||||||
var safetyNotice by preference(Key.SAFETY, true)
|
var safetyNotice by preference(Key.SAFETY, true)
|
||||||
var darkThemeExtended by preference(
|
var darkThemeExtended by preference(
|
||||||
@ -153,25 +141,15 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
var customChannelUrl by preference(Key.CUSTOM_CHANNEL, "")
|
var customChannelUrl by preference(Key.CUSTOM_CHANNEL, "")
|
||||||
var locale by preference(Key.LOCALE, "")
|
var locale by preference(Key.LOCALE, "")
|
||||||
|
|
||||||
var rootMode by dbSettings(
|
var rootMode by dbSettings(Key.ROOT_ACCESS, Value.ROOT_ACCESS_APPS_AND_ADB)
|
||||||
Key.ROOT_ACCESS,
|
var suMntNamespaceMode by dbSettings(Key.SU_MNT_NS, Value.NAMESPACE_MODE_REQUESTER)
|
||||||
Value.ROOT_ACCESS_APPS_AND_ADB
|
var suMultiuserMode by dbSettings(Key.SU_MULTIUSER_MODE, Value.MULTIUSER_MODE_OWNER_ONLY)
|
||||||
)
|
|
||||||
var suMntNamespaceMode by dbSettings(
|
|
||||||
Key.SU_MNT_NS,
|
|
||||||
Value.NAMESPACE_MODE_REQUESTER
|
|
||||||
)
|
|
||||||
var suMultiuserMode by dbSettings(
|
|
||||||
Key.SU_MULTIUSER_MODE,
|
|
||||||
Value.MULTIUSER_MODE_OWNER_ONLY
|
|
||||||
)
|
|
||||||
var suBiometric by dbSettings(Key.SU_BIOMETRIC, false)
|
var suBiometric by dbSettings(Key.SU_BIOMETRIC, false)
|
||||||
var suManager by dbStrings(Key.SU_MANAGER, "", true)
|
var suManager by dbStrings(Key.SU_MANAGER, "", true)
|
||||||
var keyStoreRaw by dbStrings(Key.KEYSTORE, "", true)
|
var keyStoreRaw by dbStrings(Key.KEYSTORE, "", true)
|
||||||
|
|
||||||
// Always return a path in external storage where we can write
|
// Always return a path in external storage where we can write
|
||||||
val downloadDirectory
|
val downloadDirectory get() =
|
||||||
get() =
|
|
||||||
Utils.ensureDownloadPath(downloadPath) ?: get<Context>().getExternalFilesDir(null)!!
|
Utils.ensureDownloadPath(downloadPath) ?: get<Context>().getExternalFilesDir(null)!!
|
||||||
|
|
||||||
private const val SU_FINGERPRINT = "su_fingerprint"
|
private const val SU_FINGERPRINT = "su_fingerprint"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.topjohnwu.magisk.core
|
package com.topjohnwu.magisk.core
|
||||||
|
|
||||||
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
|
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
|
||||||
|
import com.topjohnwu.magisk.BuildConfig
|
||||||
import com.topjohnwu.magisk.DynAPK
|
import com.topjohnwu.magisk.DynAPK
|
||||||
import com.topjohnwu.magisk.core.model.UpdateInfo
|
import com.topjohnwu.magisk.core.model.UpdateInfo
|
||||||
import com.topjohnwu.magisk.extensions.get
|
import com.topjohnwu.magisk.extensions.get
|
||||||
@ -13,6 +14,7 @@ import java.io.FileInputStream
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
val isRunningAsStub get() = Info.stub != null
|
val isRunningAsStub get() = Info.stub != null
|
||||||
|
val isCanaryVersion = !BuildConfig.VERSION_NAME.contains(".")
|
||||||
|
|
||||||
object Info {
|
object Info {
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ import java.util.concurrent.TimeUnit
|
|||||||
|
|
||||||
object Utils {
|
object Utils {
|
||||||
|
|
||||||
val isCanary: Boolean = BuildConfig.VERSION_NAME.contains("-")
|
|
||||||
|
|
||||||
fun toast(msg: CharSequence, duration: Int) {
|
fun toast(msg: CharSequence, duration: Int) {
|
||||||
UiThreadHandler.run { Toast.makeText(get(), msg, duration).show() }
|
UiThreadHandler.run { Toast.makeText(get(), msg, duration).show() }
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.topjohnwu.magisk.R
|
|||||||
import com.topjohnwu.magisk.core.Config
|
import com.topjohnwu.magisk.core.Config
|
||||||
import com.topjohnwu.magisk.core.Const
|
import com.topjohnwu.magisk.core.Const
|
||||||
import com.topjohnwu.magisk.core.Info
|
import com.topjohnwu.magisk.core.Info
|
||||||
|
import com.topjohnwu.magisk.core.isCanaryVersion
|
||||||
import com.topjohnwu.magisk.core.utils.*
|
import com.topjohnwu.magisk.core.utils.*
|
||||||
import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
|
import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
|
||||||
import com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
|
import com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
|
||||||
@ -140,7 +141,7 @@ object UpdateChannel : SettingsItem.Selector() {
|
|||||||
|
|
||||||
override val title = R.string.settings_update_channel_title.asTransitive()
|
override val title = R.string.settings_update_channel_title.asTransitive()
|
||||||
override val entries = resources.getStringArray(R.array.update_channel).let {
|
override val entries = resources.getStringArray(R.array.update_channel).let {
|
||||||
if (!Utils.isCanary && Config.updateChannel < Config.Value.CANARY_CHANNEL)
|
if (!isCanaryVersion && Config.updateChannel < Config.Value.CANARY_CHANNEL)
|
||||||
it.take(it.size - 2).toTypedArray() else it
|
it.take(it.size - 2).toTypedArray() else it
|
||||||
}
|
}
|
||||||
override val entryValues = resources.getStringArray(R.array.value_array)
|
override val entryValues = resources.getStringArray(R.array.value_array)
|
||||||
|
@ -27,7 +27,7 @@ import static com.topjohnwu.magisk.DelegateApplication.MANAGER_APK;
|
|||||||
|
|
||||||
public class DownloadActivity extends Activity {
|
public class DownloadActivity extends Activity {
|
||||||
|
|
||||||
private static final boolean CANARY = BuildConfig.VERSION_NAME.contains("-");
|
private static final boolean CANARY = !BuildConfig.VERSION_NAME.contains(".");
|
||||||
private static final String URL =
|
private static final String URL =
|
||||||
BuildConfig.DEV_CHANNEL != null ? BuildConfig.DEV_CHANNEL : RawData.urlBase() +
|
BuildConfig.DEV_CHANNEL != null ? BuildConfig.DEV_CHANNEL : RawData.urlBase() +
|
||||||
(BuildConfig.DEBUG ? RawData.debug() : (CANARY ? RawData.canary() : RawData.stable()));
|
(BuildConfig.DEBUG ? RawData.debug() : (CANARY ? RawData.canary() : RawData.stable()));
|
||||||
|
Loading…
Reference in New Issue
Block a user