Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mtotschnig committed Oct 27, 2024
1 parent bbdc7bb commit debba64
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import android.app.Service
import android.content.ContentResolver
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.NetworkCapabilities.TRANSPORT_CELLULAR
import android.net.NetworkCapabilities.TRANSPORT_VPN
import android.net.NetworkCapabilities.TRANSPORT_WIFI
import android.net.Uri
import android.net.wifi.WifiManager
Expand Down Expand Up @@ -38,9 +39,9 @@ fun getConnectionType(context: Context) =
private fun ConnectivityManager.getConnectionType23(): Int =
getNetworkCapabilities(activeNetwork)?.run {
when {
hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> 2
hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> 1
hasTransport(NetworkCapabilities.TRANSPORT_VPN) -> 3
hasTransport(TRANSPORT_WIFI) -> 2
hasTransport(TRANSPORT_CELLULAR) -> 1
hasTransport(TRANSPORT_VPN) -> 3
else -> 0
}
} ?: 0
Expand Down

0 comments on commit debba64

Please sign in to comment.