From 03e584f59103c8dda960c64637bd7ee40e8186f7 Mon Sep 17 00:00:00 2001 From: kanat <> Date: Wed, 26 Apr 2023 15:32:51 -0700 Subject: [PATCH 1/3] [1505] fix emoji regexp to exclude non-emoji chars --- .../stream_chat_flutter/lib/src/utils/extensions.dart | 2 +- .../test/src/utils/extension_test.dart | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/utils/extensions.dart b/packages/stream_chat_flutter/lib/src/utils/extensions.dart index 67b622db..06b02aae 100644 --- a/packages/stream_chat_flutter/lib/src/utils/extensions.dart +++ b/packages/stream_chat_flutter/lib/src/utils/extensions.dart @@ -34,7 +34,7 @@ extension StringExtension on String { if (trimmedString.isEmpty) return false; if (trimmedString.characters.length > 3) return false; final emojiRegex = RegExp( - r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])+$', + r'^(\u00a9|\u00ae|\u200d|[\ufe00-\ufe0f]|[\u2600-\u27FF]|[\u2300-\u2bFF]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])+$', multiLine: true, caseSensitive: false, ); diff --git a/packages/stream_chat_flutter/test/src/utils/extension_test.dart b/packages/stream_chat_flutter/test/src/utils/extension_test.dart index 26980727..c8e75f81 100644 --- a/packages/stream_chat_flutter/test/src/utils/extension_test.dart +++ b/packages/stream_chat_flutter/test/src/utils/extension_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; @@ -81,6 +82,16 @@ void main() { expect('🌢1'.isOnlyEmoji, false); expect('πŸ‘¨β€πŸ‘¨πŸ‘¨β€πŸ‘¨'.isOnlyEmoji, true); expect('πŸ‘¨β€πŸ‘¨πŸ‘¨β€πŸ‘¨ '.isOnlyEmoji, true); + expect('πŸ‘¨πŸ‘¨πŸ‘¨πŸ‘¨'.isOnlyEmoji, false); + expect('⭐⭐⭐'.isOnlyEmoji, true); + expect('⭕⭕⭐'.isOnlyEmoji, true); + expect('βœ…'.isOnlyEmoji, true); + expect('☺️'.isOnlyEmoji, true); + }); + + test('korean symbols', () { + expect('γ…Žγ…Žγ…Ž'.isOnlyEmoji, false); + expect('γ…Žγ…Žγ…Žγ…Ž'.isOnlyEmoji, false); }); }); } From 79b260d3c56b46635a65a086290cef6791273f7a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 27 Apr 2023 14:36:21 +0530 Subject: [PATCH 2/3] test: add more tests Signed-off-by: xsahil03x --- .../test/src/utils/extension_test.dart | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat_flutter/test/src/utils/extension_test.dart b/packages/stream_chat_flutter/test/src/utils/extension_test.dart index c8e75f81..eef7677e 100644 --- a/packages/stream_chat_flutter/test/src/utils/extension_test.dart +++ b/packages/stream_chat_flutter/test/src/utils/extension_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; @@ -89,7 +88,62 @@ void main() { expect('☺️'.isOnlyEmoji, true); }); - test('korean symbols', () { + test('Korean vowels', () { + expect('ㅏ'.isOnlyEmoji, false); + expect('γ…‘'.isOnlyEmoji, false); + expect('γ…“'.isOnlyEmoji, false); + expect('γ…•'.isOnlyEmoji, false); + expect('γ…—'.isOnlyEmoji, false); + expect('γ…›'.isOnlyEmoji, false); + expect('γ…œ'.isOnlyEmoji, false); + expect('γ… '.isOnlyEmoji, false); + expect('γ…‘'.isOnlyEmoji, false); + expect('γ…£'.isOnlyEmoji, false); + }); + + test('Korean consonants', () { + expect('γ„±'.isOnlyEmoji, false); + expect('γ„΄'.isOnlyEmoji, false); + expect('γ„·'.isOnlyEmoji, false); + expect('γ„Ή'.isOnlyEmoji, false); + expect('ㅁ'.isOnlyEmoji, false); + expect('γ…‚'.isOnlyEmoji, false); + expect('γ……'.isOnlyEmoji, false); + expect('γ…‡'.isOnlyEmoji, false); + expect('γ…ˆ'.isOnlyEmoji, false); + expect('γ…Š'.isOnlyEmoji, false); + expect('γ…‹'.isOnlyEmoji, false); + expect('γ…Œ'.isOnlyEmoji, false); + expect('ㅍ'.isOnlyEmoji, false); + expect('γ…Ž'.isOnlyEmoji, false); + }); + + test('Korean syllables', () { + expect('κ°€'.isOnlyEmoji, false); + expect('λ‚˜'.isOnlyEmoji, false); + expect('λ‹€'.isOnlyEmoji, false); + expect('라'.isOnlyEmoji, false); + expect('마'.isOnlyEmoji, false); + expect('λ°”'.isOnlyEmoji, false); + expect('사'.isOnlyEmoji, false); + expect('μ•„'.isOnlyEmoji, false); + expect('자'.isOnlyEmoji, false); + expect('μ°¨'.isOnlyEmoji, false); + expect('μΉ΄'.isOnlyEmoji, false); + expect('타'.isOnlyEmoji, false); + expect('파'.isOnlyEmoji, false); + expect('ν•˜'.isOnlyEmoji, false); + }); + + // https://github.com/GetStream/stream-chat-flutter/issues/1502 + test('Issue:#1502', () { + expect('γ„΄'.isOnlyEmoji, false); + expect('γ„΄γ…‡'.isOnlyEmoji, false); + expect('γ…‡γ…‹'.isOnlyEmoji, false); + }); + + // https://github.com/GetStream/stream-chat-flutter/issues/1505 + test('Issue:#1505', () { expect('γ…Žγ…Žγ…Ž'.isOnlyEmoji, false); expect('γ…Žγ…Žγ…Žγ…Ž'.isOnlyEmoji, false); }); From 3ed48fafba116d02e3bdf72ae2a49f9af13cef6a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 27 Apr 2023 14:41:04 +0530 Subject: [PATCH 3/3] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index dea27923..277d2484 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,3 +1,12 @@ +## Upcoming + +🐞 Fixed + +- [#1502](https://github.com/GetStream/stream-chat-flutter/issues/1502) Fixed `isOnlyEmoji` method Detects Single Hangul + Consonants as Emoji. +- [#1505](https://github.com/GetStream/stream-chat-flutter/issues/1505) Fixed Message bubble disappears for Hangul + Consonants. + ## 6.0.0 🐞 Fixed