Merge branch 'develop' into fix/userAvatarBuilder

This commit is contained in:
Sahil Kumar
2023-05-01 22:52:30 +05:30
committed by GitHub
3 changed files with 55 additions and 12 deletions
+27 -7
View File
@@ -2,22 +2,43 @@
🐞 Fixed
- [#1502](https://github.com/GetStream/stream-chat-flutter/issues/1502) Fixed `isOnlyEmoji` method Detects Single Hangul
- [[#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
- [[#1505]](https://github.com/GetStream/stream-chat-flutter/issues/1505) Fixed Message bubble disappears for Hangul
Consonants.
- [[#1476]](https://github.com/GetStream/stream-chat-flutter/issues/1476) Fixed `UserAvatarTransform.userAvatarBuilder`
works only for otherUser.
- [[#1490]](https://github.com/GetStream/stream-chat-flutter/issues/1490) Fixed `editMessageInputBuilder` property not
used in message edit widget.
✅ Added
- Added `StreamMessageInput.ogPreviewFilter` to allow users to filter out the og preview
links. [#1338](https://github.com/GetStream/stream-chat-flutter/issues/1338)
```dart
StreamMessageInput(
ogPreviewFilter: (matchedUri, messageText) {
final url = matchedUri.toString();
if (url.contains('giphy.com')) {
// Return false to prevent the OG preview from being built.
return false;
}
// Return true to build the OG preview.
return true;
),
```
## 6.0.0
🐞 Fixed
- [#1456](https://github.com/GetStream/stream-chat-flutter/issues/1456) Fixed logic for showing that a message was read
using sending indicator.
- [#1462](https://github.com/GetStream/stream-chat-flutter/issues/1462) Fixed support for iPad in the share button for
- [[#1456]](https://github.com/GetStream/stream-chat-flutter/issues/1456) Fixed logic for showing that a message was
read using sending indicator.
- [[#1462]](https://github.com/GetStream/stream-chat-flutter/issues/1462) Fixed support for iPad in the share button for
images.
- [#1475](https://github.com/GetStream/stream-chat-flutter/issues/1475) Fixed typo to fix compilation.
- [[#1475]](https://github.com/GetStream/stream-chat-flutter/issues/1475) Fixed typo to fix compilation.
✅ Added
@@ -32,7 +53,6 @@
- Updated dependencies to resolvable versions.
🚀 Improved
-
- Improved draw of reaction options. [#1455](https://github.com/GetStream/stream-chat-flutter/pull/1455)
@@ -25,6 +25,13 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
const _kCommandTrigger = '/';
const _kMentionTrigger = '@';
/// Signature for the function that determines if a [matchedUri] should be
/// previewed as an OG Attachment.
typedef OgPreviewFilter = bool Function(
Uri matchedUri,
String messageText,
);
/// Inactive state:
///
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/packages/stream_chat_flutter/screenshots/message_input.png)
@@ -114,6 +121,7 @@ class StreamMessageInput extends StatefulWidget {
this.sendMessageKeyPredicate = _defaultSendMessageKeyPredicate,
this.clearQuotedMessageKeyPredicate =
_defaultClearQuotedMessageKeyPredicate,
this.ogPreviewFilter = _defaultOgPreviewFilter,
});
/// The predicate used to send a message on desktop/web
@@ -259,6 +267,18 @@ class StreamMessageInput extends StatefulWidget {
/// Callback for when the quoted message is cleared
final VoidCallback? onQuotedMessageCleared;
/// The filter used to determine if a link should be shown as an OpenGraph
/// preview.
final OgPreviewFilter ogPreviewFilter;
static bool _defaultOgPreviewFilter(
Uri matchedUri,
String messageText,
) {
// Show the preview for all links
return true;
}
static bool _defaultValidator(Message message) =>
message.text?.isNotEmpty == true || message.attachments.isNotEmpty;
@@ -990,11 +1010,13 @@ class StreamMessageInputState extends State<StreamMessageInput>
if (_lastSearchedContainsUrlText == value) return;
_lastSearchedContainsUrlText = value;
final matchedUrls = _urlRegex.allMatches(value).toList()
..removeWhere((it) {
final _parsedMatch = Uri.tryParse(it.group(0) ?? '')?.withScheme;
return _parsedMatch?.host.split('.').last.isValidTLD() == false;
});
final matchedUrls = _urlRegex.allMatches(value).where((it) {
final _parsedMatch = Uri.tryParse(it.group(0) ?? '')?.withScheme;
if (_parsedMatch == null) return false;
return _parsedMatch.host.split('.').last.isValidTLD() &&
widget.ogPreviewFilter.call(_parsedMatch, value);
}).toList();
// Reset the og attachment if the text doesn't contain any url
if (matchedUrls.isEmpty ||
@@ -1035,6 +1035,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
builder: (_) => EditMessageSheet(
message: widget.message,
channel: StreamChannel.of(context).channel,
editMessageInputBuilder: widget.editMessageInputBuilder,
),
);
},