TF-2271 Implement dns lookup to get jmap url

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 7b0c0015a15a243b6b4aef3d78e7653d556ad109)
This commit is contained in:
dab246
2023-11-10 17:06:50 +07:00
committed by Dat Vu
parent c0bef69435
commit 9b661b0688
33 changed files with 773 additions and 483 deletions
@@ -18,6 +18,7 @@ import 'package:tmail_ui_user/features/login/data/local/token_oidc_cache_manager
import 'package:tmail_ui_user/features/login/data/network/authentication_client/authentication_client_base.dart';
import 'package:tmail_ui_user/features/login/data/network/config/authorization_interceptors.dart';
import 'package:tmail_ui_user/features/login/data/network/config/time_out_interceptors.dart';
import 'package:tmail_ui_user/features/login/data/network/dns_service.dart';
import 'package:tmail_ui_user/features/login/data/network/oidc_http_client.dart';
import 'package:tmail_ui_user/features/login/data/utils/library_platform/app_auth_plugin/app_auth_plugin.dart';
import 'package:tmail_ui_user/features/mailbox/data/network/mailbox_api.dart';
@@ -41,6 +42,7 @@ class NetworkBindings extends Bindings {
_bindingDio();
_bindingApi();
_bindingTransformer();
_bindingServices();
_bindingException();
}
@@ -119,4 +121,8 @@ class NetworkBindings extends Bindings {
Get.put(HtmlTransform(Get.find<DioClient>(), Get.find<HtmlEscape>()));
Get.put(HtmlAnalyzer(Get.find<HtmlTransform>()));
}
void _bindingServices() {
Get.put(DNSService());
}
}
@@ -3610,4 +3610,18 @@ class AppLocalizations {
name: 'notFoundSession',
);
}
String get dnsLookupLoginMessage {
return Intl.message(
'To login and access your message please enter your email',
name: 'dnsLookupLoginMessage'
);
}
String get enterYourPasswordToSignIn {
return Intl.message(
'Enter your password to sign in',
name: 'enterYourPasswordToSignIn'
);
}
}
+36
View File
@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
import 'package:tmail_ui_user/features/login/data/network/oidc_error.dart';
import 'package:tmail_ui_user/features/login/domain/exceptions/authentication_exception.dart';
import 'package:tmail_ui_user/main/exceptions/remote_exception.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
class MessageToastUtils {
static String? getMessageByException(BuildContext context, dynamic exception) {
if (exception is CanNotFoundBaseUrl) {
return AppLocalizations.of(context).requiredUrl;
} else if (exception is CanNotFoundUserName) {
return AppLocalizations.of(context).requiredEmail;
} else if (exception is CanNotFoundPassword) {
return AppLocalizations.of(context).requiredPassword;
} else if (exception is CanNotFoundOIDCLinks) {
return AppLocalizations.of(context).ssoNotAvailable;
} else if (exception is CanNotFoundToken) {
return AppLocalizations.of(context).canNotGetToken;
} else if (exception is ConnectionTimeout || exception is BadGateway || exception is SocketError) {
return AppLocalizations.of(context).wrongUrlMessage;
} else if (exception is BadCredentialsException) {
return AppLocalizations.of(context).badCredentials;
} else if (exception is ConnectionError) {
return AppLocalizations.of(context).connectionError;
} else if (exception is UnknownError && exception.message != null) {
return '[${exception.code ?? ''}] ${exception.message}';
} else if (exception is NotFoundSessionException) {
return AppLocalizations.of(context).notFoundSession;
} else {
return null;
}
}
}