mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-06 09:08:57 +01:00
Re-schedule EHentai updater job on app boot
Idle-until-urgent some stuff in app init Close debug menu onStop
This commit is contained in:
@@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.util.jobScheduler
|
||||
import exh.EH_SOURCE_ID
|
||||
import exh.EXH_SOURCE_ID
|
||||
import exh.eh.EHentaiUpdateWorker
|
||||
@@ -52,7 +53,7 @@ object DebugFunctions {
|
||||
|
||||
fun convertAllExhentaiGalleriesToEhentai() = convertSources(EXH_SOURCE_ID, EH_SOURCE_ID)
|
||||
|
||||
fun testLaunchBackgroundUpdater() {
|
||||
fun testLaunchEhentaiBackgroundUpdater() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
EHentaiUpdateWorker.launchBackgroundTest(app)
|
||||
} else {
|
||||
@@ -60,6 +61,35 @@ object DebugFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
fun rescheduleEhentaiBackgroundUpdater() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
EHentaiUpdateWorker.scheduleBackground(app)
|
||||
} else {
|
||||
error("OS/SDK version too old!")
|
||||
}
|
||||
}
|
||||
|
||||
fun listScheduledJobs() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
app.jobScheduler.allPendingJobs.map { j ->
|
||||
"""
|
||||
{
|
||||
info: ${j.id},
|
||||
isPeriod: ${j.isPeriodic},
|
||||
isPersisted: ${j.isPersisted},
|
||||
intervalMillis: ${j.intervalMillis},
|
||||
}
|
||||
""".trimIndent()
|
||||
}.joinToString(",\n")
|
||||
} else {
|
||||
error("OS/SDK version too old!")
|
||||
}
|
||||
|
||||
fun cancelAllScheduledJobs() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
app.jobScheduler.cancelAll()
|
||||
} else {
|
||||
error("OS/SDK version too old!")
|
||||
}
|
||||
|
||||
private fun convertSources(from: Long, to: Long) {
|
||||
db.lowLevel().executeSQL(RawQuery.builder()
|
||||
.query("""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package exh.debug
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.support.v7.preference.PreferenceScreen
|
||||
import android.text.Html
|
||||
import android.util.Log
|
||||
@@ -64,6 +65,11 @@ class SettingsDebugController : SettingsController() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {
|
||||
super.onActivityStopped(activity)
|
||||
router.popCurrentController()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val MODIFIED_TEXT = Html.fromHtml("<font color='red'>MODIFIED</font>")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user