From ea5d01043d01a8d5ecdcf81ef30d3313361c8ad4 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Tue, 17 Oct 2023 09:36:13 +0200 Subject: [PATCH] Remove network connectivity check Apparently in some cases the network manager is incorrectly signaling that the system is offline while it's actually online. The current implementation does not have a way to circumvent that incorrect reporting. Also the error reporting made it seem that the actual problem is a metered connection. Ripping out the connectivity check solves these issues at the expense of connections timing out rather than the connection not being set up in the first place when the system is offline. CCBUG: 475400 --- src/networkconnectionmanager.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/networkconnectionmanager.cpp b/src/networkconnectionmanager.cpp index 7756d2f3..b313f18f 100644 --- a/src/networkconnectionmanager.cpp +++ b/src/networkconnectionmanager.cpp @@ -62,12 +62,10 @@ bool NetworkConnectionManager::feedUpdatesAllowed() const #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool allowed = true; if (m_backendAvailable) { - allowed = (QNetworkInformation::instance()->reachability() != QNetworkInformation::Reachability::Disconnected - && (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredFeedUpdates())); + allowed = (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredFeedUpdates()); } #else - bool allowed = (m_networkStatus.connectivity() != SolidExtras::NetworkStatus::No - && (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredFeedUpdates())); + bool allowed = (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredFeedUpdates()); #endif qCDebug(kastsNetworkConnectionManager) << "FeedUpdatesAllowed()" << allowed; @@ -80,12 +78,10 @@ bool NetworkConnectionManager::episodeDownloadsAllowed() const #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool allowed = true; if (m_backendAvailable) { - allowed = (QNetworkInformation::instance()->reachability() != QNetworkInformation::Reachability::Disconnected - && (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredEpisodeDownloads())); + allowed = (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredEpisodeDownloads()); } #else - bool allowed = (m_networkStatus.connectivity() != SolidExtras::NetworkStatus::No - && (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredEpisodeDownloads())); + bool allowed = (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredEpisodeDownloads()); #endif qCDebug(kastsNetworkConnectionManager) << "EpisodeDownloadsAllowed()" << allowed; @@ -98,12 +94,10 @@ bool NetworkConnectionManager::imageDownloadsAllowed() const #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool allowed = true; if (m_backendAvailable) { - allowed = (QNetworkInformation::instance()->reachability() != QNetworkInformation::Reachability::Disconnected - && (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredImageDownloads())); + allowed = (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredImageDownloads()); } #else - bool allowed = (m_networkStatus.connectivity() != SolidExtras::NetworkStatus::No - && (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredImageDownloads())); + bool allowed = (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredImageDownloads()); #endif qCDebug(kastsNetworkConnectionManager) << "ImageDownloadsAllowed()" << allowed; @@ -116,12 +110,10 @@ bool NetworkConnectionManager::streamingAllowed() const #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool allowed = true; if (m_backendAvailable) { - allowed = (QNetworkInformation::instance()->reachability() != QNetworkInformation::Reachability::Disconnected - && (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredStreaming())); + allowed = (!QNetworkInformation::instance()->isMetered() || SettingsManager::self()->allowMeteredStreaming()); } #else - bool allowed = (m_networkStatus.connectivity() != SolidExtras::NetworkStatus::No - && (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredStreaming())); + bool allowed = (m_networkStatus.metered() != SolidExtras::NetworkStatus::Yes || SettingsManager::self()->allowMeteredStreaming()); #endif qCDebug(kastsNetworkConnectionManager) << "StreamingAllowed()" << allowed;