TF-2215 Remove LocaleInterceptor
This commit is contained in:
@@ -36,7 +36,6 @@ import 'package:tmail_ui_user/features/server_settings/data/network/server_setti
|
|||||||
import 'package:tmail_ui_user/features/thread/data/network/thread_api.dart';
|
import 'package:tmail_ui_user/features/thread/data/network/thread_api.dart';
|
||||||
import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart';
|
import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart';
|
||||||
import 'package:tmail_ui_user/main/exceptions/send_email_exception_thrower.dart';
|
import 'package:tmail_ui_user/main/exceptions/send_email_exception_thrower.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/locale_interceptor.dart';
|
|
||||||
import 'package:tmail_ui_user/main/utils/ios_sharing_manager.dart';
|
import 'package:tmail_ui_user/main/utils/ios_sharing_manager.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
@@ -90,13 +89,11 @@ class NetworkBindings extends Bindings {
|
|||||||
Get.find<AccountCacheManager>(),
|
Get.find<AccountCacheManager>(),
|
||||||
Get.find<IOSSharingManager>(),
|
Get.find<IOSSharingManager>(),
|
||||||
));
|
));
|
||||||
Get.put(LocaleInterceptor());
|
|
||||||
Get.find<Dio>().interceptors.add(Get.find<DynamicUrlInterceptors>());
|
Get.find<Dio>().interceptors.add(Get.find<DynamicUrlInterceptors>());
|
||||||
Get.find<Dio>().interceptors.add(Get.find<AuthorizationInterceptors>());
|
Get.find<Dio>().interceptors.add(Get.find<AuthorizationInterceptors>());
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
Get.find<Dio>().interceptors.add(LogInterceptor(requestBody: true));
|
Get.find<Dio>().interceptors.add(LogInterceptor(requestBody: true));
|
||||||
}
|
}
|
||||||
Get.find<Dio>().interceptors.add(Get.find<LocaleInterceptor>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _bindingApi() {
|
void _bindingApi() {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import 'package:tmail_ui_user/features/mailbox/data/network/mailbox_isolate_work
|
|||||||
import 'package:tmail_ui_user/features/thread/data/network/thread_api.dart';
|
import 'package:tmail_ui_user/features/thread/data/network/thread_api.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/data/network/thread_isolate_worker.dart';
|
import 'package:tmail_ui_user/features/thread/data/network/thread_isolate_worker.dart';
|
||||||
import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart';
|
import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/locale_interceptor.dart';
|
|
||||||
import 'package:tmail_ui_user/main/utils/ios_sharing_manager.dart';
|
import 'package:tmail_ui_user/main/utils/ios_sharing_manager.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:worker_manager/worker_manager.dart';
|
import 'package:worker_manager/worker_manager.dart';
|
||||||
@@ -51,7 +50,6 @@ class NetworkIsolateBindings extends Bindings {
|
|||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
dio.interceptors.add(LogInterceptor(requestBody: true));
|
dio.interceptors.add(LogInterceptor(requestBody: true));
|
||||||
}
|
}
|
||||||
dio.interceptors.add(Get.find<LocaleInterceptor>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _bindingApi() {
|
void _bindingApi() {
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:core/utils/app_logger.dart';
|
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:tmail_ui_user/main/localizations/localization_service.dart';
|
|
||||||
|
|
||||||
class LocaleInterceptor extends InterceptorsWrapper {
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
|
||||||
final currentLocale = LocalizationService.getLocaleFromLanguage();
|
|
||||||
log('LocaleInterceptor::onRequest:currentLocale: $currentLocale');
|
|
||||||
options.headers[HttpHeaders.acceptLanguageHeader] = LocalizationService.supportedLocalesToLanguageTags();
|
|
||||||
options.headers[HttpHeaders.contentLanguageHeader] = currentLocale.toLanguageTag();
|
|
||||||
super.onRequest(options, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user