diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d8447926d4..edc1336552 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -178,7 +178,7 @@
android:exported="false" />
(
+ val request = PeriodicWorkRequestBuilder(
7,
TimeUnit.DAYS,
3,
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt
similarity index 91%
rename from app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt
rename to app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt
index cf8735b7b1..fc914f7597 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateNotifier.kt
@@ -12,12 +12,7 @@ import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager
-/**
- * DownloadNotifier is used to show notifications when downloading and update.
- *
- * @param context context of application.
- */
-internal class UpdaterNotifier(private val context: Context) {
+internal class AppUpdateNotifier(private val context: Context) {
private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_COMMON)
@@ -31,8 +26,8 @@ internal class UpdaterNotifier(private val context: Context) {
}
fun promptUpdate(url: String) {
- val intent = Intent(context, UpdaterService::class.java).apply {
- putExtra(UpdaterService.EXTRA_DOWNLOAD_URL, url)
+ val intent = Intent(context, AppUpdateService::class.java).apply {
+ putExtra(AppUpdateService.EXTRA_DOWNLOAD_URL, url)
}
val pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
with(notificationBuilder) {
@@ -125,7 +120,7 @@ internal class UpdaterNotifier(private val context: Context) {
addAction(
R.drawable.ic_refresh_24dp,
context.getString(R.string.action_retry),
- UpdaterService.downloadApkPendingService(context, url)
+ AppUpdateService.downloadApkPendingService(context, url)
)
addAction(
R.drawable.ic_close_24dp,
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt
similarity index 93%
rename from app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt
rename to app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt
index 916debfe82..e899102429 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt
@@ -25,7 +25,7 @@ import logcat.LogPriority
import uy.kohesive.injekt.injectLazy
import java.io.File
-class UpdaterService : Service() {
+class AppUpdateService : Service() {
private val network: NetworkHelper by injectLazy()
@@ -34,12 +34,12 @@ class UpdaterService : Service() {
*/
private lateinit var wakeLock: PowerManager.WakeLock
- private lateinit var notifier: UpdaterNotifier
+ private lateinit var notifier: AppUpdateNotifier
override fun onCreate() {
super.onCreate()
- notifier = UpdaterNotifier(this)
+ notifier = AppUpdateNotifier(this)
wakeLock = acquireWakeLock(javaClass.name)
startForeground(Notifications.ID_UPDATER, notifier.onDownloadStarted().build())
@@ -139,7 +139,7 @@ class UpdaterService : Service() {
* @return true if the service is running, false otherwise.
*/
private fun isRunning(context: Context): Boolean =
- context.isServiceRunning(UpdaterService::class.java)
+ context.isServiceRunning(AppUpdateService::class.java)
/**
* Downloads a new update and let the user install the new version from a notification.
@@ -149,7 +149,7 @@ class UpdaterService : Service() {
*/
fun start(context: Context, url: String, title: String = context.getString(R.string.app_name)) {
if (!isRunning(context)) {
- val intent = Intent(context, UpdaterService::class.java).apply {
+ val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(EXTRA_DOWNLOAD_TITLE, title)
putExtra(EXTRA_DOWNLOAD_URL, url)
}
@@ -164,7 +164,7 @@ class UpdaterService : Service() {
* @return [PendingIntent]
*/
internal fun downloadApkPendingService(context: Context, url: String): PendingIntent {
- val intent = Intent(context, UpdaterService::class.java).apply {
+ val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(EXTRA_DOWNLOAD_URL, url)
}
return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubRelease.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubRelease.kt
index 099ae33595..5f0e1ff5f5 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubRelease.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubRelease.kt
@@ -13,7 +13,7 @@ import kotlinx.serialization.Serializable
* @param assets assets of latest release.
*/
@Serializable
-class GithubRelease(
+data class GithubRelease(
@SerialName("tag_name") val version: String,
@SerialName("body") val info: String,
@SerialName("assets") private val assets: List
@@ -40,5 +40,5 @@ class GithubRelease(
* @param downloadLink download url.
*/
@Serializable
- class Assets(@SerialName("browser_download_url") val downloadLink: String)
+ data class Assets(@SerialName("browser_download_url") val downloadLink: String)
}
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt
index cf99f4fab9..7d1521ce8d 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt
@@ -6,7 +6,7 @@ import androidx.core.os.bundleOf
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.updater.AppUpdateResult
-import eu.kanade.tachiyomi.data.updater.UpdaterService
+import eu.kanade.tachiyomi.data.updater.AppUpdateService
import eu.kanade.tachiyomi.ui.base.controller.DialogController
class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundle) {
@@ -24,7 +24,7 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl
if (appContext != null) {
// Start download
val url = args.getString(URL_KEY) ?: ""
- UpdaterService.start(appContext, url)
+ AppUpdateService.start(appContext, url)
}
}
.setNegativeButton(R.string.update_check_ignore, null)