Added instructions for tooltips

This commit is contained in:
Kelrap 2024-06-07 13:29:51 -04:00
parent ddb17cb038
commit 4f692a03b8
6 changed files with 47 additions and 5 deletions

View file

@ -3951,5 +3951,8 @@
"leaveRoomDescription": "The chat will be moved to the archive. Other users will be able to see that you have left the chat.",
"archiveSpaceDescription": "All chats within this space will be moved to the archive for yourself and other non-admin users.",
"leaveSpaceDescription": "All chats within this space will be moved to the archive. Other users will be able to see that you have left the space.",
"onlyAdminDescription": "Since there are no other admins, all other participants will also be removed."
"onlyAdminDescription": "Since there are no other admins, all other participants will also be removed.",
"tooltipInstructionsTitle": "Not sure what that does?",
"tooltipInstructionsMobileBody": "Press and hold items to view tooltips.",
"tooltipInstructionsBrowserBody": "Hover over items to view tooltips."
}

View file

@ -138,6 +138,8 @@ class UserController extends BaseController {
migratedProfileInfo(MatrixProfile.showedClickMessage);
final bool? showBlurMeansTranslate =
migratedProfileInfo(MatrixProfile.showedBlurMeansTranslate);
final bool? showTooltipInstructions =
migratedProfileInfo(MatrixProfile.showedTooltipInstructions);
await updateMatrixProfile(
dateOfBirth: dob,
@ -151,6 +153,7 @@ class UserController extends BaseController {
showedItInstructions: showItInstructions,
showedClickMessage: showClickMessage,
showedBlurMeansTranslate: showBlurMeansTranslate,
showedTooltipInstructions: showTooltipInstructions,
createdAt: createdAt,
targetLanguage: targetLanguage,
sourceLanguage: sourceLanguage,
@ -232,6 +235,7 @@ class UserController extends BaseController {
bool? showedItInstructions,
bool? showedClickMessage,
bool? showedBlurMeansTranslate,
bool? showedTooltipInstructions,
String? createdAt,
String? targetLanguage,
String? sourceLanguage,
@ -304,6 +308,12 @@ class UserController extends BaseController {
showedBlurMeansTranslate,
);
}
if (showedTooltipInstructions != null) {
await _pangeaController.pStoreService.save(
MatrixProfile.showedTooltipInstructions.title,
showedTooltipInstructions,
);
}
if (createdAt != null) {
await _pangeaController.pStoreService.save(
MatrixProfile.createdAt.title,

View file

@ -63,6 +63,7 @@ enum MatrixProfile {
showedItInstructions,
showedClickMessage,
showedBlurMeansTranslate,
showedTooltipInstructions,
createdAt,
targetLanguage,
sourceLanguage,
@ -95,6 +96,8 @@ extension MatrixProfileExtension on MatrixProfile {
return InstructionsEnum.clickMessage.toString();
case MatrixProfile.showedBlurMeansTranslate:
return InstructionsEnum.blurMeansTranslate.toString();
case MatrixProfile.showedTooltipInstructions:
return InstructionsEnum.tooltipInstructions.toString();
case MatrixProfile.createdAt:
return ModelKey.userCreatedAt;
case MatrixProfile.targetLanguage:

View file

@ -1,3 +1,4 @@
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -102,6 +103,7 @@ enum InstructionsEnum {
itInstructions,
clickMessage,
blurMeansTranslate,
tooltipInstructions,
}
extension Copy on InstructionsEnum {
@ -113,6 +115,8 @@ extension Copy on InstructionsEnum {
return L10n.of(context)!.clickMessageTitle;
case InstructionsEnum.blurMeansTranslate:
return L10n.of(context)!.blurMeansTranslateTitle;
case InstructionsEnum.tooltipInstructions:
return L10n.of(context)!.tooltipInstructionsTitle;
}
}
@ -124,6 +128,10 @@ extension Copy on InstructionsEnum {
return L10n.of(context)!.clickMessageBody;
case InstructionsEnum.blurMeansTranslate:
return L10n.of(context)!.blurMeansTranslateBody;
case InstructionsEnum.tooltipInstructions:
return PlatformInfos.isMobile
? L10n.of(context)!.tooltipInstructionsMobileBody
: L10n.of(context)!.tooltipInstructionsBrowserBody;
}
}
}

View file

@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
import 'package:fluffychat/pangea/models/speech_to_text_models.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/pangea/utils/instructions.dart';
import 'package:fluffychat/pangea/widgets/chat/toolbar_content_loading_indicator.dart';
import 'package:fluffychat/pangea/widgets/common/icon_number_widget.dart';
import 'package:fluffychat/pangea/widgets/igc/card_error_widget.dart';
@ -175,12 +176,24 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
number:
"${selectedToken?.confidence ?? speechToTextResponse!.transcript.confidence}%",
toolTip: L10n.of(context)!.accuracy,
onPressed: () => MatrixState.pangeaController.instructions.show(
context,
InstructionsEnum.tooltipInstructions,
widget.messageEvent.eventId,
true,
),
),
IconNumberWidget(
icon: Icons.speed,
number:
wordsPerMinuteString != null ? "$wordsPerMinuteString" : "??",
toolTip: L10n.of(context)!.wordsPerMinute,
onPressed: () => MatrixState.pangeaController.instructions.show(
context,
InstructionsEnum.tooltipInstructions,
widget.messageEvent.eventId,
true,
),
),
],
),

View file

@ -6,6 +6,7 @@ class IconNumberWidget extends StatelessWidget {
final Color? iconColor;
final double? iconSize;
final String? toolTip;
final VoidCallback onPressed;
const IconNumberWidget({
super.key,
@ -14,16 +15,20 @@ class IconNumberWidget extends StatelessWidget {
this.toolTip,
this.iconColor,
this.iconSize,
required this.onPressed,
});
Widget _content(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
icon,
color: iconColor ?? Theme.of(context).iconTheme.color,
size: iconSize ?? Theme.of(context).iconTheme.size,
IconButton(
icon: Icon(
icon,
color: iconColor ?? Theme.of(context).iconTheme.color,
size: iconSize ?? Theme.of(context).iconTheme.size,
),
onPressed: onPressed,
),
const SizedBox(width: 8),
Text(