mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 略微精简网络报错信息
This commit is contained in:
@@ -47,7 +47,9 @@ class ApiInterceptor extends Interceptor {
|
|||||||
String url = err.requestOptions.uri.toString();
|
String url = err.requestOptions.uri.toString();
|
||||||
print('🌹🌹ApiInterceptor: $url');
|
print('🌹🌹ApiInterceptor: $url');
|
||||||
// 屏蔽弹幕、心跳、人数请求的错误提示
|
// 屏蔽弹幕、心跳、人数请求的错误提示
|
||||||
if (!url.contains('heartbeat') && !url.contains('seg.so') && !url.contains('online/total')) {
|
if (!url.contains('heartbeat') &&
|
||||||
|
!url.contains('seg.so') &&
|
||||||
|
!url.contains('online/total')) {
|
||||||
SmartDialog.showToast(
|
SmartDialog.showToast(
|
||||||
await dioError(err) + url,
|
await dioError(err) + url,
|
||||||
displayType: SmartToastType.onlyRefresh,
|
displayType: SmartToastType.onlyRefresh,
|
||||||
@@ -75,7 +77,7 @@ class ApiInterceptor extends Interceptor {
|
|||||||
return '发送请求超时,请检查网络设置';
|
return '发送请求超时,请检查网络设置';
|
||||||
case DioExceptionType.unknown:
|
case DioExceptionType.unknown:
|
||||||
final String res = await checkConnect();
|
final String res = await checkConnect();
|
||||||
return '$res,${error.error} ${error.message} 网络异常!';
|
return '$res网络异常 ${error.error}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,17 +86,17 @@ class ApiInterceptor extends Interceptor {
|
|||||||
await Connectivity().checkConnectivity();
|
await Connectivity().checkConnectivity();
|
||||||
switch (connectivityResult) {
|
switch (connectivityResult) {
|
||||||
case ConnectivityResult.mobile:
|
case ConnectivityResult.mobile:
|
||||||
return '正在使用移动流量';
|
return '流量';
|
||||||
case ConnectivityResult.wifi:
|
case ConnectivityResult.wifi:
|
||||||
return '正在使用wifi';
|
return 'Wi-Fi';
|
||||||
case ConnectivityResult.ethernet:
|
case ConnectivityResult.ethernet:
|
||||||
return '正在使用局域网';
|
return '局域';
|
||||||
case ConnectivityResult.vpn:
|
case ConnectivityResult.vpn:
|
||||||
return '正在使用代理网络';
|
return '代理';
|
||||||
case ConnectivityResult.other:
|
case ConnectivityResult.other:
|
||||||
return '正在使用其他网络';
|
return '其他';
|
||||||
case ConnectivityResult.none:
|
case ConnectivityResult.none:
|
||||||
return '未连接到任何网络';
|
return '无';
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user