@@ -25,7 +25,7 @@ object Network {
25
25
*/
26
26
fun isConnected (context : Context ): Boolean {
27
27
val info = Network .getNetworkInfo(context)
28
- return info != null && info.isConnected
28
+ return info ?. isConnected ? : false
29
29
}
30
30
31
31
/* *
@@ -37,8 +37,8 @@ object Network {
37
37
*/
38
38
fun isConnectedWifi (context : Context ): Boolean {
39
39
val info = Network .getNetworkInfo(context)
40
- return info != null && info.isConnected &&
41
- info. type == ConnectivityManager .TYPE_WIFI
40
+ return info ?. isConnected ? : false &&
41
+ info ?. type == ConnectivityManager .TYPE_WIFI
42
42
}
43
43
44
44
/* *
@@ -50,8 +50,8 @@ object Network {
50
50
*/
51
51
fun isConnectedMobile (context : Context ): Boolean {
52
52
val info = Network .getNetworkInfo(context)
53
- return info != null && info.isConnected &&
54
- info. type == ConnectivityManager .TYPE_MOBILE
53
+ return info ?. isConnected ? : false &&
54
+ info ?. type == ConnectivityManager .TYPE_MOBILE
55
55
}
56
56
57
57
/* *
@@ -62,8 +62,8 @@ object Network {
62
62
*/
63
63
fun isConnectedFast (context : Context ): Boolean {
64
64
val info = Network .getNetworkInfo(context)
65
- return info != null && info.isConnected &&
66
- Network .isConnectionFast(info. type, info.subtype)
65
+ return info ?. isConnected ? : false &&
66
+ Network .isConnectionFast(info !! . type, info.subtype)
67
67
}
68
68
69
69
/* *
0 commit comments