SDK < 21 is EOL
This commit is contained in:
parent
706d53065b
commit
257ceb99f7
@ -63,6 +63,7 @@ object Const {
|
|||||||
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/"
|
const val GITHUB_API_URL = "https://api.github.com/"
|
||||||
const val GITHUB_PAGE_URL = "https://topjohnwu.github.io/magisk-files/"
|
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 JS_DELIVR_URL = "https://cdn.jsdelivr.net/gh/"
|
||||||
const val OFFICIAL_REPO = "https://magisk-modules-repo.github.io/submission/modules.json"
|
const val OFFICIAL_REPO = "https://magisk-modules-repo.github.io/submission/modules.json"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.topjohnwu.magisk.data.repository
|
package com.topjohnwu.magisk.data.repository
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import com.topjohnwu.magisk.core.Config
|
import com.topjohnwu.magisk.core.Config
|
||||||
import com.topjohnwu.magisk.core.Config.Value.BETA_CHANNEL
|
import com.topjohnwu.magisk.core.Config.Value.BETA_CHANNEL
|
||||||
import com.topjohnwu.magisk.core.Config.Value.CANARY_CHANNEL
|
import com.topjohnwu.magisk.core.Config.Value.CANARY_CHANNEL
|
||||||
@ -20,6 +21,10 @@ class NetworkService(
|
|||||||
private val api: GithubApiServices
|
private val api: GithubApiServices
|
||||||
) {
|
) {
|
||||||
suspend fun fetchUpdate() = safe {
|
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) {
|
var info = when (Config.updateChannel) {
|
||||||
DEFAULT_CHANNEL, STABLE_CHANNEL -> fetchStableUpdate()
|
DEFAULT_CHANNEL, STABLE_CHANNEL -> fetchStableUpdate()
|
||||||
BETA_CHANNEL -> fetchBetaUpdate()
|
BETA_CHANNEL -> fetchBetaUpdate()
|
||||||
|
@ -34,7 +34,10 @@ val networkingModule = module {
|
|||||||
single { createRetrofit(get()) }
|
single { createRetrofit(get()) }
|
||||||
single { createApiService<RawServices>(get(), Const.Url.GITHUB_RAW_URL) }
|
single { createApiService<RawServices>(get(), Const.Url.GITHUB_RAW_URL) }
|
||||||
single { createApiService<GithubApiServices>(get(), Const.Url.GITHUB_API_URL) }
|
single { createApiService<GithubApiServices>(get(), Const.Url.GITHUB_API_URL) }
|
||||||
single { createApiService<GithubPageServices>(get(), Const.Url.GITHUB_PAGE_URL) }
|
single { createApiService<GithubPageServices>(get(),
|
||||||
|
if (Build.VERSION.SDK_INT < 21) Const.Url.GITHUB_OLD_PAGE_URL
|
||||||
|
else Const.Url.GITHUB_PAGE_URL
|
||||||
|
) }
|
||||||
single { createApiService<JSDelivrServices>(get(), Const.Url.JS_DELIVR_URL) }
|
single { createApiService<JSDelivrServices>(get(), Const.Url.JS_DELIVR_URL) }
|
||||||
single { createMarkwon(get(), get()) }
|
single { createMarkwon(get(), get()) }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user