Interactor getAIScribeConfig
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/model/preferences/ai_scribe_config.dart';
|
||||
|
||||
class GettingAIScribeConfigState extends LoadingState {}
|
||||
|
||||
class GetAIScribeConfigSuccess extends UIState {
|
||||
GetAIScribeConfigSuccess(this.aiScribeConfig);
|
||||
|
||||
final AIScribeConfig aiScribeConfig;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [aiScribeConfig];
|
||||
}
|
||||
|
||||
class GetAIScribeConfigFailure extends FeatureFailure {
|
||||
GetAIScribeConfigFailure({super.exception});
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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/get_ai_scribe_config_state.dart';
|
||||
|
||||
class GetAIScribeConfigInteractor {
|
||||
const GetAIScribeConfigInteractor(this._manageAccountRepository);
|
||||
|
||||
final ManageAccountRepository _manageAccountRepository;
|
||||
|
||||
Stream<Either<Failure, Success>> execute() async* {
|
||||
try {
|
||||
yield Right(GettingAIScribeConfigState());
|
||||
final preferencesSetting = await _manageAccountRepository.getLocalSettings();
|
||||
yield Right(GetAIScribeConfigSuccess(preferencesSetting.aiScribeConfig));
|
||||
} catch (e) {
|
||||
yield Left(GetAIScribeConfigFailure(exception: e));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user