You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.1 KiB
Dart
97 lines
3.1 KiB
Dart
|
1 year ago
|
import 'dart:developer';
|
||
|
|
|
||
|
|
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||
|
1 year ago
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||
|
1 year ago
|
import 'package:fluffychat/widgets/matrix.dart';
|
||
|
10 months ago
|
import 'package:flutter/foundation.dart';
|
||
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||
|
1 year ago
|
|
||
|
|
enum InstructionsEnum {
|
||
|
|
itInstructions,
|
||
|
|
clickMessage,
|
||
|
|
blurMeansTranslate,
|
||
|
|
tooltipInstructions,
|
||
|
1 year ago
|
speechToText,
|
||
|
|
l1Translation,
|
||
|
|
translationChoices,
|
||
|
|
clickAgainToDeselect,
|
||
|
1 year ago
|
missingVoice,
|
||
|
1 year ago
|
clickBestOption,
|
||
|
1 year ago
|
unlockedLanguageTools,
|
||
|
10 months ago
|
lemmaMeaning,
|
||
|
1 year ago
|
}
|
||
|
|
|
||
|
1 year ago
|
extension InstructionsEnumExtension on InstructionsEnum {
|
||
|
1 year ago
|
String title(L10n l10n) {
|
||
|
1 year ago
|
switch (this) {
|
||
|
|
case InstructionsEnum.itInstructions:
|
||
|
1 year ago
|
return l10n.itInstructionsTitle;
|
||
|
1 year ago
|
case InstructionsEnum.clickMessage:
|
||
|
1 year ago
|
return l10n.clickMessageTitle;
|
||
|
1 year ago
|
case InstructionsEnum.blurMeansTranslate:
|
||
|
1 year ago
|
return l10n.blurMeansTranslateTitle;
|
||
|
1 year ago
|
case InstructionsEnum.tooltipInstructions:
|
||
|
1 year ago
|
return l10n.tooltipInstructionsTitle;
|
||
|
1 year ago
|
case InstructionsEnum.missingVoice:
|
||
|
|
return l10n.missingVoiceTitle;
|
||
|
1 year ago
|
case InstructionsEnum.clickAgainToDeselect:
|
||
|
|
case InstructionsEnum.speechToText:
|
||
|
|
case InstructionsEnum.l1Translation:
|
||
|
|
case InstructionsEnum.translationChoices:
|
||
|
1 year ago
|
case InstructionsEnum.clickBestOption:
|
||
|
1 year ago
|
case InstructionsEnum.unlockedLanguageTools:
|
||
|
10 months ago
|
case InstructionsEnum.lemmaMeaning:
|
||
|
1 year ago
|
ErrorHandler.logError(
|
||
|
|
e: Exception("No title for this instruction"),
|
||
|
|
m: 'InstructionsEnumExtension.title',
|
||
|
|
data: {
|
||
|
|
'this': this,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
debugger(when: kDebugMode);
|
||
|
|
return "";
|
||
|
1 year ago
|
}
|
||
|
|
}
|
||
|
|
|
||
|
1 year ago
|
String body(L10n l10n) {
|
||
|
1 year ago
|
switch (this) {
|
||
|
|
case InstructionsEnum.itInstructions:
|
||
|
1 year ago
|
return l10n.itInstructionsBody;
|
||
|
1 year ago
|
case InstructionsEnum.clickMessage:
|
||
|
1 year ago
|
return l10n.clickMessageBody;
|
||
|
1 year ago
|
case InstructionsEnum.blurMeansTranslate:
|
||
|
1 year ago
|
return l10n.blurMeansTranslateBody;
|
||
|
1 year ago
|
case InstructionsEnum.speechToText:
|
||
|
1 year ago
|
return l10n.speechToTextBody;
|
||
|
1 year ago
|
case InstructionsEnum.l1Translation:
|
||
|
1 year ago
|
return l10n.l1TranslationBody;
|
||
|
1 year ago
|
case InstructionsEnum.translationChoices:
|
||
|
1 year ago
|
return l10n.translationChoicesBody;
|
||
|
1 year ago
|
case InstructionsEnum.clickAgainToDeselect:
|
||
|
1 year ago
|
return l10n.clickTheWordAgainToDeselect;
|
||
|
1 year ago
|
case InstructionsEnum.tooltipInstructions:
|
||
|
|
return PlatformInfos.isMobile
|
||
|
1 year ago
|
? l10n.tooltipInstructionsMobileBody
|
||
|
|
: l10n.tooltipInstructionsBrowserBody;
|
||
|
1 year ago
|
case InstructionsEnum.missingVoice:
|
||
|
|
return l10n.voiceNotAvailable;
|
||
|
1 year ago
|
case InstructionsEnum.clickBestOption:
|
||
|
|
return l10n.clickBestOption;
|
||
|
1 year ago
|
case InstructionsEnum.unlockedLanguageTools:
|
||
|
|
return l10n.unlockedLanguageTools;
|
||
|
10 months ago
|
case InstructionsEnum.lemmaMeaning:
|
||
|
|
return l10n.lemmaMeaningInstructionsBody;
|
||
|
1 year ago
|
}
|
||
|
|
}
|
||
|
1 year ago
|
|
||
|
10 months ago
|
bool get isToggledOff =>
|
||
|
|
MatrixState.pangeaController.userController.profile.instructionSettings
|
||
|
|
.getStatus(this);
|
||
|
|
|
||
|
|
void setToggledOff(bool value) =>
|
||
|
|
MatrixState.pangeaController.userController.updateProfile((profile) {
|
||
|
|
profile.instructionSettings.setStatus(this, value);
|
||
|
|
return profile;
|
||
|
|
});
|
||
|
1 year ago
|
}
|