Skip to content

Commit 8694d90

Browse files
Ban emojis from comments (#42)
* ban emojis from comments * remove emojis from the keyboard * remove comment removes the "remov" comment Co-authored-by: Ian Tapply <[email protected]> * remove remove_emoji package, add custom emoji stripper, revert text input keyboard type --------- Co-authored-by: Ian Tapply <[email protected]>
1 parent 169dfa7 commit 8694d90

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

lib/utils/helpers/QRCodeHelper.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ class QrcodeHelper {
7575
/// Computes all comment values and returns them as a single string separated by a caret
7676
static String computeCommentValues() {
7777
return computeValues([
78-
parseString(CommentValues.autoComments.text), // index: 17
79-
parseString(CommentValues.autoOrder.text), // index: 18
80-
parseString(CommentValues.teleopComments.text), // index: 19
81-
parseString(CommentValues.endgameComments.text) // index: 20
78+
parseString(stripEmoji(CommentValues.autoComments.text)), // index: 17
79+
parseString(stripEmoji(CommentValues.autoOrder.text)), // index: 18
80+
parseString(stripEmoji(CommentValues.teleopComments.text)), // index: 19
81+
parseString(stripEmoji(CommentValues.endgameComments.text)) // index: 20
8282
]);
8383
}
8484

@@ -105,4 +105,9 @@ class QrcodeHelper {
105105
static String parseInt(String value) {
106106
return (int.tryParse(value) ?? 0).toString();
107107
}
108+
109+
/// Removes any character that is not a letter, number, whitespace or a special character
110+
static String stripEmoji(String value) {
111+
return value.replaceAll(RegExp("[^A-z0-9.,\\-';/?!()[\\]+=\\s@#\$%&*~]"), '');
112+
}
108113
}

pubspec.lock

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,6 @@ packages:
376376
url: "https://pub.dev"
377377
source: hosted
378378
version: "4.1.0"
379-
remove_emoji:
380-
dependency: "direct main"
381-
description:
382-
name: remove_emoji
383-
sha256: ed9e8463e8c9ca05b86fcddd4c0dbd2c2605a50d267f4ffa05496607924809e3
384-
url: "https://pub.dev"
385-
source: hosted
386-
version: "0.0.10"
387379
screen_brightness:
388380
dependency: "direct main"
389381
description:

pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ dependencies:
3939
screen_brightness: ^2.0.0+1
4040
http: ^1.0.0
4141
permission_handler: ^11.3.0
42-
remove_emoji: ^0.0.8
4342
path_provider: ^2.1.4
4443

4544
dev_dependencies:

0 commit comments

Comments
 (0)