diff --git a/CHANGELOG.md b/CHANGELOG.md index c5b35d136..672ba0099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Update tracker icons ([@AntsyLich](https://github.com/AntsyLich)) ([#2773](https://github.com/mihonapp/mihon/pull/2773)) - Add a small increment to chapter number before comparison to fix progress sync issues for Suwayomi ([@cpiber](https://github.com/cpiber)) ([#2657](https://github.com/mihonapp/mihon/pull/2675)) - Add all pages of adjacent chapters in the UI instead of only the first or last three ([@AntsyLich](https://github.com/AntsyLich)) ([#2995](https://github.com/mihonapp/mihon/pull/2995)) +- Going back now first clears search query on browse extension tab ([@cuong-tran](https://github.com/cuong-tran)) ([#2906](https://github.com/mihonapp/mihon/pull/2906)) +- Automatic library updates now run even when connected to a VPN ([@AntsyLich](https://github.com/AntsyLich)) ([#2773](https://github.com/mihonapp/mihon/pull/2773)) ### Fixed - Fix reader tap zones triggering after scrolling is stopped by tapping ([@NGB-Was-Taken](https://github.com/NGB-Was-Taken)) ([#2680](https://github.com/mihonapp/mihon/pull/2680)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt index 5696a4600..e5c2c5124 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt @@ -748,10 +748,6 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet private const val KEY_MANGA_IDS = "manga_ids" // KMK <-- - fun cancelAllWorks(context: Context) { - context.workManager.cancelAllWorkByTag(TAG) - } - fun setupTask( context: Context, prefInterval: Int? = null, @@ -765,16 +761,19 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet } else { NetworkType.CONNECTED } - val networkRequestBuilder = NetworkRequest.Builder() - if (DEVICE_ONLY_ON_WIFI in restrictions) { - networkRequestBuilder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI) - } - if (DEVICE_NETWORK_NOT_METERED in restrictions) { - networkRequestBuilder.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED) + val networkRequest = NetworkRequest.Builder().apply { + removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN) + if (DEVICE_ONLY_ON_WIFI in restrictions) { + addTransportType(NetworkCapabilities.TRANSPORT_WIFI) + } + if (DEVICE_NETWORK_NOT_METERED in restrictions) { + addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED) + } } + .build() val constraints = Constraints.Builder() // 'networkRequest' only applies to Android 9+, otherwise 'networkType' is used - .setRequiredNetworkRequest(networkRequestBuilder.build(), networkType) + .setRequiredNetworkRequest(networkRequest, networkType) .setRequiresCharging(DEVICE_CHARGING in restrictions) .setRequiresBatteryNotLow(true) .build() diff --git a/app/src/main/java/exh/eh/EHentaiUpdateWorker.kt b/app/src/main/java/exh/eh/EHentaiUpdateWorker.kt index 2d0b30c53..b0cdba977 100644 --- a/app/src/main/java/exh/eh/EHentaiUpdateWorker.kt +++ b/app/src/main/java/exh/eh/EHentaiUpdateWorker.kt @@ -40,6 +40,7 @@ import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI import tachiyomi.domain.manga.interactor.GetExhFavoriteMangaWithMetadata import tachiyomi.domain.manga.interactor.GetFlatMetadataById @@ -289,17 +290,27 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara val interval = prefInterval ?: exhPreferences.exhAutoUpdateFrequency().get() if (interval > 0) { val restrictions = prefRestrictions ?: exhPreferences.exhAutoUpdateRequirements().get() - val acRestriction = DEVICE_CHARGING in restrictions - - val networkRequestBuilder = NetworkRequest.Builder() - if (DEVICE_ONLY_ON_WIFI in restrictions) { - networkRequestBuilder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI) + val networkType = if (DEVICE_NETWORK_NOT_METERED in restrictions) { + NetworkType.UNMETERED + } else { + NetworkType.CONNECTED } + val networkRequest = NetworkRequest.Builder().apply { + removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN) + if (DEVICE_ONLY_ON_WIFI in restrictions) { + addTransportType(NetworkCapabilities.TRANSPORT_WIFI) + } + if (DEVICE_NETWORK_NOT_METERED in restrictions) { + addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED) + } + } + .build() val constraints = Constraints.Builder() // 'networkRequest' only applies to Android 9+, otherwise 'networkType' is used - .setRequiredNetworkRequest(networkRequestBuilder.build(), NetworkType.CONNECTED) - .setRequiresCharging(acRestriction) + .setRequiredNetworkRequest(networkRequest, networkType) + .setRequiresCharging(DEVICE_CHARGING in restrictions) + .setRequiresBatteryNotLow(true) .build() val request = PeriodicWorkRequestBuilder(