Remove app update check on Android 5.x

(cherry picked from commit 13324dd1a1f52dfeaa551d34d2a0c57d6be3940d)
This commit is contained in:
arkon 2021-04-19 15:33:08 -04:00 committed by Jobobby04
parent fc5eb4cccc
commit f45fdca168
4 changed files with 39 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi
import android.os.Build
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
@ -144,6 +145,11 @@ object Migrations {
if (oldVersion < 59) {
// Reset rotation to Free after replacing Lock
preferences.rotation().set(1)
// Disable update check for Android 5.x users
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
UpdaterJob.cancelTask(context)
}
}
return true
}

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.more
import android.app.Dialog
import android.os.Build
import android.os.Bundle
import androidx.core.os.bundleOf
import androidx.preference.PreferenceScreen
@ -161,6 +162,11 @@ class AboutController : SettingsController() {
private fun checkVersion() {
if (activity == null) return
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
activity?.toast(R.string.update_check_eol)
return
}
activity?.toast(R.string.update_check_look_for_updates)
launchNow {

View File

@ -1,6 +1,7 @@
package exh
import android.content.Context
import android.os.Build
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import com.pushtorefresh.storio.sqlite.queries.Query
@ -34,6 +35,8 @@ import exh.source.MERGED_SOURCE_ID
import exh.source.PERV_EDEN_EN_SOURCE_ID
import exh.source.PERV_EDEN_IT_SOURCE_ID
import exh.source.TSUMINO_SOURCE_ID
import exh.util.over
import exh.util.under
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
@ -65,12 +68,14 @@ object EXHMigrations {
// Fresh install
if (oldVersion == 0) {
// Set up default background tasks
UpdaterJob.setupTask(context)
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT over Build.VERSION_CODES.LOLLIPOP_MR1) {
UpdaterJob.setupTask(context)
}
ExtensionUpdateJob.setupTask(context)
LibraryUpdateJob.setupTask(context)
return false
}
if (oldVersion < 4) {
if (oldVersion under 4) {
db.inTransaction {
updateSourceId(HBROWSE_SOURCE_ID, 6912)
// Migrate BHrowse URLs
@ -96,20 +101,20 @@ object EXHMigrations {
.executeAsBlocking()
}
}
if (oldVersion < 5) {
if (oldVersion under 5) {
db.inTransaction {
// Migrate Hitomi source IDs
updateSourceId(Hitomi.otherId, 6910)
}
}
if (oldVersion < 6) {
if (oldVersion under 6) {
db.inTransaction {
updateSourceId(PERV_EDEN_EN_SOURCE_ID, 6905)
updateSourceId(PERV_EDEN_IT_SOURCE_ID, 6906)
updateSourceId(NHentai.otherId, 6907)
}
}
if (oldVersion < 7) {
if (oldVersion under 7) {
db.inTransaction {
val mergedMangas = db.db.get()
.listOfObjects(Manga::class.java)
@ -209,12 +214,12 @@ object EXHMigrations {
}
}
}
if (oldVersion < 12) {
if (oldVersion under 12) {
// Force MAL log out due to login flow change
val trackManager = Injekt.get<TrackManager>()
trackManager.myAnimeList.logout()
}
if (oldVersion < 14) {
if (oldVersion under 14) {
// Migrate DNS over HTTPS setting
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val wasDohEnabled = prefs.getBoolean("enable_doh", false)
@ -225,12 +230,16 @@ object EXHMigrations {
}
}
}
if (oldVersion < 16) {
if (oldVersion under 16) {
// Reset rotation to Free after replacing Lock
preferences.rotation().set(1)
// Disable update check for Android 5.x users
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT under Build.VERSION_CODES.M) {
UpdaterJob.cancelTask(context)
}
}
// if (oldVersion < 1) { } (1 is current release version)
// if (oldVersion under 1) { } (1 is current release version)
// do stuff here when releasing changed crap
// TODO BE CAREFUL TO NOT FUCK UP MergedSources IF CHANGING URLs

View File

@ -0,0 +1,9 @@
package exh.util
infix fun Int.over(other: Int) = this > other
infix fun Int.overEq(other: Int) = this >= other
infix fun Int.under(other: Int) = this < other
infix fun Int.underEq(other: Int) = this <= other