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`
|
- Added support for `next`, `previous` value pagination in `client.search`
|
||||||
, [read more.](https://getstream.io/chat/docs/other-rest/search/#pagination)
|
, [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`
|
- `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.
|
, `attachment.extraData['mime_type]` is same respectively.
|
||||||
|
|
||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly.
|
- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly.
|
||||||
- Fix `Filter.empty()` json encoding.
|
- 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
|
## 2.2.1
|
||||||
|
|
||||||
|
|||||||
@@ -406,10 +406,6 @@ class StreamChatClient {
|
|||||||
if (event.type == EventType.healthCheck) {
|
if (event.type == EventType.healthCheck) {
|
||||||
return _handleHealthCheckEvent(event);
|
return _handleHealthCheckEvent(event);
|
||||||
}
|
}
|
||||||
if (!event.isLocal && _synced) {
|
|
||||||
_lastSyncedAt = event.createdAt;
|
|
||||||
_chatPersistenceClient?.updateLastSyncAt(event.createdAt);
|
|
||||||
}
|
|
||||||
state.updateUser(event.user);
|
state.updateUser(event.user);
|
||||||
return _eventController.add(event);
|
return _eventController.add(event);
|
||||||
}
|
}
|
||||||
@@ -1325,6 +1321,7 @@ class StreamChatClient {
|
|||||||
// resetting state
|
// resetting state
|
||||||
state.dispose();
|
state.dispose();
|
||||||
state = ClientState(this);
|
state = ClientState(this);
|
||||||
|
_lastSyncedAt = null;
|
||||||
|
|
||||||
// resetting credentials
|
// resetting credentials
|
||||||
_tokenManager.reset();
|
_tokenManager.reset();
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ class OwnUser extends User {
|
|||||||
factory OwnUser.fromUser(User user) => OwnUser(
|
factory OwnUser.fromUser(User user) => OwnUser(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
role: user.role,
|
role: user.role,
|
||||||
name: user.name,
|
|
||||||
image: user.image,
|
|
||||||
createdAt: user.createdAt,
|
createdAt: user.createdAt,
|
||||||
updatedAt: user.updatedAt,
|
updatedAt: user.updatedAt,
|
||||||
lastActive: user.lastActive,
|
lastActive: user.lastActive,
|
||||||
@@ -116,8 +114,6 @@ class OwnUser extends User {
|
|||||||
return copyWith(
|
return copyWith(
|
||||||
id: other.id,
|
id: other.id,
|
||||||
role: other.role,
|
role: other.role,
|
||||||
name: other.name,
|
|
||||||
image: other.image,
|
|
||||||
banned: other.banned,
|
banned: other.banned,
|
||||||
channelMutes: other.channelMutes,
|
channelMutes: other.channelMutes,
|
||||||
createdAt: other.createdAt,
|
createdAt: other.createdAt,
|
||||||
|
|||||||
@@ -175,5 +175,26 @@ void main() {
|
|||||||
expect(newUser.teams, ['team1', 'team2']);
|
expect(newUser.teams, ['team1', 'team2']);
|
||||||
expect(newUser.language, 'fr');
|
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
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// 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
|
/// All Groups
|
||||||
enum EmojiGroup {
|
enum EmojiGroup {
|
||||||
@@ -114240,7 +114241,6 @@ final emojiRegex = RegExp(
|
|||||||
class Emoji {
|
class Emoji {
|
||||||
static const variationSelector16 = 65039;
|
static const variationSelector16 = 65039;
|
||||||
static const ZWJ = 8205;
|
static const ZWJ = 8205;
|
||||||
|
|
||||||
final String? name;
|
final String? name;
|
||||||
final String? char;
|
final String? char;
|
||||||
final String? shortName;
|
final String? shortName;
|
||||||
@@ -114252,14 +114252,39 @@ class Emoji {
|
|||||||
|
|
||||||
/// Emoji class.
|
/// 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.
|
/// [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(
|
Emoji({
|
||||||
{this.name,
|
this.name,
|
||||||
this.char,
|
this.char,
|
||||||
this.shortName,
|
this.shortName,
|
||||||
this.emojiGroup,
|
this.emojiGroup,
|
||||||
this.emojiSubgroup,
|
this.emojiSubgroup,
|
||||||
this.keywords = const [],
|
this.keywords = const [],
|
||||||
this.modifiable = false});
|
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
|
/// Runes of Emoji Character
|
||||||
List<int> get charRunes {
|
List<int> get charRunes {
|
||||||
@@ -114339,9 +114364,11 @@ class Emoji {
|
|||||||
return _emojis.firstWhereOrNull((Emoji emoji) => emoji.name == name);
|
return _emojis.firstWhereOrNull((Emoji emoji) => emoji.name == name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns Emoji by [name] as short name.
|
/// Returns Emoji by [shortName] as short name.
|
||||||
static Emoji? byShortName(String name) {
|
static Emoji? byShortName(String shortName) {
|
||||||
return _emojis.firstWhereOrNull((Emoji emoji) => emoji.char == name);
|
return _emojis.firstWhereOrNull(
|
||||||
|
(Emoji emoji) => emoji.shortName == shortName,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns list of Emojis in a same [group]
|
/// 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:chewie/chewie.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:photo_view/photo_view.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_footer.dart';
|
||||||
import 'package:stream_chat_flutter/src/gallery_header.dart';
|
import 'package:stream_chat_flutter/src/gallery_header.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:video_player/video_player.dart';
|
import 'package:video_player/video_player.dart';
|
||||||
import 'package:stream_chat_flutter/src/extension.dart';
|
|
||||||
|
|
||||||
/// Return action for coming back from pages
|
/// Return action for coming back from pages
|
||||||
enum ReturnActionType {
|
enum ReturnActionType {
|
||||||
@@ -112,6 +112,8 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
|||||||
attachment.assetUrl ??
|
attachment.assetUrl ??
|
||||||
attachment.thumbUrl;
|
attachment.thumbUrl;
|
||||||
return PhotoView(
|
return PhotoView(
|
||||||
|
loadingBuilder: (context, image) =>
|
||||||
|
const Offstage(),
|
||||||
imageProvider: (imageUrl == null &&
|
imageProvider: (imageUrl == null &&
|
||||||
attachment.localUri != null &&
|
attachment.localUri != null &&
|
||||||
attachment.file?.bytes != 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