Skip to content

Commit eb26c84

Browse files
committed
emoji [nfc]: Move _testCandidate logic onto query class
This logic will grow to handle ranking, and it's closely tied to the matching logic that lives on the query.
1 parent b67e172 commit eb26c84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/model/emoji.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ class EmojiAutocompleteView extends AutocompleteView<EmojiAutocompleteQuery, Emo
342342
return results;
343343
}
344344

345-
EmojiAutocompleteResult? _testCandidate(EmojiAutocompleteQuery query, EmojiCandidate candidate) {
346-
return query.matches(candidate) ? EmojiAutocompleteResult(candidate) : null;
345+
static EmojiAutocompleteResult? _testCandidate(EmojiAutocompleteQuery query, EmojiCandidate candidate) {
346+
return query._testCandidate(candidate);
347347
}
348348
}
349349

@@ -375,6 +375,10 @@ class EmojiAutocompleteQuery extends ComposeAutocompleteQuery {
375375
return EmojiAutocompleteView.init(store: store, query: this);
376376
}
377377

378+
EmojiAutocompleteResult? _testCandidate(EmojiCandidate candidate) {
379+
return matches(candidate) ? EmojiAutocompleteResult(candidate) : null;
380+
}
381+
378382
// Compare get_emoji_matcher in Zulip web:shared/src/typeahead.ts .
379383
bool matches(EmojiCandidate candidate) {
380384
if (_adjusted == '') return true;

0 commit comments

Comments
 (0)