chore: don't show match activities for single-word messages
This commit is contained in:
parent
31f1632b91
commit
233e5162d1
2 changed files with 21 additions and 0 deletions
|
|
@ -190,4 +190,20 @@ extension ActivityTypeExtension on ActivityTypeEnum {
|
|||
return null; // TODO: Add to L10n
|
||||
}
|
||||
}
|
||||
|
||||
/// The minimum number of tokens in a message for this activity type to be available.
|
||||
/// Matching activities don't make sense for a single-word message.
|
||||
int get minTokensForMatchActivity {
|
||||
switch (this) {
|
||||
case ActivityTypeEnum.wordMeaning:
|
||||
case ActivityTypeEnum.lemmaId:
|
||||
case ActivityTypeEnum.wordFocusListening:
|
||||
return 2;
|
||||
case ActivityTypeEnum.hiddenWordListening:
|
||||
case ActivityTypeEnum.emoji:
|
||||
case ActivityTypeEnum.morphId:
|
||||
case ActivityTypeEnum.messageMeaning:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,11 @@ class PracticeSelection {
|
|||
return [];
|
||||
}
|
||||
|
||||
if (tokens.length < activityType.minTokensForMatchActivity) {
|
||||
// if we only have one token, we don't need to do an emoji activity
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
PracticeTarget(
|
||||
activityType: activityType,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue