Merge branch 'develop' of https://github.com/GetStream/stream-chat-flutter into fix/indicator

 Conflicts:
	packages/stream_chat/CHANGELOG.md
This commit is contained in:
Deven Joshi
2021-11-22 14:27:48 +05:30
13 changed files with 152 additions and 29 deletions
+8 -1
View File
@@ -2,8 +2,15 @@
🐞 Fixed
- `closeConnection()` now uses `normalClosure` status when closing websocket.
- Fixed unread count indicator
## Upcoming
✅ Added
- Extra properties added to `PaginationParams` to aid in fetching messages.
## 3.2.0
🐞 Fixed
@@ -726,4 +733,4 @@
## 0.0.2
- first beta version
- first beta version
@@ -60,8 +60,11 @@ class PaginationParams extends Equatable {
/// ```
const PaginationParams({
this.limit = 10,
this.before = 10,
this.after = 10,
this.offset,
this.next,
this.idAround,
this.greaterThan,
this.greaterThanOrEqual,
this.lessThan,
@@ -78,12 +81,22 @@ class PaginationParams extends Equatable {
/// The amount of items requested from the APIs.
final int limit;
/// The amount of items requested before message ID from the APIs.
final int before;
/// The amount of items requested after message ID from the APIs.
final int after;
/// The offset of requesting items.
final int? offset;
/// A key used to paginate.
final String? next;
/// Message ID to fetch messages around
@JsonKey(name: 'id_around')
final String? idAround;
/// Filter on ids greater than the given value.
@JsonKey(name: 'id_gt')
final String? greaterThan;
@@ -106,7 +119,10 @@ class PaginationParams extends Equatable {
/// Creates a copy of [PaginationParams] with specified attributes overridden.
PaginationParams copyWith({
int? limit,
int? before,
int? after,
int? offset,
String? idAround,
String? next,
String? greaterThan,
String? greaterThanOrEqual,
@@ -115,7 +131,10 @@ class PaginationParams extends Equatable {
}) =>
PaginationParams(
limit: limit ?? this.limit,
before: before ?? this.before,
after: limit ?? this.after,
offset: offset ?? this.offset,
idAround: idAround ?? this.idAround,
next: next ?? this.next,
greaterThan: greaterThan ?? this.greaterThan,
greaterThanOrEqual: greaterThanOrEqual ?? this.greaterThanOrEqual,
@@ -126,8 +145,11 @@ class PaginationParams extends Equatable {
@override
List<Object?> get props => [
limit,
before,
after,
offset,
next,
idAround,
greaterThan,
greaterThanOrEqual,
lessThan,
@@ -21,8 +21,11 @@ Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) =>
PaginationParams _$PaginationParamsFromJson(Map<String, dynamic> json) =>
PaginationParams(
limit: json['limit'] as int? ?? 10,
before: json['before'] as int? ?? 10,
after: json['after'] as int? ?? 10,
offset: json['offset'] as int?,
next: json['next'] as String?,
idAround: json['id_around'] as String?,
greaterThan: json['id_gt'] as String?,
greaterThanOrEqual: json['id_gte'] as String?,
lessThan: json['id_lt'] as String?,
@@ -32,6 +35,8 @@ PaginationParams _$PaginationParamsFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
final val = <String, dynamic>{
'limit': instance.limit,
'before': instance.before,
'after': instance.after,
};
void writeNotNull(String key, dynamic value) {
@@ -42,6 +47,7 @@ Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
writeNotNull('offset', instance.offset);
writeNotNull('next', instance.next);
writeNotNull('id_around', instance.idAround);
writeNotNull('id_gt', instance.greaterThan);
writeNotNull('id_gte', instance.greaterThanOrEqual);
writeNotNull('id_lt', instance.lessThan);
@@ -121,7 +121,8 @@ class WebSocket with TimerHelper {
_logger?.info('Closing connection with $baseUrl');
if (_webSocketChannel != null) {
_unsubscribeFromWebSocketChannel();
_webSocketChannel?.sink.close(status.goingAway);
_webSocketChannel?.sink
.close(_manuallyClosed ? status.normalClosure : status.goingAway);
_webSocketChannel = null;
}
}