Display AI toggle in Composer
This commit is contained in:
@@ -54,6 +54,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/data/datasource_impl/se
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/repository/composer_cache_repository_impl.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/repository/composer_cache_repository.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/remove_composer_cache_by_id_on_web_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_ai_scribe_config_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/identities/identity_interactors_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/preferences/bindings/preferences_interactors_bindings.dart';
|
||||
@@ -338,6 +339,7 @@ class ComposerBindings extends BaseBindings {
|
||||
Get.find<PrintEmailInteractor>(tag: composerId),
|
||||
Get.find<ComposerRepository>(tag: composerId),
|
||||
Get.find<SaveTemplateEmailInteractor>(tag: composerId),
|
||||
Get.find<GetAIScribeConfigInteractor>(tag: composerId),
|
||||
composerId: composerId,
|
||||
composerArgs: composerArguments,
|
||||
), tag: composerId);
|
||||
|
||||
@@ -107,7 +107,10 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/update_text_formatting_menu_state_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/validate_premium_storage_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/draggable_app_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/model/preferences/ai_scribe_config.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_ai_scribe_config_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_identities_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_ai_scribe_config_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/identity_extension.dart';
|
||||
import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_controller.dart'
|
||||
@@ -161,6 +164,7 @@ class ComposerController extends BaseController
|
||||
final isMarkAsImportant = Rx<bool>(false);
|
||||
final isContentHeightExceeded = Rx<bool>(false);
|
||||
final editorTextSelection = Rxn<TextSelectionModel>();
|
||||
final _cachedAIScribeConfig = Rx<AIScribeConfig>(AIScribeConfig.initial());
|
||||
|
||||
final LocalFilePickerInteractor _localFilePickerInteractor;
|
||||
final LocalImagePickerInteractor _localImagePickerInteractor;
|
||||
@@ -179,6 +183,7 @@ class ComposerController extends BaseController
|
||||
final String? composerId;
|
||||
final ComposerArguments? composerArgs;
|
||||
final SaveTemplateEmailInteractor _saveTemplateEmailInteractor;
|
||||
final GetAIScribeConfigInteractor _getAIScribeConfigInteractor;
|
||||
|
||||
GetAllAutoCompleteInteractor? _getAllAutoCompleteInteractor;
|
||||
GetAutoCompleteInteractor? _getAutoCompleteInteractor;
|
||||
@@ -266,6 +271,8 @@ class ComposerController extends BaseController
|
||||
String get ownEmailAddress =>
|
||||
mailboxDashBoardController.ownEmailAddress.value;
|
||||
|
||||
AIScribeConfig get aiScribeConfig => _cachedAIScribeConfig.value;
|
||||
|
||||
late Worker uploadInlineImageWorker;
|
||||
late bool _isEmailBodyLoaded;
|
||||
|
||||
@@ -285,6 +292,7 @@ class ComposerController extends BaseController
|
||||
this.printEmailInteractor,
|
||||
this._composerRepository,
|
||||
this._saveTemplateEmailInteractor,
|
||||
this._getAIScribeConfigInteractor,
|
||||
{
|
||||
this.composerId,
|
||||
this.composerArgs,
|
||||
@@ -308,6 +316,11 @@ class ComposerController extends BaseController
|
||||
_beforeReconnectManager.addListener(onBeforeReconnect);
|
||||
_injectBinding();
|
||||
onKeyboardShortcutInit();
|
||||
_loadAIScribeConfig();
|
||||
}
|
||||
|
||||
void _loadAIScribeConfig() {
|
||||
consumeState(_getAIScribeConfigInteractor.execute());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -408,6 +421,8 @@ class ComposerController extends BaseController
|
||||
richTextMobileTabletController?.insertImage(inlineImage);
|
||||
}
|
||||
maxWithEditor = null;
|
||||
} else if (success is GetAIScribeConfigSuccess) {
|
||||
_cachedAIScribeConfig.value = success.aiScribeConfig;
|
||||
} else {
|
||||
super.handleSuccessViewState(success);
|
||||
}
|
||||
|
||||
@@ -5206,6 +5206,24 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribe": "AI Scribe",
|
||||
"@aiScribe": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribeSettingExplanation": "Utiliser l'IA pour vous aider à rédiger et améliorer vos e-mails",
|
||||
"@aiScribeSettingExplanation": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribeToggleDescription": "Activer AI Scribe",
|
||||
"@aiScribeToggleDescription": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"showMoreAttachmentButton": "Afficher les {count} autres pièces jointes",
|
||||
"@showMoreAttachmentButton": {
|
||||
"type": "text",
|
||||
|
||||
@@ -5124,6 +5124,24 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribe": "AI Scribe",
|
||||
"@aiScribe": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribeSettingExplanation": "Используйте ИИ для помощи в написании и улучшении ваших электронных писем",
|
||||
"@aiScribeSettingExplanation": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribeToggleDescription": "Включить AI Scribe",
|
||||
"@aiScribeToggleDescription": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"createANewRule": "Создать новое правило",
|
||||
"@createANewRule": {
|
||||
"type": "text",
|
||||
|
||||
@@ -5212,6 +5212,24 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribe": "AI Scribe",
|
||||
"@aiScribe": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribeSettingExplanation": "Sử dụng AI để giúp soạn thảo và cải thiện email của bạn",
|
||||
"@aiScribeSettingExplanation": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"aiScribeToggleDescription": "Bật AI Scribe",
|
||||
"@aiScribeToggleDescription": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"showMoreAttachmentButton": "Hiển thị +{count}",
|
||||
"@showMoreAttachmentButton": {
|
||||
"type": "text",
|
||||
|
||||
@@ -5139,6 +5139,27 @@ class AppLocalizations {
|
||||
);
|
||||
}
|
||||
|
||||
String get aiScribe {
|
||||
return Intl.message(
|
||||
'AI Scribe',
|
||||
name: 'aiScribe',
|
||||
);
|
||||
}
|
||||
|
||||
String get aiScribeSettingExplanation {
|
||||
return Intl.message(
|
||||
'Use AI to help write and improve your emails',
|
||||
name: 'aiScribeSettingExplanation',
|
||||
);
|
||||
}
|
||||
|
||||
String get aiScribeToggleDescription {
|
||||
return Intl.message(
|
||||
'Enable AI Scribe',
|
||||
name: 'aiScribeToggleDescription',
|
||||
);
|
||||
}
|
||||
|
||||
String showMoreAttachmentButton(int count) {
|
||||
return Intl.message(
|
||||
'Show +$count more',
|
||||
|
||||
Reference in New Issue
Block a user