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 🐞 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. 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. Consonants.
- [[#1476]](https://github.com/GetStream/stream-chat-flutter/issues/1476) Fixed `UserAvatarTransform.userAvatarBuilder` - [[#1476]](https://github.com/GetStream/stream-chat-flutter/issues/1476) Fixed `UserAvatarTransform.userAvatarBuilder`
works only for otherUser. 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 ## 6.0.0
🐞 Fixed 🐞 Fixed
- [#1456](https://github.com/GetStream/stream-chat-flutter/issues/1456) Fixed logic for showing that a message was read - [[#1456]](https://github.com/GetStream/stream-chat-flutter/issues/1456) Fixed logic for showing that a message was
using sending indicator. read using sending indicator.
- [#1462](https://github.com/GetStream/stream-chat-flutter/issues/1462) Fixed support for iPad in the share button for - [[#1462]](https://github.com/GetStream/stream-chat-flutter/issues/1462) Fixed support for iPad in the share button for
images. 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 ✅ Added
@@ -32,7 +53,6 @@
- Updated dependencies to resolvable versions. - Updated dependencies to resolvable versions.
🚀 Improved 🚀 Improved
-
- Improved draw of reaction options. [#1455](https://github.com/GetStream/stream-chat-flutter/pull/1455) - 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 _kCommandTrigger = '/';
const _kMentionTrigger = '@'; 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: /// Inactive state:
/// ///
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/packages/stream_chat_flutter/screenshots/message_input.png) /// ![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.sendMessageKeyPredicate = _defaultSendMessageKeyPredicate,
this.clearQuotedMessageKeyPredicate = this.clearQuotedMessageKeyPredicate =
_defaultClearQuotedMessageKeyPredicate, _defaultClearQuotedMessageKeyPredicate,
this.ogPreviewFilter = _defaultOgPreviewFilter,
}); });
/// The predicate used to send a message on desktop/web /// 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 /// Callback for when the quoted message is cleared
final VoidCallback? onQuotedMessageCleared; 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) => static bool _defaultValidator(Message message) =>
message.text?.isNotEmpty == true || message.attachments.isNotEmpty; message.text?.isNotEmpty == true || message.attachments.isNotEmpty;
@@ -990,11 +1010,13 @@ class StreamMessageInputState extends State<StreamMessageInput>
if (_lastSearchedContainsUrlText == value) return; if (_lastSearchedContainsUrlText == value) return;
_lastSearchedContainsUrlText = value; _lastSearchedContainsUrlText = value;
final matchedUrls = _urlRegex.allMatches(value).toList() final matchedUrls = _urlRegex.allMatches(value).where((it) {
..removeWhere((it) { final _parsedMatch = Uri.tryParse(it.group(0) ?? '')?.withScheme;
final _parsedMatch = Uri.tryParse(it.group(0) ?? '')?.withScheme; if (_parsedMatch == null) return false;
return _parsedMatch?.host.split('.').last.isValidTLD() == 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 // Reset the og attachment if the text doesn't contain any url
if (matchedUrls.isEmpty || if (matchedUrls.isEmpty ||
@@ -1035,6 +1035,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
builder: (_) => EditMessageSheet( builder: (_) => EditMessageSheet(
message: widget.message, message: widget.message,
channel: StreamChannel.of(context).channel, channel: StreamChannel.of(context).channel,
editMessageInputBuilder: widget.editMessageInputBuilder,
), ),
); );
}, },