Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[auth] Upgrade dio

Aman Raj Singh Mourya8fe9b9571a0c
diff --git a/auth/lib/core/network.dart b/auth/lib/core/network.dart
index c14c9e758b..0f5ae3555d 100644
--- a/auth/lib/core/network.dart
+++ b/auth/lib/core/network.dart
@@ -8,6 +8,7 @@ import 'package:ente_auth/utils/package_info_util.dart';
import 'package:ente_auth/utils/platform_util.dart';
import 'package:fk_user_agent/fk_user_agent.dart';
import 'package:flutter/foundation.dart';
+import 'package:native_dio_adapter/native_dio_adapter.dart';
import 'package:uuid/uuid.dart';
int kConnectTimeout = 15000;
@@ -50,6 +51,10 @@ class Network {
},
),
);
+
+ _dio.httpClientAdapter = NativeAdapter();
+ _enteDio.httpClientAdapter = NativeAdapter();
+
_setupInterceptors(endpoint);
Bus.instance.on<EndpointUpdatedEvent>().listen((event) {
diff --git a/auth/lib/ui/account/login_pwd_verification_page.dart b/auth/lib/ui/account/login_pwd_verification_page.dart
index d5ae7a3dbc..6d43988e2c 100644
--- a/auth/lib/ui/account/login_pwd_verification_page.dart
+++ b/auth/lib/ui/account/login_pwd_verification_page.dart
@@ -113,7 +113,7 @@ class _LoginPasswordVerificationPageState
);
} else {
_logger.severe('API failure during SRP login', e, s);
- if (e.type == DioExceptionType.unknown) {
+ if (e.type == DioExceptionType.connectionError) {
await _showContactSupportDialog(
context,
context.l10n.noInternetConnection,
diff --git a/auth/lib/utils/dialog_util.dart b/auth/lib/utils/dialog_util.dart
index f747b41f4d..1f64414f8f 100644
--- a/auth/lib/utils/dialog_util.dart
+++ b/auth/lib/utils/dialog_util.dart
@@ -113,12 +113,12 @@ String parseErrorForUI(
if (dioError.response?.data["code"] != null) {
errorInfo = "Reason: ${dioError.response!.data["code"]}";
} else {
- errorInfo = "Reason: ${dioError.response!.data}";
+ errorInfo = "Reason: ${dioError.response!.data.toString()}";
}
- } else if (dioError.type == DioExceptionType.unknown) {
- errorInfo = "Reason: $dioError.error";
+ } else if (dioError.type == DioExceptionType.badCertificate) {
+ errorInfo = "Reason: ${dioError.error.toString()}";
} else {
- errorInfo = "Reason: $dioError.type";
+ errorInfo = "Reason: ${dioError.type.toString()}";
}
} else {
if (kDebugMode) {