TF-4193 Fix all Nitpick comments from coderabbit

This commit is contained in:
dab246
2025-12-10 12:10:17 +07:00
committed by Dat H. Pham
parent ef2ab39a3a
commit 6b1c7e23dc
33 changed files with 20 additions and 91 deletions
@@ -40,10 +40,7 @@ class DownloadDatasourceImpl extends DownloadDatasource {
onReceiveController: onReceiveController,
cancelToken: cancelToken,
);
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
@override
@@ -67,9 +64,6 @@ class DownloadDatasourceImpl extends DownloadDatasource {
onReceiveController: onReceiveController,
cancelToken: cancelToken,
);
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -14,19 +14,13 @@ class LabelDatasourceImpl extends LabelDatasource {
Future<List<Label>> getAllLabels(AccountId accountId) {
return Future.sync(() async {
return await _labelApi.getAllLabels(accountId);
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<Label> createNewLabel(AccountId accountId, Label labelData) {
return Future.sync(() async {
return await _labelApi.createNewLabel(accountId, labelData);
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -180,9 +180,6 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
Future<OidcUserInfo> fetchUserInfo(String userInfoEndpoint) {
return Future.sync(() async {
return await _oidcHttpClient.fetchUserInfo(userInfoEndpoint);
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:tmail_ui_user/features/login/domain/repository/credential_repository.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -187,9 +187,6 @@ class MailboxDataSourceImpl extends MailboxDataSource {
onProgressController: onProgressController,
);
}
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:core/utils/app_logger.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -82,22 +82,16 @@ class ManageAccountDataSourceImpl extends ManageAccountDataSource {
@override
Future<bool> getLabelVisibility() {
return Future.sync(() async {
return await _settingCacheManager.getLabelVisibility();
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
return Future.sync(() {
return _settingCacheManager.getLabelVisibility();
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> saveLabelVisibility(bool visible) {
return Future.sync(() async {
return await _settingCacheManager.saveLabelVisibility(visible);
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
@override
@@ -105,9 +99,6 @@ class ManageAccountDataSourceImpl extends ManageAccountDataSource {
return Future.sync(() async {
final labelConfig = await _preferencesSettingManager.getLabelConfig();
return labelConfig.isEnabled;
}).catchError((error, stackTrace) async {
await _exceptionThrower.throwException(error, stackTrace);
throw error;
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -7,8 +7,7 @@ class SettingCacheManager {
final SharedPreferences _sharedPreferences;
Future<bool> getLabelVisibility() async {
await _sharedPreferences.reload();
bool getLabelVisibility() {
return _sharedPreferences.getBool(_labelVisibilitySettingKey) ?? false;
}
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -13,8 +13,8 @@ class GetLabelSettingStateInteractor {
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
try {
yield Right(GettingLabelSettingState());
final isEnable = await _manageAccountRepository.getLabelSettingState();
yield Right(GetLabelSettingStateSuccess(isEnable, accountId));
final isEnabled = await _manageAccountRepository.getLabelSettingState();
yield Right(GetLabelSettingStateSuccess(isEnabled, accountId));
} catch (e) {
yield Left(GetLabelSettingStateFailure(e));
}
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -1,4 +1,3 @@
import 'dart:core';
import 'dart:ui';
import 'package:core/presentation/state/failure.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:core/utils/app_logger.dart';
@@ -1,5 +1,3 @@
import 'dart:core';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart';
@@ -18,7 +18,7 @@ extension HandleSetupLabelVisibilityInSettingExtension
}
void enableLabelVisibility() {
isLabelVisibility.value = true;
isLabelVisibilityEnabled.value = true;
saveLabelVisibilityInteractor = getBinding<SaveLabelVisibilityInteractor>();
if (saveLabelVisibilityInteractor != null) {
@@ -41,6 +41,6 @@ extension HandleSetupLabelVisibilityInSettingExtension
}
void handleGetLabelVisibilitySuccess(bool visible) {
isLabelVisibility.value = visible;
isLabelVisibilityEnabled.value = visible;
}
}
@@ -77,7 +77,7 @@ class ManageAccountDashBoardController extends ReloadableController
final vacationResponse = Rxn<VacationResponse>();
final dashboardSettingAction = Rxn<UIAction>();
final octetsQuota = Rxn<Quota>();
final isLabelVisibility = RxBool(false);
final isLabelVisibilityEnabled = RxBool(false);
Uri? previousUri;
AccountMenuItem? selectedMenu;
@@ -32,7 +32,7 @@ class SettingsView extends GetWidget<SettingsController> {
Obx(() {
final labelVisibility = controller
.manageAccountDashboardController
.isLabelVisibility
.isLabelVisibilityEnabled
.value;
final isLabelCapabilitySupported = controller
.manageAccountDashboardController
@@ -55,7 +55,7 @@ class PreferencesView extends GetWidget<PreferencesController> with AppLoaderMix
Obx(
() {
final labelVisibility = controller
.accountDashboardController.isLabelVisibility.value;
.accountDashboardController.isLabelVisibilityEnabled.value;
final isLabelCapabilitySupported = controller
.accountDashboardController
@@ -79,7 +79,7 @@ class PreferencesView extends GetWidget<PreferencesController> with AppLoaderMix
final localSettingOption = controller.localSettings.value;
final isLabelVisibility = controller
.accountDashboardController
.isLabelVisibility;
.isLabelVisibilityEnabled;
if (settingOption == null &&
localSettingOption.configs.isEmpty) {