@@ -1,3 +1,7 @@
|
|||||||
|
## 1.3.1-beta
|
||||||
|
|
||||||
|
- Debounced frequent db calls
|
||||||
|
|
||||||
## 1.3.0-beta
|
## 1.3.0-beta
|
||||||
|
|
||||||
- Save pinned messages in offline storage
|
- Save pinned messages in offline storage
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:stream_chat/src/api/retry_queue.dart';
|
import 'package:stream_chat/src/api/retry_queue.dart';
|
||||||
|
import 'package:stream_chat/src/debounce.dart';
|
||||||
import 'package:stream_chat/src/event_type.dart';
|
import 'package:stream_chat/src/event_type.dart';
|
||||||
import 'package:stream_chat/src/models/attachment_file.dart';
|
import 'package:stream_chat/src/models/attachment_file.dart';
|
||||||
import 'package:stream_chat/src/models/channel_state.dart';
|
import 'package:stream_chat/src/models/channel_state.dart';
|
||||||
@@ -237,9 +238,15 @@ class Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSendProgress(int sent, int total) {
|
void onSendProgress(int sent, int total) {
|
||||||
updateAttachment(it.copyWith(
|
debounce(
|
||||||
uploadState: UploadState.inProgress(uploaded: sent, total: total),
|
timeout: Duration(seconds: 1),
|
||||||
));
|
target: updateAttachment,
|
||||||
|
positionalArguments: [
|
||||||
|
it.copyWith(
|
||||||
|
uploadState: UploadState.inProgress(uploaded: sent, total: total),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final isImage = it.type == 'image';
|
final isImage = it.type == 'image';
|
||||||
@@ -1441,7 +1448,7 @@ class ChannelClientState {
|
|||||||
|
|
||||||
final oldIndex = newMessages.indexWhere((m) => m.id == message.id);
|
final oldIndex = newMessages.indexWhere((m) => m.id == message.id);
|
||||||
if (oldIndex != -1) {
|
if (oldIndex != -1) {
|
||||||
newMessages[oldIndex] = newMessages[oldIndex].merge(message);
|
newMessages[oldIndex] = message;
|
||||||
} else {
|
} else {
|
||||||
newMessages.add(message);
|
newMessages.add(message);
|
||||||
}
|
}
|
||||||
@@ -1685,7 +1692,11 @@ class ChannelClientState {
|
|||||||
|
|
||||||
set _channelState(ChannelState v) {
|
set _channelState(ChannelState v) {
|
||||||
_channelStateController.add(v);
|
_channelStateController.add(v);
|
||||||
_channel._client.chatPersistenceClient?.updateChannelState(v);
|
debounce(
|
||||||
|
timeout: Duration(milliseconds: 500),
|
||||||
|
target: _channel._client.chatPersistenceClient?.updateChannelState,
|
||||||
|
positionalArguments: [v],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The channel threads related to this channel
|
/// The channel threads related to this channel
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class RetryQueue {
|
|||||||
|
|
||||||
/// Add a list of messages
|
/// Add a list of messages
|
||||||
void add(List<Message> messages) {
|
void add(List<Message> messages) {
|
||||||
|
logger?.info('added ${messages.length} messages');
|
||||||
final messageList = _messageQueue.toList();
|
final messageList = _messageQueue.toList();
|
||||||
_messageQueue.addAll(messages
|
_messageQueue.addAll(messages
|
||||||
.where((element) => !messageList.any((m) => m.id == element.id)));
|
.where((element) => !messageList.any((m) => m.id == element.id)));
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
|
/// Map of timeouts being debounced
|
||||||
|
Map<Function, Timer> timeouts = {};
|
||||||
|
|
||||||
|
/// Runs a function avoiding calling it too many times in a [timeoutMS] window
|
||||||
|
void debounce({
|
||||||
|
@required Duration timeout,
|
||||||
|
@required Function target,
|
||||||
|
List positionalArguments,
|
||||||
|
Map<Symbol, dynamic> namedArguments,
|
||||||
|
}) {
|
||||||
|
if (timeouts.containsKey(target)) {
|
||||||
|
timeouts[target].cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
final timer = Timer(timeout, () {
|
||||||
|
Function.apply(
|
||||||
|
target,
|
||||||
|
positionalArguments,
|
||||||
|
namedArguments,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
timeouts[target] = timer;
|
||||||
|
}
|
||||||
@@ -2,4 +2,4 @@ import 'package:stream_chat/src/client.dart';
|
|||||||
|
|
||||||
/// Current package version
|
/// Current package version
|
||||||
/// Used in [StreamChatClient] to build the `x-stream-client` header
|
/// Used in [StreamChatClient] to build the `x-stream-client` header
|
||||||
const PACKAGE_VERSION = '1.3.0-beta';
|
const PACKAGE_VERSION = '1.3.1-beta';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: stream_chat
|
name: stream_chat
|
||||||
homepage: https://getstream.io/
|
homepage: https://getstream.io/
|
||||||
description: The official Dart client for Stream Chat, a service for building chat applications.
|
description: The official Dart client for Stream Chat, a service for building chat applications.
|
||||||
version: 1.3.0-beta
|
version: 1.3.1-beta
|
||||||
repository: https://github.com/GetStream/stream-chat-flutter
|
repository: https://github.com/GetStream/stream-chat-flutter
|
||||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## 1.3.1-beta
|
||||||
|
|
||||||
|
- Updated `stream_chat_core` dependency
|
||||||
|
- Fixed minor bugs
|
||||||
|
|
||||||
## 1.3.0-beta
|
## 1.3.0-beta
|
||||||
|
|
||||||
- Added `MessageInputTheme`
|
- Added `MessageInputTheme`
|
||||||
@@ -5,12 +10,12 @@
|
|||||||
- Delete only image on imagegallery
|
- Delete only image on imagegallery
|
||||||
- Close keyboard after sending a command
|
- Close keyboard after sending a command
|
||||||
- Exposed `customAttachmentBuilders` through `MessageListView`
|
- Exposed `customAttachmentBuilders` through `MessageListView`
|
||||||
- Update `stream_chat_core` dependency
|
- Updated `stream_chat_core` dependency
|
||||||
|
|
||||||
## 1.2.0-beta
|
## 1.2.0-beta
|
||||||
|
|
||||||
- Minor fixes
|
- Minor fixes
|
||||||
- Update `stream_chat_core` dependency
|
- Updated `stream_chat_core` dependency
|
||||||
|
|
||||||
## 1.1.1-beta
|
## 1.1.1-beta
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
|
|||||||
messageSearchBloc.search(
|
messageSearchBloc.search(
|
||||||
filter: {
|
filter: {
|
||||||
'cid': {
|
'cid': {
|
||||||
r'$in': ['messaging:${StreamChannel.of(context).channel.id}']
|
r'$in': [StreamChannel.of(context).channel.cid]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
messageFilter: {
|
messageFilter: {
|
||||||
@@ -146,7 +146,7 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
|
|||||||
onEndOfPage: () => messageSearchBloc.loadMore(
|
onEndOfPage: () => messageSearchBloc.loadMore(
|
||||||
filter: {
|
filter: {
|
||||||
'cid': {
|
'cid': {
|
||||||
r'$in': ['messaging:${StreamChannel.of(context).channel.id}']
|
r'$in': [StreamChannel.of(context).channel.cid]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
messageFilter: {
|
messageFilter: {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
|
|||||||
messageSearchBloc.search(
|
messageSearchBloc.search(
|
||||||
filter: {
|
filter: {
|
||||||
'cid': {
|
'cid': {
|
||||||
r'$in': ['messaging:${StreamChannel.of(context).channel.id}']
|
r'$in': [StreamChannel.of(context).channel.cid],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
messageFilter: {
|
messageFilter: {
|
||||||
@@ -169,7 +169,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
|
|||||||
onEndOfPage: () => messageSearchBloc.loadMore(
|
onEndOfPage: () => messageSearchBloc.loadMore(
|
||||||
filter: {
|
filter: {
|
||||||
'cid': {
|
'cid': {
|
||||||
r'$in': ['messaging:${StreamChannel.of(context).channel.id}']
|
r'$in': [StreamChannel.of(context).channel.cid]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
messageFilter: {
|
messageFilter: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: stream_chat_flutter
|
name: stream_chat_flutter
|
||||||
homepage: https://github.com/GetStream/stream-chat-flutter
|
homepage: https://github.com/GetStream/stream-chat-flutter
|
||||||
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
||||||
version: 1.3.0-beta
|
version: 1.3.1-beta
|
||||||
repository: https://github.com/GetStream/stream-chat-flutter
|
repository: https://github.com/GetStream/stream-chat-flutter
|
||||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.3.1-beta
|
||||||
|
|
||||||
|
* Update llc dependency
|
||||||
|
|
||||||
## 1.3.0-beta
|
## 1.3.0-beta
|
||||||
|
|
||||||
* Update llc dependency
|
* Update llc dependency
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: stream_chat_flutter_core
|
name: stream_chat_flutter_core
|
||||||
homepage: https://github.com/GetStream/stream-chat-flutter
|
homepage: https://github.com/GetStream/stream-chat-flutter
|
||||||
description: Stream Chat official Flutter SDK Core. Build your own chat experience using Dart and Flutter.
|
description: Stream Chat official Flutter SDK Core. Build your own chat experience using Dart and Flutter.
|
||||||
version: 1.3.0-beta
|
version: 1.3.1-beta
|
||||||
repository: https://github.com/GetStream/stream-chat-flutter
|
repository: https://github.com/GetStream/stream-chat-flutter
|
||||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ environment:
|
|||||||
flutter: ">=1.17.0"
|
flutter: ">=1.17.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
stream_chat: ^1.3.0-beta
|
stream_chat: ^1.3.1-beta
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
rxdart: ^0.25.0
|
rxdart: ^0.25.0
|
||||||
|
|||||||
Reference in New Issue
Block a user