From d45123d53e442b0cd69be739e3cf6ad5b5e07718 Mon Sep 17 00:00:00 2001 From: Madhur Gupta <30932899+madhurgupta10@users.noreply.github.com> Date: Tue, 28 Jun 2022 08:41:09 +0530 Subject: [PATCH] Remove network type information from NetworkUtils (#4996) * Remove network type information from NetworkUtils * Ignore dependent tests --- app/src/main/java/fr/free/nrw/commons/utils/NetworkUtils.java | 4 ++++ .../kotlin/fr/free/nrw/commons/utils/NetworkUtilsTest.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/utils/NetworkUtils.java b/app/src/main/java/fr/free/nrw/commons/utils/NetworkUtils.java index 59e38f0c9..ce64cb031 100644 --- a/app/src/main/java/fr/free/nrw/commons/utils/NetworkUtils.java +++ b/app/src/main/java/fr/free/nrw/commons/utils/NetworkUtils.java @@ -49,6 +49,8 @@ public class NetworkUtils { return NetworkConnectionType.WIFI; } + // TODO for Android 12+ request permission from user is mandatory + /* int mobileNetwork = telephonyManager.getNetworkType(); switch (mobileNetwork) { case TelephonyManager.NETWORK_TYPE_GPRS: @@ -71,6 +73,8 @@ public class NetworkUtils { default: return NetworkConnectionType.UNKNOWN; } + */ + return NetworkConnectionType.UNKNOWN; } /** diff --git a/app/src/test/kotlin/fr/free/nrw/commons/utils/NetworkUtilsTest.java b/app/src/test/kotlin/fr/free/nrw/commons/utils/NetworkUtilsTest.java index 32a8791ab..13f4c4b9a 100644 --- a/app/src/test/kotlin/fr/free/nrw/commons/utils/NetworkUtilsTest.java +++ b/app/src/test/kotlin/fr/free/nrw/commons/utils/NetworkUtilsTest.java @@ -8,6 +8,7 @@ import android.telephony.TelephonyManager; import org.jetbrains.annotations.NotNull; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import fr.free.nrw.commons.utils.model.NetworkConnectionType; @@ -97,6 +98,7 @@ public class NetworkUtilsTest { } @Test + @Ignore("Fix these test with telemetry permission") public void testCellular2GNetwork() { Context mockContext = mock(Context.class); Application mockApplication = mock(Application.class); @@ -123,6 +125,7 @@ public class NetworkUtilsTest { } @Test + @Ignore("Fix these test with telemetry permission") public void testCellular3GNetwork() { Context mockContext = mock(Context.class); Application mockApplication = mock(Application.class); @@ -149,6 +152,7 @@ public class NetworkUtilsTest { } @Test + @Ignore("Fix these test with telemetry permission") public void testCellular4GNetwork() { Context mockContext = mock(Context.class); Application mockApplication = mock(Application.class);