Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: v6.9.0 #1712

Merged
merged 48 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
346183b
feat(llc): add support for `channel.countUnreadMentions()`.
xsahil03x Aug 4, 2023
39b2686
chore: update CHANGELOG.md
xsahil03x Aug 4, 2023
4936675
chore: fix analysis.
xsahil03x Aug 4, 2023
62ca923
Merge pull request #1696 from GetStream/feat/countUnreadMentions
xsahil03x Aug 4, 2023
5371380
chore(deps): bump mocktail from 0.3.0 to 1.0.0 in /packages/stream_chat
dependabot[bot] Aug 7, 2023
332abc4
Update packages/stream_chat/pubspec.yaml
xsahil03x Aug 8, 2023
ae5a419
Merge pull request #1698 from GetStream/dependabot/pub/packages/strea…
xsahil03x Aug 8, 2023
caad0c5
chore(deps): bump mocktail in /packages/stream_chat_flutter_core
dependabot[bot] Aug 7, 2023
a4c862e
Update packages/stream_chat_flutter_core/pubspec.yaml
xsahil03x Aug 8, 2023
859770b
Merge pull request #1700 from GetStream/dependabot/pub/packages/strea…
xsahil03x Aug 8, 2023
f71bfb1
chore(deps): bump mocktail in /packages/stream_chat_persistence
dependabot[bot] Aug 7, 2023
f284534
Update packages/stream_chat_persistence/pubspec.yaml
xsahil03x Aug 8, 2023
e1c3deb
Merge pull request #1701 from GetStream/dependabot/pub/packages/strea…
xsahil03x Aug 8, 2023
ad65177
chore(deps): bump mocktail in /packages/stream_chat_flutter
dependabot[bot] Aug 7, 2023
31a5d54
Update packages/stream_chat_flutter/pubspec.yaml
xsahil03x Aug 8, 2023
1b3bf2e
Merge pull request #1699 from GetStream/dependabot/pub/packages/strea…
xsahil03x Aug 8, 2023
40af5a3
fix(llc): `channel.query` not initializing state.
xsahil03x Aug 10, 2023
2c10f3e
chore: update CHANGELOG.md
xsahil03x Aug 10, 2023
fb9ab5a
Merge pull request #1703 from GetStream/fix/channel.watch
xsahil03x Aug 11, 2023
cf8088e
fix(ui): fix replaceMentions not working with usernames.
xsahil03x Aug 11, 2023
1264fa1
chore: update CHANGELOG.md
xsahil03x Aug 11, 2023
229b236
Merge pull request #1706 from GetStream/fix/replace-mentions
xsahil03x Aug 11, 2023
5ea1855
feat(ui): Add support for listening errors in AttachmentPicker.
xsahil03x Aug 11, 2023
a58fed3
chore: update CHANGELOG.md
xsahil03x Aug 11, 2023
d226964
Merge pull request #1707 from GetStream/feat/attachment-picker-onError
xsahil03x Aug 11, 2023
67006dd
allow override reactions tap
Aug 10, 2023
8e55771
fix format
Aug 10, 2023
4ea732b
chore: update CHANGELOG.md
xsahil03x Aug 16, 2023
e5d593a
Merge pull request #1705 from GetStream/fix/reactions-tap
xsahil03x Aug 16, 2023
27074dd
fix(ui): fix video player controls getting hidden.
xsahil03x Aug 16, 2023
8df5853
chore: update CHANGELOG.md
xsahil03x Aug 16, 2023
c19bea0
chore: fix analysis.
xsahil03x Aug 16, 2023
f7e676b
Merge pull request #1709 from GetStream/fix/hidden-video-controls
xsahil03x Aug 16, 2023
875ff93
chore(repo): updated minimum supported SDK version to Flutter 3.10/Da…
xsahil03x Jul 12, 2023
7adc99f
feat(ui): add support for `StreamMessageInput.contentInsertionConfigu…
xsahil03x Jun 19, 2023
4f6fbe9
chore(ui): bump jiffy to v6.2.1
xsahil03x Jun 22, 2023
015628b
chore(localization): bump stream_chat_flutter
xsahil03x Jun 22, 2023
5e8c860
chore: minor change.
xsahil03x Jun 22, 2023
b34f725
chore: migrate loadBuffer to loadImage.
xsahil03x Jul 13, 2023
d684e74
chore(ui): fix lint.
xsahil03x Aug 17, 2023
7c495ad
chore(llc, core, persistence, ui, localization): bump dependencies, u…
xsahil03x Aug 17, 2023
046b696
fix(ui): fix for flutter 3.13
xsahil03x Aug 17, 2023
d94f96b
chore: fix lints.
xsahil03x Aug 17, 2023
8e3e150
chore(ci): update workflows.
xsahil03x Aug 17, 2023
20fe69c
chore: repo dart min version.
xsahil03x Aug 17, 2023
715c145
Merge pull request #1711 from GetStream/chore/bump_min_3.10
xsahil03x Aug 17, 2023
6d23a3b
chore(repo): prepare for release.
xsahil03x Aug 17, 2023
8ba2f57
chore(persistence): run build runner.
xsahil03x Aug 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/legacy_version_analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: legacy_version_analyze
env:
# Note: The versions below should be manually updated after a new stable
# version comes out.
flutter_version: "3.7.12"
flutter_version: "3.10.6"

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stream_flutter_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: stream_flutter_workflow

env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
flutter_version: "3.10.4"
flutter_channel: "stable"

on:
pull_request:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.flutter_version }}
channel: ${{ env.flutter_channel }}
- name: "Install Tools"
run: |
flutter pub global activate melos
Expand Down
15 changes: 15 additions & 0 deletions packages/stream_chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 6.8.0

🐞 Fixed

- Fixed `Channel.query` not initializing `ChannelState`.

✅ Added

- Added support for `channel.countUnreadMentions()` to get the count of unread messages mentioning the current user on a
channel. [#1692](https://github.com/GetStream/stream-chat-flutter/issues/1692)

🔄 Changed

- Updated minimum supported `SDK` version to Dart 3.0

## 6.7.0

✅ Added
Expand Down
4 changes: 2 additions & 2 deletions packages/stream_chat/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ publish_to: "none"
version: 1.0.0+1

environment:
sdk: '>=2.19.0 <4.0.0'
flutter: ">=3.7.0"
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"

dependencies:
cupertino_icons: ^1.0.5
Expand Down
128 changes: 83 additions & 45 deletions packages/stream_chat/lib/src/client/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1339,26 +1339,6 @@ class Channel {
return _client.markChannelRead(id!, type, messageId: messageId);
}

/// Loads the initial channel state and watches for changes.
Future<ChannelState> watch({bool presence = false}) async {
ChannelState response;

try {
response = await query(watch: true, presence: presence);
} catch (error, stackTrace) {
if (!_initializedCompleter.isCompleted) {
_initializedCompleter.completeError(error, stackTrace);
}
rethrow;
}

if (state == null) {
_initState(response);
}

return response;
}

void _initState(ChannelState channelState) {
state = ChannelClientState(this, channelState);

Expand All @@ -1370,6 +1350,22 @@ class Channel {
}
}

/// Loads the initial channel state and watches for changes.
Future<ChannelState> watch({
bool presence = false,
PaginationParams? messagesPagination,
PaginationParams? membersPagination,
PaginationParams? watchersPagination,
}) {
return query(
watch: true,
presence: presence,
messagesPagination: messagesPagination,
membersPagination: membersPagination,
watchersPagination: watchersPagination,
);
}

/// Stop watching the channel.
Future<EmptyResponse> stopWatching() async {
_checkInitialized();
Expand Down Expand Up @@ -1435,7 +1431,7 @@ class Channel {
);

/// Creates a new channel.
Future<ChannelState> create() async => query(state: false);
Future<ChannelState> create() => query(state: false);

/// Query the API, get messages, members or other channel fields.
///
Expand All @@ -1450,23 +1446,28 @@ class Channel {
PaginationParams? watchersPagination,
bool preferOffline = false,
}) async {
if (preferOffline && cid != null) {
final updatedState = await _client.chatPersistenceClient
?.getChannelStateByCid(cid!, messagePagination: messagesPagination);
if (updatedState != null &&
updatedState.messages != null &&
updatedState.messages!.isNotEmpty) {
if (this.state == null) {
_initState(updatedState);
} else {
this.state?.updateChannelState(updatedState);
ChannelState? channelState;

try {
// If we prefer offline, we first try to get the channel state from the
// offline storage.
if (preferOffline && !watch && cid != null) {
final persistenceClient = _client.chatPersistenceClient;
if (persistenceClient != null) {
final cachedState = await persistenceClient.getChannelStateByCid(
cid!,
messagePagination: messagesPagination,
);

// If the cached state contains messages, we can use it.
if (cachedState.messages?.isNotEmpty == true) {
channelState = cachedState;
}
}
return updatedState;
}
}

try {
final updatedState = await _client.queryChannel(
// If we still don't have the channelState, we try to get it from the API.
channelState ??= await _client.queryChannel(
type,
channelId: id,
channelData: _extraData,
Expand All @@ -1479,18 +1480,35 @@ class Channel {
);

if (_id == null) {
_id = updatedState.channel!.id;
_cid = updatedState.channel!.cid;
_id = channelState.channel!.id;
_cid = channelState.channel!.cid;
}

this.state?.updateChannelState(updatedState);
return updatedState;
} catch (e) {
if (_client.persistenceEnabled) {
return _client.chatPersistenceClient!.getChannelStateByCid(
cid!,
messagePagination: messagesPagination,
);
// Initialize the channel state if it's not initialized yet.
if (this.state == null) {
_initState(channelState);
} else {
// Otherwise, update the channel state.
this.state?.updateChannelState(channelState);
}

return channelState;
} catch (e, stk) {
// If we failed to get the channel state from the API and we were not
// supposed to watch the channel, we will try to get the channel state
// from the offline storage.
if (watch == false) {
if (_client.persistenceEnabled) {
return _client.chatPersistenceClient!.getChannelStateByCid(
cid!,
messagePagination: messagesPagination,
);
}
}

// Otherwise, we will just rethrow the error.
if (!_initializedCompleter.isCompleted) {
_initializedCompleter.completeError(e, stk);
}

rethrow;
Expand Down Expand Up @@ -2334,6 +2352,26 @@ class ChannelClientState {
!isThreadMessage;
}

/// Counts the number of unread messages mentioning the current user.
///
/// **NOTE**: The method relies on the [Channel.messages] list and doesn't do
/// any API call. Therefore, the count might be not reliable as it relies on
/// the local data.
int countUnreadMentions() {
final lastRead = currentUserRead?.lastRead;
final userId = _channel.client.state.currentUser?.id;

var count = 0;
for (final message in messages) {
if (_countMessageAsUnread(message) &&
(lastRead == null || message.createdAt.isAfter(lastRead)) &&
message.mentionedUsers.any((user) => user.id == userId) == true) {
count++;
}
}
return count;
}

/// Update threads with updated information about messages.
void updateThreadInfo(String parentId, List<Message> messages) {
final newThreads = Map<String, List<Message>>.from(threads);
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat/lib/src/client/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ class ClientState {
void updateUsers(List<User?> userList) {
final newUsers = {
...users,
for (var user in userList)
for (final user in userList)
if (user != null) user.id: user,
};
_usersController.add(newUsers);
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat/lib/src/ws/timer_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:async';
import 'package:uuid/uuid.dart';

///
class TimerHelper {
mixin class TimerHelper {
final _uuid = const Uuid();
late final _timers = <String, Timer>{};

Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat/lib/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import 'package:stream_chat/src/client/client.dart';
/// Current package version
/// Used in [StreamChatClient] to build the `x-stream-client` header
// ignore: constant_identifier_names
const PACKAGE_VERSION = '6.7.0';
const PACKAGE_VERSION = '6.8.0';
26 changes: 13 additions & 13 deletions packages/stream_chat/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: stream_chat
homepage: https://getstream.io/
description: The official Dart client for Stream Chat, a service for building chat applications.
version: 6.7.0
version: 6.8.0
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues

environment:
sdk: '>=2.19.0 <4.0.0'
sdk: '>=3.0.0 <4.0.0'

dependencies:
async: ^2.10.0
collection: ^1.17.0
dio: ^5.2.1+1
async: ^2.11.0
collection: ^1.17.1
dio: ^5.3.2
equatable: ^2.0.5
freezed_annotation: ^2.2.0
freezed_annotation: ^2.4.1
http_parser: ^4.0.2
jose: ^0.3.3
jose: ^0.3.4
json_annotation: ^4.8.1
logging: ^1.2.0
meta: ^1.8.0
meta: ^1.9.1
mime: ^1.0.4
rate_limiter: ^1.0.0
rxdart: ^0.27.7
Expand All @@ -27,8 +27,8 @@ dependencies:
web_socket_channel: ^2.4.0

dev_dependencies:
build_runner: ^2.3.3
freezed: ^2.4.0
json_serializable: ^6.6.2
mocktail: ^0.3.0
test: ^1.24.3
build_runner: ^2.4.6
freezed: ^2.4.2
json_serializable: ^6.7.1
mocktail: ^1.0.0
test: ^1.24.6
2 changes: 1 addition & 1 deletion packages/stream_chat/test/src/client/client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ void main() {
// skipping initial seed event -> {} users
client.state.usersStream.skip(1),
emitsInOrder([
{for (var user in users) user.id: user},
{for (final user in users) user.id: user},
]),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: invalid_use_of_protected_member

import 'package:dio/dio.dart';
import 'package:stream_chat/src/core/http/interceptor/additional_headers_interceptor.dart';
import 'package:stream_chat/stream_chat.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: invalid_use_of_protected_member

import 'package:dio/dio.dart';
import 'package:mocktail/mocktail.dart';
import 'package:stream_chat/src/core/http/interceptor/auth_interceptor.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: invalid_use_of_protected_member

import 'package:dio/dio.dart';
import 'package:mocktail/mocktail.dart';
import 'package:stream_chat/src/core/http/connection_id_manager.dart';
Expand Down
Loading