TF-297 Get stored language when launch app

This commit is contained in:
dab246
2022-07-08 15:09:57 +07:00
committed by Dat H. Pham
parent 53b9745992
commit cf4d05e3e1
7 changed files with 77 additions and 46 deletions
@@ -5,20 +5,20 @@ import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.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/save_language_app_state.dart';
import 'package:tmail_ui_user/features/manage_account/domain/state/save_language_state.dart';
class SaveLanguageAppInteractor {
class SaveLanguageInteractor {
final ManageAccountRepository manageAccountRepository;
SaveLanguageAppInteractor(this.manageAccountRepository);
SaveLanguageInteractor(this.manageAccountRepository);
Stream<Either<Failure, Success>> execute(Locale localeCurrent) async* {
try {
yield Right(SavingLanguageApp());
yield Right(SavingLanguage());
await manageAccountRepository.persistLanguage(localeCurrent);
yield Right(SaveLanguageAppSuccess());
yield Right(SaveLanguageSuccess(localeCurrent));
} catch (exception) {
yield Left(SaveLanguageAppFailure(exception));
yield Left(SaveLanguageFailure(exception));
}
}
}