Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: internet issue: adding error type, remove unnecessary interceptor #1790

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/util/dio_interceptors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'dart:convert';
import 'package:autonomy_flutter/common/environment.dart';
import 'package:autonomy_flutter/common/injector.dart';
import 'package:autonomy_flutter/gateway/iap_api.dart';
import 'package:autonomy_flutter/main.dart';
import 'package:autonomy_flutter/model/ff_account.dart';
import 'package:autonomy_flutter/service/auth_service.dart';
import 'package:autonomy_flutter/service/network_issue_manager.dart';
Expand Down Expand Up @@ -244,7 +245,7 @@ class HmacAuthInterceptor extends Interceptor {
class ConnectingExceptionInterceptor extends Interceptor {
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
if (err.isNetworkIssue) {
if (err.isNetworkIssue && memoryValues.isForeground) {
log.warning('ConnectingExceptionInterceptor timeout');
unawaited(injector<NetworkIssueManager>().showNetworkIssueWarning());
}
Expand Down
3 changes: 0 additions & 3 deletions lib/util/dio_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'package:sentry_flutter/sentry_flutter.dart';
Dio feralFileDio(BaseOptions options) {
final dio = baseDio(options);
dio.interceptors.add(FeralfileAuthInterceptor());
dio.interceptors.add(ConnectingExceptionInterceptor());
return dio;
}

Expand All @@ -32,7 +31,6 @@ Dio postcardDio(BaseOptions options) {
final dio = baseDio(options);
dio.interceptors.add(HmacAuthInterceptor(Environment.auClaimSecretKey));
dio.interceptors.add(AutonomyAuthInterceptor());
dio.interceptors.add(ConnectingExceptionInterceptor());
return dio;
}

Expand All @@ -47,7 +45,6 @@ Dio tvCastDio(BaseOptions options) {
Dio chatDio(BaseOptions options) {
final dio = baseDio(options);
dio.interceptors.add(HmacAuthInterceptor(Environment.chatServerHmacKey));
dio.interceptors.add(ConnectingExceptionInterceptor());
return dio;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/util/exception_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ extension ExceptionExt on Exception {
if (this is DioException) {
final e = this as DioException;
return e.type == DioExceptionType.connectionError ||
e.type == DioExceptionType.connectionTimeout ||
e.type == DioExceptionType.sendTimeout ||
e.type == DioExceptionType.receiveTimeout ||
e.error is SocketException;
}
if (this is TezartNodeError) {
Expand Down
Loading