mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 18:38:23 +01:00
Get appropriate download link based on CPU ABI
This commit is contained in:
parent
e6f3cd03bb
commit
f2e4b2fc99
@ -1,5 +1,6 @@
|
||||
package eu.kanade.tachiyomi.data.updater
|
||||
|
||||
import android.os.Build
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@ -22,8 +23,17 @@ class GithubRelease(
|
||||
* Get download link of latest release from the assets.
|
||||
* @return download link of latest release.
|
||||
*/
|
||||
val downloadLink: String
|
||||
get() = assets[0].downloadLink
|
||||
fun getDownloadLink(): String {
|
||||
val apkVariant = when (Build.SUPPORTED_ABIS[0]) {
|
||||
"arm64-v8a" -> "-arm64-v8a"
|
||||
"armeabi-v7a" -> "-armeabi-v7a"
|
||||
"x86", "x86_64" -> "-x86"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
return assets.find { it.downloadLink.contains("tachiyomi$apkVariant-") }?.downloadLink
|
||||
?: assets[0].downloadLink
|
||||
}
|
||||
|
||||
/**
|
||||
* Assets class containing download url.
|
||||
|
@ -21,7 +21,7 @@ class UpdaterJob(private val context: Context, workerParams: WorkerParameters) :
|
||||
val result = GithubUpdateChecker().checkForUpdate()
|
||||
|
||||
if (result is GithubUpdateResult.NewUpdate) {
|
||||
UpdaterNotifier(context).promptUpdate(result.release.downloadLink)
|
||||
UpdaterNotifier(context).promptUpdate(result.release.getDownloadLink())
|
||||
}
|
||||
Result.success()
|
||||
} catch (e: Exception) {
|
||||
|
@ -110,7 +110,7 @@ class AboutController : SettingsController(), NoToolbarElevationController {
|
||||
when (val result = updateChecker.checkForUpdate()) {
|
||||
is GithubUpdateResult.NewUpdate -> {
|
||||
val body = result.release.info
|
||||
val url = result.release.downloadLink
|
||||
val url = result.release.getDownloadLink()
|
||||
|
||||
// Create confirmation window
|
||||
NewUpdateDialogController(body, url).showDialog(router)
|
||||
|
Loading…
Reference in New Issue
Block a user