From 257ceb99f734cd17e9f39da87c15cadfd20f041d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 9 Apr 2021 01:40:08 -0700 Subject: [PATCH] SDK < 21 is EOL --- app/src/main/java/com/topjohnwu/magisk/core/Const.kt | 1 + .../com/topjohnwu/magisk/data/repository/NetworkService.kt | 5 +++++ .../main/java/com/topjohnwu/magisk/di/NetworkingModule.kt | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Const.kt b/app/src/main/java/com/topjohnwu/magisk/core/Const.kt index d8557e849..447c11852 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Const.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Const.kt @@ -63,6 +63,7 @@ object Const { const val GITHUB_RAW_URL = "https://raw.githubusercontent.com/" const val GITHUB_API_URL = "https://api.github.com/" const val GITHUB_PAGE_URL = "https://topjohnwu.github.io/magisk-files/" + const val GITHUB_OLD_PAGE_URL = "https://topjohnwu.github.io/magisk_files/" const val JS_DELIVR_URL = "https://cdn.jsdelivr.net/gh/" const val OFFICIAL_REPO = "https://magisk-modules-repo.github.io/submission/modules.json" } diff --git a/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt b/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt index ac63765dd..825a0a039 100644 --- a/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt @@ -1,5 +1,6 @@ package com.topjohnwu.magisk.data.repository +import android.os.Build import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Config.Value.BETA_CHANNEL import com.topjohnwu.magisk.core.Config.Value.CANARY_CHANNEL @@ -20,6 +21,10 @@ class NetworkService( private val api: GithubApiServices ) { suspend fun fetchUpdate() = safe { + // Pre SDK 21 no longer receives any major updates + if (Build.VERSION.SDK_INT < 21) + return fetchStableUpdate() + var info = when (Config.updateChannel) { DEFAULT_CHANNEL, STABLE_CHANNEL -> fetchStableUpdate() BETA_CHANNEL -> fetchBetaUpdate() diff --git a/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt b/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt index cd78ec27c..f3600e23c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt @@ -34,7 +34,10 @@ val networkingModule = module { single { createRetrofit(get()) } single { createApiService(get(), Const.Url.GITHUB_RAW_URL) } single { createApiService(get(), Const.Url.GITHUB_API_URL) } - single { createApiService(get(), Const.Url.GITHUB_PAGE_URL) } + single { createApiService(get(), + if (Build.VERSION.SDK_INT < 21) Const.Url.GITHUB_OLD_PAGE_URL + else Const.Url.GITHUB_PAGE_URL + ) } single { createApiService(get(), Const.Url.JS_DELIVR_URL) } single { createMarkwon(get(), get()) } }