Skip to content

Commit

Permalink
Fixed grammar in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
samilabud committed Dec 14, 2023
1 parent e737dcb commit be6ee76
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libs/convertToLTRForComposer/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import ConvertToLTRForComposer from './types';

/**
* Android only - The composer can be converted to LTR if its content is the LTR character followed by an @ or space
* because to mention sugggestion works the @ character must not have any character at the beginning e.g.: \u2066@ doesn't work
* also to avoid sending empty messages the unicode character with space could enable the send button.
*/
function canComposerBeConvertedToLTR(text: string): boolean {
// this handle cases when user type only spaces
// This regex handles the case when a user only types spaces into the composer
const containOnlySpaces = /^\s*$/;
// this handle the case where someone has RTL enabled and they began typing an @mention for someone.
// This regex handles the case where someone has RTL enabled and they began typing an @mention for someone.
const startsWithLTRAndAt = new RegExp(`^${CONST.UNICODE.LTR}@$`);
// this handle cases could send empty messages when composer is multiline
// This regex handles the case to avoid sending empty messages when composer is multiline
const startsWithLTRAndSpace = new RegExp(`${CONST.UNICODE.LTR}\\s*$`);
const emptyExpressions = [containOnlySpaces, startsWithLTRAndAt, startsWithLTRAndSpace];
return emptyExpressions.some((exp) => exp.test(text));
Expand Down

0 comments on commit be6ee76

Please sign in to comment.