TF-3977 Add disable spam banner in preferences setting
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/preferences/preferences_root.dart';
|
||||
|
||||
abstract class ManageAccountRepository {
|
||||
Future<void> persistLanguage(Locale localeCurrent);
|
||||
|
||||
Future<void> updateLocalSettings(
|
||||
Map<SupportedLocalSetting, LocalSettingOptions?> localSettings,
|
||||
);
|
||||
Future<void> updateLocalSettings(PreferencesRoot preferencesRoot);
|
||||
|
||||
Future<Map<SupportedLocalSetting, LocalSettingOptions?>> getLocalSettings(
|
||||
List<SupportedLocalSetting> supportedLocalSettings,
|
||||
);
|
||||
}
|
||||
Future<PreferencesRoot> getLocalSettings();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/preferences/preferences_root.dart';
|
||||
|
||||
class GettingLocalSettingsState extends LoadingState {}
|
||||
|
||||
class GetLocalSettingsSuccess extends UIState {
|
||||
GetLocalSettingsSuccess(this.localSettings);
|
||||
GetLocalSettingsSuccess(this.preferencesRoot);
|
||||
|
||||
final Map<SupportedLocalSetting, LocalSettingOptions?> localSettings;
|
||||
final PreferencesRoot preferencesRoot;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [localSettings];
|
||||
List<Object?> get props => [preferencesRoot];
|
||||
}
|
||||
|
||||
class GetLocalSettingsFailure extends FeatureFailure {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/preferences/preferences_root.dart';
|
||||
|
||||
class UpdatingLocalSettingsState extends LoadingState {}
|
||||
|
||||
class UpdateLocalSettingsSuccess extends UIState {
|
||||
final Map<SupportedLocalSetting, LocalSettingOptions?> localSettings;
|
||||
final PreferencesRoot preferencesRoot;
|
||||
|
||||
UpdateLocalSettingsSuccess(this.localSettings);
|
||||
UpdateLocalSettingsSuccess(this.preferencesRoot);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [localSettings];
|
||||
List<Object?> get props => [preferencesRoot];
|
||||
}
|
||||
|
||||
class UpdateLocalSettingsFailure extends FeatureFailure {
|
||||
|
||||
@@ -4,19 +4,16 @@ import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_local_settings_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
|
||||
class GetLocalSettingsInteractor {
|
||||
const GetLocalSettingsInteractor(this._manageAccountRepository);
|
||||
|
||||
final ManageAccountRepository _manageAccountRepository;
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
List<SupportedLocalSetting> supportedLocalSettings,
|
||||
) async* {
|
||||
Stream<Either<Failure, Success>> execute() async* {
|
||||
try {
|
||||
yield Right(GettingLocalSettingsState());
|
||||
final result = await _manageAccountRepository.getLocalSettings(supportedLocalSettings);
|
||||
final result = await _manageAccountRepository.getLocalSettings();
|
||||
yield Right(GetLocalSettingsSuccess(result));
|
||||
} catch (e) {
|
||||
logError('$runtimeType::execute(): exception: $e');
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/update_local_settings_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/preferences/preferences_root.dart';
|
||||
|
||||
class UpdateLocalSettingsInteractor {
|
||||
const UpdateLocalSettingsInteractor(this._manageAccountRepository);
|
||||
@@ -12,12 +12,12 @@ class UpdateLocalSettingsInteractor {
|
||||
final ManageAccountRepository _manageAccountRepository;
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
Map<SupportedLocalSetting, LocalSettingOptions?> localSettings,
|
||||
PreferencesRoot preferencesRoot,
|
||||
) async* {
|
||||
try {
|
||||
yield Right(UpdatingLocalSettingsState());
|
||||
await _manageAccountRepository.updateLocalSettings(localSettings);
|
||||
yield Right(UpdateLocalSettingsSuccess(localSettings));
|
||||
await _manageAccountRepository.updateLocalSettings(preferencesRoot);
|
||||
yield Right(UpdateLocalSettingsSuccess(preferencesRoot));
|
||||
} catch (e) {
|
||||
logError('$runtimeType::execute(): exception: $e');
|
||||
yield Left(UpdateLocalSettingsFailure(exception: e));
|
||||
|
||||
Reference in New Issue
Block a user