AppUtil: Check updates for nightly builds too
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -33,7 +33,9 @@ object Constants {
|
|||||||
const val EXODUS_SUBMIT_PAGE = "https://reports.exodus-privacy.eu.org/analysis/submit/#"
|
const val EXODUS_SUBMIT_PAGE = "https://reports.exodus-privacy.eu.org/analysis/submit/#"
|
||||||
const val EXODUS_REPORT_URL = "https://reports.exodus-privacy.eu.org/reports/"
|
const val EXODUS_REPORT_URL = "https://reports.exodus-privacy.eu.org/reports/"
|
||||||
const val SHARE_URL = "https://play.google.com/store/apps/details?id="
|
const val SHARE_URL = "https://play.google.com/store/apps/details?id="
|
||||||
const val UPDATE_URL = "https://gitlab.com/AuroraOSS/AuroraStore/raw/master/updates.json"
|
|
||||||
|
const val UPDATE_URL_STABLE = "https://gitlab.com/AuroraOSS/AuroraStore/raw/master/updates.json"
|
||||||
|
const val UPDATE_URL_NIGHTLY = "https://auroraoss.com/downloads/AuroraStore/Feeds/nightly_feed.json"
|
||||||
|
|
||||||
const val NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT"
|
const val NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT"
|
||||||
const val NOTIFICATION_CHANNEL_GENERAL = "NOTIFICATION_CHANNEL_GENERAL"
|
const val NOTIFICATION_CHANNEL_GENERAL = "NOTIFICATION_CHANNEL_GENERAL"
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ class AppUtil @Inject constructor(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
private val TAG = AppUtil::class.java.simpleName
|
private val TAG = AppUtil::class.java.simpleName
|
||||||
|
|
||||||
private val RELEASE = "release"
|
private val RELEASE = "release"
|
||||||
|
private val NIGHTLY = "nightly"
|
||||||
|
|
||||||
private val isExtendedUpdateEnabled get() = Preferences.getBoolean(
|
private val isExtendedUpdateEnabled get() = Preferences.getBoolean(
|
||||||
context, Preferences.PREFERENCE_UPDATES_EXTENDED
|
context, Preferences.PREFERENCE_UPDATES_EXTENDED
|
||||||
@@ -109,13 +111,17 @@ class AppUtil @Inject constructor(
|
|||||||
private suspend fun getSelfUpdate(context: Context, gson: Gson): App? {
|
private suspend fun getSelfUpdate(context: Context, gson: Gson): App? {
|
||||||
return withContext(Dispatchers.IO) {
|
return withContext(Dispatchers.IO) {
|
||||||
@Suppress("KotlinConstantConditions") // False-positive for build type always not being release
|
@Suppress("KotlinConstantConditions") // False-positive for build type always not being release
|
||||||
if (BuildConfig.BUILD_TYPE != RELEASE) {
|
val updateUrl = when (BuildConfig.BUILD_TYPE) {
|
||||||
Log.i(TAG, "Self-updates are not available for this build!")
|
RELEASE -> Constants.UPDATE_URL_STABLE
|
||||||
return@withContext null
|
NIGHTLY -> Constants.UPDATE_URL_NIGHTLY
|
||||||
|
else -> {
|
||||||
|
Log.i(TAG, "Self-updates are not available for this build!")
|
||||||
|
return@withContext null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val response = httpClient.get(Constants.UPDATE_URL, mapOf())
|
val response = httpClient.get(updateUrl, mapOf())
|
||||||
val selfUpdate =
|
val selfUpdate =
|
||||||
gson.fromJson(String(response.responseBytes), SelfUpdate::class.java)
|
gson.fromJson(String(response.responseBytes), SelfUpdate::class.java)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user