Do not display AI scribe if AI is not enabled in env.file

This commit is contained in:
Théo Poizat
2025-12-09 08:05:05 +01:00
committed by Dat H. Pham
parent bb23792fe3
commit 2f3bbe3bbb
3 changed files with 15 additions and 6 deletions
@@ -470,8 +470,8 @@ class ComposerView extends GetWidget<ComposerController> {
sendMessageAction: () => controller.handleClickSendButton(context),
requestReadReceiptAction: () => controller.toggleRequestReadReceipt(context),
toggleMarkAsImportantAction: () => controller.toggleMarkAsImportant(context),
onOpenAIScribe: () => controller.showAIScribeMenuForFullText(context),
aiScribeButtonKey: controller.aiScribeButtonKey,
onOpenAIScribe: AIConfig.isAiEnabled ? () => controller.showAIScribeMenuForFullText(context) : null,
aiScribeButtonKey: AIConfig.isAiEnabled ? controller.aiScribeButtonKey : null,
)),
]
)
@@ -556,6 +556,10 @@ class ComposerView extends GetWidget<ComposerController> {
}
Widget _buildAIScribeSelectionButton(BuildContext context) {
if (!AIConfig.isAiEnabled) {
return const SizedBox.shrink();
}
return Obx(() {
if (controller.hasTextSelection.value &&
controller.textSelectionCoordinates.value != null) {
@@ -560,8 +560,8 @@ class ComposerView extends GetWidget<ComposerController> {
toggleMarkAsImportantAction: () => controller.toggleMarkAsImportant(context),
saveAsTemplateAction: () => controller.handleClickSaveAsTemplateButton(context),
onOpenInsertLink: controller.openInsertLink,
onOpenAIScribe: () => controller.showAIScribeMenuForFullText(context),
aiScribeButtonKey: controller.aiScribeButtonKey,
onOpenAIScribe: AIConfig.isAiEnabled ? () => controller.showAIScribeMenuForFullText(context) : null,
aiScribeButtonKey: AIConfig.isAiEnabled ? controller.aiScribeButtonKey : null,
)),
],
),
@@ -836,8 +836,8 @@ class ComposerView extends GetWidget<ComposerController> {
toggleMarkAsImportantAction: () => controller.toggleMarkAsImportant(context),
saveAsTemplateAction: () => controller.handleClickSaveAsTemplateButton(context),
onOpenInsertLink: controller.openInsertLink,
onOpenAIScribe: () => controller.showAIScribeMenuForFullText(context),
aiScribeButtonKey: controller.aiScribeButtonKey,
onOpenAIScribe: AIConfig.isAiEnabled ? () => controller.showAIScribeMenuForFullText(context) : null,
aiScribeButtonKey: AIConfig.isAiEnabled ? controller.aiScribeButtonKey : null,
)),
],
),
@@ -958,6 +958,10 @@ class ComposerView extends GetWidget<ComposerController> {
}
Widget _buildAIScribeSelectionButton(BuildContext context) {
if (!AIConfig.isAiEnabled) {
return const SizedBox.shrink();
}
return Obx(() {
if (controller.hasTextSelection.value &&
controller.textSelectionCoordinates.value != null) {
+1
View File
@@ -8,3 +8,4 @@ export 'scribe/ai/presentation/model/ai_action.dart';
export 'scribe/ai/presentation/model/ai_scribe_menu_action.dart';
export 'scribe/ai/data/repository/ai_repository_impl.dart';
export 'scribe/ai/data/datasource/ai_datasource.dart';
export 'scribe/ai/data/config/ai_config.dart';