1
0
Эх сурвалжийг харах

fix: 删除权限 ACCESS_NETWORK_STATE, 解决个别机型重复申请问题

drake 2 жил өмнө
parent
commit
28b0dde9b9

+ 0 - 1
net/src/main/AndroidManifest.xml

@@ -4,7 +4,6 @@
     package="com.drake.net">
 
     <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 
     <application
         android:networkSecurityConfig="@xml/network_security_config"

+ 1 - 11
net/src/main/java/com/drake/net/interceptor/NetOkHttpInterceptor.kt

@@ -9,7 +9,6 @@ import com.drake.net.exception.*
 import com.drake.net.request.downloadListeners
 import com.drake.net.request.tagOf
 import com.drake.net.request.uploadListeners
-import com.drake.net.utils.isNetworking
 import okhttp3.CacheControl
 import okhttp3.Call
 import okhttp3.Interceptor
@@ -67,16 +66,7 @@ object NetOkHttpInterceptor : Interceptor {
         } catch (e: ConnectException) {
             throw NetConnectException(request, cause = e)
         } catch (e: UnknownHostException) {
-            val isNetworking = try {
-                NetConfig.app.isNetworking()
-            } catch (e: Exception) {
-                true
-            }
-            if (isNetworking) {
-                throw NetUnknownHostException(request, message = e.message)
-            } else {
-                throw NetworkingException(request)
-            }
+            throw NetUnknownHostException(request, message = e.message)
         } catch (e: NetException) {
             throw e
         } catch (e: Throwable) {

+ 0 - 1
net/src/main/java/com/drake/net/interfaces/NetErrorHandler.kt

@@ -22,7 +22,6 @@ interface NetErrorHandler {
             is UnknownHostException -> NetConfig.app.getString(R.string.net_host_error)
             is URLParseException -> NetConfig.app.getString(R.string.net_url_error)
             is NetConnectException -> NetConfig.app.getString(R.string.net_connect_error)
-            is NetworkingException -> NetConfig.app.getString(R.string.net_networking_error)
             is NetSocketTimeoutException -> NetConfig.app.getString(
                 R.string.net_connect_timeout_error,
                 e.message

+ 0 - 1
net/src/main/res/values/strings.xml

@@ -19,7 +19,6 @@
 
     <!--网络请求异常-->
     <string name="net_connect_error">连接网络失败</string>
-    <string name="net_networking_error">当前网络不可用</string>
     <string name="net_url_error">请求资源地址错误</string>
     <string name="net_host_error">无法找到指定服务器主机</string>
     <string name="net_connect_timeout_error">连接服务器超时,%s</string>