From 22bb4e7e6e555e63759cf9a956a9f9f1866d19a3 Mon Sep 17 00:00:00 2001 From: Oscar Mira Date: Fri, 5 Apr 2024 00:42:19 +0200 Subject: [PATCH] Rename Network object to Networking --- .../com/google/android/gms/maps/MapView.java | 4 ++-- .../glide/ChunkedImageUrlLoader.java | 6 +++--- .../securesms/glide/OkHttpUrlLoader.java | 6 +++--- .../securesms/jobs/ApkUpdateJob.kt | 8 ++++---- .../jobs/ServiceOutageDetectionJob.java | 4 ++-- .../linkpreview/LinkPreviewRepository.java | 8 ++++---- .../logsubmit/SubmitDebugLogRepository.java | 8 ++++---- .../main/MainActivityListHostFragment.kt | 4 ++-- .../securesms/net/NetworkManager.java | 6 +++--- .../net/{Network.kt => Networking.kt} | 2 +- .../push/SignalServiceNetworkAccess.kt | 20 +++++++++---------- .../securesms/service/webrtc/WebRtcUtil.java | 4 ++-- .../securesms/util/NetworkUtil.java | 3 ++- 13 files changed, 42 insertions(+), 41 deletions(-) rename app/src/main/java/org/thoughtcrime/securesms/net/{Network.kt => Networking.kt} (99%) diff --git a/app/src/foss/java/com/google/android/gms/maps/MapView.java b/app/src/foss/java/com/google/android/gms/maps/MapView.java index 87e7dccf25..68663c94a6 100644 --- a/app/src/foss/java/com/google/android/gms/maps/MapView.java +++ b/app/src/foss/java/com/google/android/gms/maps/MapView.java @@ -27,7 +27,7 @@ import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; import org.thoughtcrime.securesms.BuildConfig; import org.thoughtcrime.securesms.R; -import org.thoughtcrime.securesms.net.Network; +import org.thoughtcrime.securesms.net.Networking; import org.thoughtcrime.securesms.osm.MapTileProvider; import java.net.Proxy; @@ -65,7 +65,7 @@ public void getMapAsync(OnMapReadyCallback callback) { private void setDefaultConfiguration(Context context) { final String userAgent = context.getPackageName(); - final Proxy proxy = Network.getProxy(); + final Proxy proxy = Networking.getProxy(); final IConfigurationProvider config = Configuration.getInstance(); config.setDebugMode(BuildConfig.DEBUG); config.setUserAgentValue(userAgent); diff --git a/app/src/main/java/org/thoughtcrime/securesms/glide/ChunkedImageUrlLoader.java b/app/src/main/java/org/thoughtcrime/securesms/glide/ChunkedImageUrlLoader.java index b4ddfb6a27..51d92623f5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/glide/ChunkedImageUrlLoader.java +++ b/app/src/main/java/org/thoughtcrime/securesms/glide/ChunkedImageUrlLoader.java @@ -11,7 +11,7 @@ import org.thoughtcrime.securesms.giph.model.ChunkedImageUrl; import org.thoughtcrime.securesms.net.ContentProxySafetyInterceptor; import org.thoughtcrime.securesms.net.ContentProxySelector; -import org.thoughtcrime.securesms.net.Network; +import org.thoughtcrime.securesms.net.Networking; import org.thoughtcrime.securesms.net.StandardUserAgentInterceptor; import java.io.InputStream; @@ -42,9 +42,9 @@ public static class Factory implements ModelLoaderFactory proxyStatus.setImageResource(R.drawable.ic_proxy_connected_24) WebSocketConnectionState.AUTHENTICATION_FAILED -> proxyStatus.setImageResource(R.drawable.ic_proxy_failed_24) WebSocketConnectionState.FAILED -> { - val proxyPending = Network.proxy == Network.DUMMY_PROXY + val proxyPending = Networking.proxy == Networking.DUMMY_PROXY if (proxyPending) proxyStatus.setImageResource(R.drawable.ic_proxy_connecting_24) else proxyStatus.setImageResource(R.drawable.ic_proxy_failed_24) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/net/NetworkManager.java b/app/src/main/java/org/thoughtcrime/securesms/net/NetworkManager.java index b27b6c5423..ae1a25f563 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/net/NetworkManager.java +++ b/app/src/main/java/org/thoughtcrime/securesms/net/NetworkManager.java @@ -54,11 +54,11 @@ public static NetworkManager create(@NonNull Context context) { } public boolean isNetworkEnabled() { - return Network.isEnabled(); + return Networking.isEnabled(); } public void setNetworkEnabled(boolean enabled) { - Network.setEnabled(enabled); + Networking.setEnabled(enabled); if (enabled) { onNetworkEnabled(); } @@ -123,7 +123,7 @@ private synchronized boolean configureProxy(SocksProxy newProxy) { return false; } - Network.setSocksProxy(newProxy); + Networking.setSocksProxy(newProxy); existingProxy = newProxy; SignalExecutors.UNBOUNDED.execute(() -> { diff --git a/app/src/main/java/org/thoughtcrime/securesms/net/Network.kt b/app/src/main/java/org/thoughtcrime/securesms/net/Networking.kt similarity index 99% rename from app/src/main/java/org/thoughtcrime/securesms/net/Network.kt rename to app/src/main/java/org/thoughtcrime/securesms/net/Networking.kt index 50ef8cd056..9443b65b00 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/net/Network.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/net/Networking.kt @@ -9,7 +9,7 @@ import java.net.SocketAddress import java.net.URI import javax.net.SocketFactory -object Network { +object Networking { @JvmStatic var isEnabled: Boolean = false diff --git a/app/src/main/java/org/thoughtcrime/securesms/push/SignalServiceNetworkAccess.kt b/app/src/main/java/org/thoughtcrime/securesms/push/SignalServiceNetworkAccess.kt index afd75abc81..89aadcffad 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/push/SignalServiceNetworkAccess.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/push/SignalServiceNetworkAccess.kt @@ -13,7 +13,7 @@ import org.thoughtcrime.securesms.keyvalue.SettingsValues import org.thoughtcrime.securesms.keyvalue.SignalStore import org.thoughtcrime.securesms.net.DeprecatedClientPreventionInterceptor import org.thoughtcrime.securesms.net.DeviceTransferBlockingInterceptor -import org.thoughtcrime.securesms.net.Network +import org.thoughtcrime.securesms.net.Networking import org.thoughtcrime.securesms.net.RemoteDeprecationDetectorInterceptor import org.thoughtcrime.securesms.net.StandardUserAgentInterceptor import org.whispersystems.signalservice.api.push.TrustStore @@ -219,9 +219,9 @@ open class SignalServiceNetworkAccess(context: Context) { signalCdsiUrls = fUrls.map { SignalCdsiUrl(it, F_CDSI_HOST, fTrustStore, APP_CONNECTION_SPEC) }.toTypedArray(), signalSvr2Urls = fUrls.map { SignalSvr2Url(it, fTrustStore, F_SVR2_HOST, APP_CONNECTION_SPEC) }.toTypedArray(), networkInterceptors = interceptors, - socketFactory = Network.socketFactory, - proxySelector = Network.proxySelectorForSocks, - dns = Network.dns, + socketFactory = Networking.socketFactory, + proxySelector = Networking.proxySelectorForSocks, + dns = Networking.dns, zkGroupServerPublicParams = zkGroupServerPublicParams, genericServerPublicParams = genericServerPublicParams, backupServerPublicParams = backupServerPublicParams @@ -273,9 +273,9 @@ open class SignalServiceNetworkAccess(context: Context) { signalCdsiUrls = arrayOf(SignalCdsiUrl(BuildConfig.SIGNAL_CDSI_URL, serviceTrustStore)), signalSvr2Urls = arrayOf(SignalSvr2Url(BuildConfig.SIGNAL_SVR2_URL, serviceTrustStore)), networkInterceptors = interceptors, - socketFactory = Network.socketFactory, - proxySelector = Network.proxySelectorForSocks, - dns = Network.dns, + socketFactory = Networking.socketFactory, + proxySelector = Networking.proxySelectorForSocks, + dns = Networking.dns, zkGroupServerPublicParams = zkGroupServerPublicParams, genericServerPublicParams = genericServerPublicParams, backupServerPublicParams = backupServerPublicParams @@ -344,9 +344,9 @@ open class SignalServiceNetworkAccess(context: Context) { signalCdsiUrls = cdsiUrls, signalSvr2Urls = svr2Urls, networkInterceptors = interceptors, - socketFactory = Network.socketFactory, - proxySelector = Network.proxySelectorForSocks, - dns = Network.dns, + socketFactory = Networking.socketFactory, + proxySelector = Networking.proxySelectorForSocks, + dns = Networking.dns, zkGroupServerPublicParams = zkGroupServerPublicParams, genericServerPublicParams = genericServerPublicParams, backupServerPublicParams = backupServerPublicParams diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcUtil.java b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcUtil.java index bac2d60519..8997aa3b9d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcUtil.java @@ -13,7 +13,7 @@ import org.signal.ringrtc.PeekInfo; import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; import org.thoughtcrime.securesms.events.WebRtcViewModel; -import org.thoughtcrime.securesms.net.Network; +import org.thoughtcrime.securesms.net.Networking; import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState; import org.thoughtcrime.securesms.webrtc.audio.AudioManagerCompat; import org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager; @@ -119,7 +119,7 @@ public static boolean isCallFull(@Nullable PeekInfo peekInfo) { } public static PeerConnection.ProxyInfo getProxyInfo() { - Proxy proxy = Network.getProxy(); + Proxy proxy = Networking.getProxy(); if (proxy == Proxy.NO_PROXY) { return null; } else if (proxy.type() == Proxy.Type.SOCKS) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java index d5c9621db6..11dd4ed6ba 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java @@ -11,6 +11,7 @@ import org.signal.ringrtc.CallManager; import org.thoughtcrime.securesms.keyvalue.SignalStore; +import org.thoughtcrime.securesms.net.Networking; import org.webrtc.PeerConnection; public final class NetworkUtil { @@ -124,7 +125,7 @@ private static boolean useLowDataCalling(@NonNull Context context, @NonNull Peer } public static NetworkInfo getNetworkInfo(@NonNull Context context) { - if (!org.thoughtcrime.securesms.net.Network.isEnabled()) return null; + if (!Networking.isEnabled()) return null; return ServiceUtil.getConnectivityManager(context).getActiveNetworkInfo(); } }