Remove unnecessary local bindings when global binding did
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import 'package:core/data/network/config/dynamic_url_interceptors.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/network/config/authorization_interceptors.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/exceptions/authentication_exception.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/usecases/delete_authority_oidc_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/usecases/delete_credential_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/usecases/get_authenticated_account_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/usecases/update_authentication_account_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oidc_interactor.dart';
|
||||
@@ -23,10 +21,6 @@ import 'package:tmail_ui_user/main/routes/route_utils.dart';
|
||||
|
||||
class SessionController extends ReloadableController {
|
||||
final GetSessionInteractor _getSessionInteractor;
|
||||
final DeleteCredentialInteractor _deleteCredentialInteractor;
|
||||
final CachingManager _cachingManager;
|
||||
final DeleteAuthorityOidcInteractor _deleteAuthorityOidcInteractor;
|
||||
final AuthorizationInterceptors _authorizationInterceptors;
|
||||
final AppToast _appToast;
|
||||
final DynamicUrlInterceptors _dynamicUrlInterceptors;
|
||||
|
||||
@@ -36,15 +30,9 @@ class SessionController extends ReloadableController {
|
||||
GetAuthenticatedAccountInteractor getAuthenticatedAccountInteractor,
|
||||
UpdateAuthenticationAccountInteractor updateAuthenticationAccountInteractor,
|
||||
this._getSessionInteractor,
|
||||
this._deleteCredentialInteractor,
|
||||
this._cachingManager,
|
||||
this._deleteAuthorityOidcInteractor,
|
||||
this._authorizationInterceptors,
|
||||
this._appToast,
|
||||
this._dynamicUrlInterceptors,
|
||||
) : super(
|
||||
logoutOidcInteractor,
|
||||
deleteAuthorityOidcInteractor,
|
||||
getAuthenticatedAccountInteractor,
|
||||
updateAuthenticationAccountInteractor
|
||||
);
|
||||
@@ -80,10 +68,13 @@ class SessionController extends ReloadableController {
|
||||
}
|
||||
|
||||
void _handleSessionFailure(Failure failure) {
|
||||
log('SessionController::_handleSessionFailure(): $failure');
|
||||
if (failure is GetSessionFailure) {
|
||||
final sessionException = failure.exception;
|
||||
if (_checkUrlError(sessionException) && currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).wrongUrlMessage);
|
||||
} else if (sessionException is BadCredentialsException && currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).badCredentials);
|
||||
} else if (sessionException is UnknownError && currentContext != null) {
|
||||
if (sessionException.message != null) {
|
||||
_appToast.showErrorToast('[${sessionException.code}] ${sessionException.message}');
|
||||
@@ -100,11 +91,11 @@ class SessionController extends ReloadableController {
|
||||
|
||||
void _goToLogin() async {
|
||||
await Future.wait([
|
||||
_deleteCredentialInteractor.execute(),
|
||||
_deleteAuthorityOidcInteractor.execute(),
|
||||
_cachingManager.clearAll()
|
||||
deleteCredentialInteractor.execute(),
|
||||
deleteAuthorityOidcInteractor.execute(),
|
||||
cachingManager.clearAll()
|
||||
]);
|
||||
_authorizationInterceptors.clear();
|
||||
authorizationInterceptors.clear();
|
||||
pushAndPopAll(AppRoutes.login);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user