mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 16:21:50 +01:00
update comment
This commit is contained in:
parent
2b2601aa4a
commit
c960cc1ee5
@ -27,8 +27,8 @@ object ExtensionsList {
|
|||||||
var lastUpdateCheck: Long = 0
|
var lastUpdateCheck: Long = 0
|
||||||
var updateMap = ConcurrentHashMap<String, Extension.Available>()
|
var updateMap = ConcurrentHashMap<String, Extension.Available>()
|
||||||
|
|
||||||
// const val ExtensionUpdateDelayTime = 60 * 1000 // 60,000 milliseconds = 60 seconds
|
/** 60,000 milliseconds = 60 seconds */
|
||||||
const val ExtensionUpdateDelayTime = 60 * 1000
|
private const val ExtensionUpdateDelayTime = 60 * 1000
|
||||||
|
|
||||||
suspend fun getExtensionList(): List<ExtensionDataClass> {
|
suspend fun getExtensionList(): List<ExtensionDataClass> {
|
||||||
// update if {ExtensionUpdateDelayTime} seconds has passed or requested offline and database is empty
|
// update if {ExtensionUpdateDelayTime} seconds has passed or requested offline and database is empty
|
||||||
@ -69,20 +69,20 @@ object ExtensionsList {
|
|||||||
val extensionRecord = ExtensionTable.select { ExtensionTable.pkgName eq foundExtension.pkgName }.firstOrNull()
|
val extensionRecord = ExtensionTable.select { ExtensionTable.pkgName eq foundExtension.pkgName }.firstOrNull()
|
||||||
if (extensionRecord != null) {
|
if (extensionRecord != null) {
|
||||||
if (extensionRecord[ExtensionTable.isInstalled]) {
|
if (extensionRecord[ExtensionTable.isInstalled]) {
|
||||||
if (foundExtension.versionCode > extensionRecord[ExtensionTable.versionCode]) {
|
when {
|
||||||
// there is an update
|
foundExtension.versionCode > extensionRecord[ExtensionTable.versionCode] -> {
|
||||||
ExtensionTable.update({ ExtensionTable.pkgName eq foundExtension.pkgName }) {
|
// there is an update
|
||||||
it[hasUpdate] = true
|
ExtensionTable.update({ ExtensionTable.pkgName eq foundExtension.pkgName }) {
|
||||||
|
it[hasUpdate] = true
|
||||||
|
}
|
||||||
|
updateMap.putIfAbsent(foundExtension.pkgName, foundExtension)
|
||||||
}
|
}
|
||||||
updateMap.putIfAbsent(foundExtension.pkgName, foundExtension)
|
foundExtension.versionCode < extensionRecord[ExtensionTable.versionCode] -> {
|
||||||
} else if (foundExtension.versionCode < extensionRecord[ExtensionTable.versionCode]) {
|
// some how the user installed an invalid version
|
||||||
// some how the user installed an invalid version
|
ExtensionTable.update({ ExtensionTable.pkgName eq foundExtension.pkgName }) {
|
||||||
ExtensionTable.update({ ExtensionTable.pkgName eq foundExtension.pkgName }) {
|
it[isObsolete] = true
|
||||||
it[isObsolete] = true
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// the two are equal
|
|
||||||
// NOOP
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// extension is not installed so we can overwrite the data without a care
|
// extension is not installed so we can overwrite the data without a care
|
||||||
@ -115,7 +115,7 @@ object ExtensionsList {
|
|||||||
ExtensionTable.selectAll().forEach { extensionRecord ->
|
ExtensionTable.selectAll().forEach { extensionRecord ->
|
||||||
val foundExtension = foundExtensions.find { it.pkgName == extensionRecord[ExtensionTable.pkgName] }
|
val foundExtension = foundExtensions.find { it.pkgName == extensionRecord[ExtensionTable.pkgName] }
|
||||||
if (foundExtension == null) {
|
if (foundExtension == null) {
|
||||||
// this extensions is obsolete
|
// not in the repo, so this extensions is obsolete
|
||||||
if (extensionRecord[ExtensionTable.isInstalled]) {
|
if (extensionRecord[ExtensionTable.isInstalled]) {
|
||||||
// is installed so we should mark it as obsolete
|
// is installed so we should mark it as obsolete
|
||||||
ExtensionTable.update({ ExtensionTable.pkgName eq extensionRecord[ExtensionTable.pkgName] }) {
|
ExtensionTable.update({ ExtensionTable.pkgName eq extensionRecord[ExtensionTable.pkgName] }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user