Skip to content

Commit

Permalink
Merge pull request #583 from GetStream/release/2.1.0
Browse files Browse the repository at this point in the history
chore(repo): 2.1.0
  • Loading branch information
imtoori authored Jul 28, 2021
2 parents c92cba4 + fcce46c commit b118167
Show file tree
Hide file tree
Showing 245 changed files with 9,654 additions and 788 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v2.1.0
- uses: amannn/action-semantic-pull-request@v3.4.0
with:
scopes: |
llc
persistence
core
ui
doc
repo
localization
requireScope: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ This package provides business logic to fetch common things required for integra
### [stream_chat_flutter](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter)
This library includes both a low-level chat SDK and a set of reusable and customizable UI components.

### [stream_chat_localizations](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_localizations)
This library includes a set of localization files for the Flutter UI components.

## Flutter Chat Tutorial

The best place to start is the [Flutter Chat Tutorial](https://getstream.io/chat/flutter/tutorial/).
Expand Down
8 changes: 4 additions & 4 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ scripts:

analyze:
run: |
melos exec -c 4 --ignore="*example*" -- \
melos exec -c 5 --ignore="*example*" -- \
dart analyze --fatal-infos .
description: |
Run `dart analyze` in all packages.
Expand All @@ -26,7 +26,7 @@ scripts:
lint:pub:
run: |
melos exec -c 4 --no-private --ignore="*example*" -- \
melos exec -c 5 --no-private --ignore="*example*" -- \
pub publish --dry-run
description: |
Run `pub publish --dry-run` in all packages.
Expand Down Expand Up @@ -56,15 +56,15 @@ scripts:
dir-exists: test

test:flutter:
run: melos exec -c 3 --fail-fast -- "flutter test --coverage"
run: melos exec -c 4 --fail-fast -- "flutter test --coverage"
description: Run Flutter tests for a specific package in this project.
select-package:
flutter: true
dir-exists: test

coverage:ignore-file:
run: |
melos exec -c 4 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh"
melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh"
description: Removes all the ignored files from the coverage report.
select-package:
dir-exists: coverage
Expand Down
23 changes: 22 additions & 1 deletion packages/stream_chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 2.1.0

🛑️ Removed

- The `MessageTranslation` class has been removed. Use the new `i18n` field in the `Message` class instead.

✅ Added

- The `Message` class now has an `i18n` field for translations
- The `User` class now has a `language` field for the user's language preference.

🔄 Changed

- `client.user` is now deprecated in favor of `client.currentUser`.
- `client.userStream` is now deprecated in favor of `client.currentUserStream`.

🐞 Fixed

- [#563](https://github.com/GetStream/stream-chat-flutter/issues/563): `Channel.stopWatching()` not working
- [#575](https://github.com/GetStream/stream-chat-flutter/issues/575): Wrong `OwnUser.*`

## 2.0.0

🛑️ Breaking Changes from `1.5.3`
Expand Down Expand Up @@ -619,4 +640,4 @@

## 0.0.2

- first beta version
- first beta version
2 changes: 1 addition & 1 deletion packages/stream_chat/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,5 @@ class _MessageViewState extends State<MessageView> {
/// Helper extension for quickly retrieving
/// the current user id from a [StreamChatClient].
extension on StreamChatClient {
String get uid => state.user!.id;
String get uid => state.currentUser!.id;
}
35 changes: 18 additions & 17 deletions packages/stream_chat/lib/src/client/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ class Channel {

/// Returns true if the channel is muted
bool get isMuted =>
_client.state.user?.channelMutes
_client.state.currentUser?.channelMutes
.any((element) => element.channel.cid == cid) ==
true;

/// Returns true if the channel is muted as a stream
Stream<bool>? get isMutedStream => _client.state.userStream
Stream<bool>? get isMutedStream => _client.state.currentUserStream
.map((event) =>
event!.channelMutes.any((element) => element.channel.cid == cid) ==
true)
Expand Down Expand Up @@ -382,7 +382,7 @@ class Channel {
// ignore: parameter_assignments
message = message.copyWith(
createdAt: message.createdAt,
user: _client.state.user,
user: _client.state.currentUser,
quotedMessage: quotedMessage,
status: MessageSendingStatus.sending,
attachments: message.attachments.map(
Expand Down Expand Up @@ -693,7 +693,7 @@ class Channel {
_checkInitialized();
final messageId = message.id;
final now = DateTime.now();
final user = _client.state.user;
final user = _client.state.currentUser;

final latestReactions = [...message.latestReactions ?? <Reaction>[]];
if (enforceUnique) {
Expand Down Expand Up @@ -750,7 +750,7 @@ class Channel {
Future<EmptyResponse> deleteReaction(
Message message, Reaction reaction) async {
final type = reaction.type;
final user = _client.state.user;
final user = _client.state.currentUser;

final reactionCounts = {...message.reactionCounts ?? <String, int>{}};
if (reactionCounts.containsKey(type)) {
Expand Down Expand Up @@ -1314,7 +1314,7 @@ class ChannelClientState {

void _computeInitialUnread() {
final userRead = channelState.read.firstWhereOrNull(
(r) => r.user.id == _channel._client.state.user?.id,
(r) => r.user.id == _channel._client.state.currentUser?.id,
);
if (userRead != null) {
unreadCount = userRead.unreadMessages;
Expand Down Expand Up @@ -1431,7 +1431,7 @@ class ChannelClientState {

void _listenReactionDeleted() {
_subscriptions.add(_channel.on(EventType.reactionDeleted).listen((event) {
final userId = _channel.client.state.user!.id;
final userId = _channel.client.state.currentUser!.id;
final message = event.message!.copyWith(
ownReactions: [...event.message!.latestReactions!]
..removeWhere((it) => it.userId != userId),
Expand All @@ -1442,7 +1442,7 @@ class ChannelClientState {

void _listenReactions() {
_subscriptions.add(_channel.on(EventType.reactionNew).listen((event) {
final userId = _channel.client.state.user!.id;
final userId = _channel.client.state.currentUser!.id;
final message = event.message!.copyWith(
ownReactions: [...event.message!.latestReactions!]
..removeWhere((it) => it.userId != userId),
Expand All @@ -1458,7 +1458,7 @@ class ChannelClientState {
EventType.reactionUpdated,
)
.listen((event) {
final userId = _channel.client.state.user!.id;
final userId = _channel.client.state.currentUser!.id;
final message = event.message!.copyWith(
ownReactions: [...event.message!.latestReactions!]
..removeWhere((it) => it.userId != userId),
Expand Down Expand Up @@ -1552,7 +1552,7 @@ class ChannelClientState {

if (userReadIndex != null && userReadIndex != -1) {
final userRead = readList.removeAt(userReadIndex);
if (userRead.user.id == _channel._client.state.user!.id) {
if (userRead.user.id == _channel._client.state.currentUser!.id) {
unreadCount = 0;
}
readList.add(Read(
Expand Down Expand Up @@ -1642,11 +1642,12 @@ class ChannelClientState {
int get unreadCount => _unreadCountController.value;

bool _countMessageAsUnread(Message message) {
final userId = _channel.client.state.user?.id;
final userIsMuted = _channel.client.state.user?.mutes.firstWhereOrNull(
(m) => m.user.id == message.user?.id,
) !=
null;
final userId = _channel.client.state.currentUser?.id;
final userIsMuted =
_channel.client.state.currentUser?.mutes.firstWhereOrNull(
(m) => m.user.id == message.user?.id,
) !=
null;
return message.silent != true &&
message.shadowed != true &&
message.user?.id != userId &&
Expand Down Expand Up @@ -1795,7 +1796,7 @@ class ChannelClientState {
(event) {
if (event.user != null) {
final user = event.user!;
if (user.id != _channel.client.state.user?.id) {
if (user.id != _channel.client.state.currentUser?.id) {
_typings[user] = event;
_typingEventsController.add(_typings);
}
Expand All @@ -1808,7 +1809,7 @@ class ChannelClientState {
(event) {
if (event.user != null) {
final user = event.user!;
if (user.id != _channel.client.state.user?.id) {
if (user.id != _channel.client.state.currentUser?.id) {
_typings.remove(event.user);
_typingEventsController.add(_typings);
}
Expand Down
Loading

0 comments on commit b118167

Please sign in to comment.