mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 07:49:17 +01:00
fix: Download on WiFi regardless of metered status (#3489)
* fix: Download on WiFi regardless of metered status fixes #3395 * fix: check if not WiFi rather than checking if connection is mobile
This commit is contained in:
parent
bf22e69250
commit
76147a9be7
@ -4,6 +4,7 @@ import android.app.Notification
|
|||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.net.ConnectivityManager
|
||||||
import android.net.NetworkInfo.State.CONNECTED
|
import android.net.NetworkInfo.State.CONNECTED
|
||||||
import android.net.NetworkInfo.State.DISCONNECTED
|
import android.net.NetworkInfo.State.DISCONNECTED
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -143,7 +144,7 @@ class DownloadService : Service() {
|
|||||||
private fun onNetworkStateChanged(connectivity: Connectivity) {
|
private fun onNetworkStateChanged(connectivity: Connectivity) {
|
||||||
when (connectivity.state) {
|
when (connectivity.state) {
|
||||||
CONNECTED -> {
|
CONNECTED -> {
|
||||||
if (preferences.downloadOnlyOverWifi() && connectivityManager.isActiveNetworkMetered) {
|
if (preferences.downloadOnlyOverWifi() && connectivityManager.activeNetworkInfo?.type != ConnectivityManager.TYPE_WIFI) {
|
||||||
downloadManager.stopDownloads(getString(R.string.download_notifier_text_only_wifi))
|
downloadManager.stopDownloads(getString(R.string.download_notifier_text_only_wifi))
|
||||||
} else {
|
} else {
|
||||||
val started = downloadManager.startDownloads()
|
val started = downloadManager.startDownloads()
|
||||||
|
Loading…
Reference in New Issue
Block a user