Merge branch 'develop' into hotfix/messageListView
This commit is contained in:
@@ -16,13 +16,16 @@
|
||||
- Added support for `next`, `previous` value pagination in `client.search`
|
||||
, [read more.](https://getstream.io/chat/docs/other-rest/search/#pagination)
|
||||
- `Attachment` class now has a `fileSize` and `mimeType` property. Setting a `file` will also set the `file_size`
|
||||
, `mime_type` key on `extraData`, so `attachment.fileSize`, `attachment.mimetype` and `attachment.extraData['file_size']`
|
||||
, `mime_type` key on `extraData`, so `attachment.fileSize`, `attachment.mimetype`
|
||||
and `attachment.extraData['file_size']`
|
||||
, `attachment.extraData['mime_type]` is same respectively.
|
||||
|
||||
🐞 Fixed
|
||||
|
||||
- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly.
|
||||
- Fix `Filter.empty()` json encoding.
|
||||
- [[#700]](https://github.com/GetStream/stream-chat-flutter/issues/700) Connecting user without providing `name`
|
||||
uses `id` instead for setting `user.name`.
|
||||
|
||||
## 2.2.1
|
||||
|
||||
|
||||
@@ -406,10 +406,6 @@ class StreamChatClient {
|
||||
if (event.type == EventType.healthCheck) {
|
||||
return _handleHealthCheckEvent(event);
|
||||
}
|
||||
if (!event.isLocal && _synced) {
|
||||
_lastSyncedAt = event.createdAt;
|
||||
_chatPersistenceClient?.updateLastSyncAt(event.createdAt);
|
||||
}
|
||||
state.updateUser(event.user);
|
||||
return _eventController.add(event);
|
||||
}
|
||||
@@ -1325,6 +1321,7 @@ class StreamChatClient {
|
||||
// resetting state
|
||||
state.dispose();
|
||||
state = ClientState(this);
|
||||
_lastSyncedAt = null;
|
||||
|
||||
// resetting credentials
|
||||
_tokenManager.reset();
|
||||
|
||||
@@ -54,8 +54,6 @@ class OwnUser extends User {
|
||||
factory OwnUser.fromUser(User user) => OwnUser(
|
||||
id: user.id,
|
||||
role: user.role,
|
||||
name: user.name,
|
||||
image: user.image,
|
||||
createdAt: user.createdAt,
|
||||
updatedAt: user.updatedAt,
|
||||
lastActive: user.lastActive,
|
||||
@@ -116,8 +114,6 @@ class OwnUser extends User {
|
||||
return copyWith(
|
||||
id: other.id,
|
||||
role: other.role,
|
||||
name: other.name,
|
||||
image: other.image,
|
||||
banned: other.banned,
|
||||
channelMutes: other.channelMutes,
|
||||
createdAt: other.createdAt,
|
||||
|
||||
@@ -175,5 +175,26 @@ void main() {
|
||||
expect(newUser.teams, ['team1', 'team2']);
|
||||
expect(newUser.language, 'fr');
|
||||
});
|
||||
|
||||
test(
|
||||
'fromUser should not override name with id if not available in extraData',
|
||||
() {
|
||||
final user = User(id: 'test-id');
|
||||
expect(user.id, 'test-id');
|
||||
expect(user.name, 'test-id');
|
||||
|
||||
final encodedUser = user.toJson();
|
||||
expect(encodedUser['id'], 'test-id');
|
||||
expect(encodedUser['name'], null);
|
||||
|
||||
final ownUser = OwnUser.fromUser(user);
|
||||
expect(user.id, 'test-id');
|
||||
expect(user.name, 'test-id');
|
||||
|
||||
final encodedOwnUser = ownUser.toJson();
|
||||
expect(encodedOwnUser['id'], 'test-id');
|
||||
expect(encodedOwnUser['name'], null);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import 'package:collection/collection.dart' show IterableExtension;
|
||||
import 'package:collection/collection.dart'
|
||||
show IterableExtension, ListEquality;
|
||||
|
||||
/// All Groups
|
||||
enum EmojiGroup {
|
||||
@@ -114240,7 +114241,6 @@ final emojiRegex = RegExp(
|
||||
class Emoji {
|
||||
static const variationSelector16 = 65039;
|
||||
static const ZWJ = 8205;
|
||||
|
||||
final String? name;
|
||||
final String? char;
|
||||
final String? shortName;
|
||||
@@ -114252,14 +114252,39 @@ class Emoji {
|
||||
|
||||
/// Emoji class.
|
||||
/// [name] of emoji. [char] and character of emoji. [shortName] and a digest name of emoji, [emojiGroup] is emoji's group and [emojiSubgroup] is emoji's subgroup. [keywords] list of keywords for emoji. [modifiable] `true` if emoji has skin.
|
||||
Emoji(
|
||||
{this.name,
|
||||
this.char,
|
||||
this.shortName,
|
||||
this.emojiGroup,
|
||||
this.emojiSubgroup,
|
||||
this.keywords = const [],
|
||||
this.modifiable = false});
|
||||
Emoji({
|
||||
this.name,
|
||||
this.char,
|
||||
this.shortName,
|
||||
this.emojiGroup,
|
||||
this.emojiSubgroup,
|
||||
this.keywords = const [],
|
||||
this.modifiable = false,
|
||||
});
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is Emoji &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name == other.name &&
|
||||
char == other.char &&
|
||||
shortName == other.shortName &&
|
||||
emojiGroup == other.emojiGroup &&
|
||||
emojiSubgroup == other.emojiSubgroup &&
|
||||
const ListEquality().equals(keywords, other.keywords) &&
|
||||
modifiable == other.modifiable;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
name.hashCode,
|
||||
char.hashCode,
|
||||
shortName.hashCode,
|
||||
emojiGroup.hashCode,
|
||||
emojiSubgroup.hashCode,
|
||||
keywords.hashCode,
|
||||
modifiable.hashCode,
|
||||
);
|
||||
|
||||
/// Runes of Emoji Character
|
||||
List<int> get charRunes {
|
||||
@@ -114339,9 +114364,11 @@ class Emoji {
|
||||
return _emojis.firstWhereOrNull((Emoji emoji) => emoji.name == name);
|
||||
}
|
||||
|
||||
/// Returns Emoji by [name] as short name.
|
||||
static Emoji? byShortName(String name) {
|
||||
return _emojis.firstWhereOrNull((Emoji emoji) => emoji.char == name);
|
||||
/// Returns Emoji by [shortName] as short name.
|
||||
static Emoji? byShortName(String shortName) {
|
||||
return _emojis.firstWhereOrNull(
|
||||
(Emoji emoji) => emoji.shortName == shortName,
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns list of Emojis in a same [group]
|
||||
|
||||
@@ -5,11 +5,11 @@ import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:chewie/chewie.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
import 'package:stream_chat_flutter/src/extension.dart';
|
||||
import 'package:stream_chat_flutter/src/gallery_footer.dart';
|
||||
import 'package:stream_chat_flutter/src/gallery_header.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:stream_chat_flutter/src/extension.dart';
|
||||
|
||||
/// Return action for coming back from pages
|
||||
enum ReturnActionType {
|
||||
@@ -112,6 +112,8 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
||||
attachment.assetUrl ??
|
||||
attachment.thumbUrl;
|
||||
return PhotoView(
|
||||
loadingBuilder: (context, image) =>
|
||||
const Offstage(),
|
||||
imageProvider: (imageUrl == null &&
|
||||
attachment.localUri != null &&
|
||||
attachment.file?.bytes != null)
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:stream_chat_flutter/src/emoji/emoji.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('src/emoji', () {
|
||||
test('${Emoji.byShortName} should bring the correct emoji', () {
|
||||
final resultEmoji = Emoji.byShortName('smiley');
|
||||
expect(resultEmoji, _mockEmoji);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
final _mockEmoji = Emoji(
|
||||
name: 'grinning face with big eyes',
|
||||
char: '\u{1F603}',
|
||||
shortName: 'smiley',
|
||||
emojiGroup: EmojiGroup.smileysEmotion,
|
||||
emojiSubgroup: EmojiSubgroup.faceSmiling,
|
||||
keywords: [
|
||||
'face',
|
||||
'mouth',
|
||||
'open',
|
||||
'smile',
|
||||
'uc6',
|
||||
'smiley',
|
||||
'happy',
|
||||
'silly',
|
||||
'laugh',
|
||||
'good',
|
||||
'smile',
|
||||
'teeth',
|
||||
'fun',
|
||||
'smileys',
|
||||
'mood',
|
||||
'emotion',
|
||||
'emotions',
|
||||
'emotional',
|
||||
'hooray',
|
||||
'cheek',
|
||||
'cheeky',
|
||||
'excited',
|
||||
'feliz',
|
||||
'heureux',
|
||||
'cheerful',
|
||||
'delighted',
|
||||
'ecstatic',
|
||||
'elated',
|
||||
'glad',
|
||||
'joy',
|
||||
'merry',
|
||||
'funny',
|
||||
'laughing',
|
||||
'lol',
|
||||
'rofl',
|
||||
'lmao',
|
||||
'lmfao',
|
||||
'hilarious',
|
||||
'ha',
|
||||
'haha',
|
||||
'chuckle',
|
||||
'comedy',
|
||||
'giggle',
|
||||
'hehe',
|
||||
'joyful',
|
||||
'laugh out loud',
|
||||
'rire',
|
||||
'tee hee',
|
||||
'jaja',
|
||||
'good job',
|
||||
'nice',
|
||||
'well done',
|
||||
'bravo',
|
||||
'congratulations',
|
||||
'congrats',
|
||||
'smiles',
|
||||
'dentist',
|
||||
':-D',
|
||||
'=D'
|
||||
]);
|
||||
Reference in New Issue
Block a user