Merge pull request #101 from GetStream/feature/offlineStorage
update llc dependency and hotfixes
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
## 0.2.9+1
|
||||||
|
|
||||||
|
- Update llc dependency
|
||||||
|
- Minor bug fixes
|
||||||
|
|
||||||
## 0.2.9
|
## 0.2.9
|
||||||
|
|
||||||
- Update llc dependency
|
- Update llc dependency
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
|
version: 1.0.20+21
|
||||||
version: 1.0.12+13
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ class ChannelsBlocState extends State<ChannelsBloc>
|
|||||||
newChannels.insert(0, _hiddenChannels[hiddenIndex]);
|
newChannels.insert(0, _hiddenChannels[hiddenIndex]);
|
||||||
_hiddenChannels.removeAt(hiddenIndex);
|
_hiddenChannels.removeAt(hiddenIndex);
|
||||||
} else {
|
} else {
|
||||||
if (client.state.channels[e.cid] != null) {
|
if (client.state?.channels != null &&
|
||||||
|
client.state?.channels[e.cid] != null) {
|
||||||
newChannels.insert(0, client.state.channels[e.cid]);
|
newChannels.insert(0, client.state.channels[e.cid]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class MessageListView extends StatefulWidget {
|
|||||||
class _MessageListViewState extends State<MessageListView> {
|
class _MessageListViewState extends State<MessageListView> {
|
||||||
static const _newMessageLoadingOffset = 100;
|
static const _newMessageLoadingOffset = 100;
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
bool _isBottom = true;
|
bool _bottomWasVisible = true;
|
||||||
bool _topWasVisible = false;
|
bool _topWasVisible = false;
|
||||||
List<Message> _messages = [];
|
List<Message> _messages = [];
|
||||||
List<Message> _newMessageList = [];
|
List<Message> _newMessageList = [];
|
||||||
@@ -333,7 +333,11 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
onVisibilityChanged: (visibility) {
|
onVisibilityChanged: (visibility) {
|
||||||
final topIsVisible = visibility.visibleBounds != Rect.zero;
|
final topIsVisible = visibility.visibleBounds != Rect.zero;
|
||||||
if (topIsVisible && !_topWasVisible) {
|
if (topIsVisible && !_topWasVisible) {
|
||||||
streamChannel.queryMessages();
|
if (widget.parentMessage == null) {
|
||||||
|
streamChannel.queryMessages();
|
||||||
|
} else {
|
||||||
|
streamChannel.getReplies(widget.parentMessage.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_topWasVisible = topIsVisible;
|
_topWasVisible = topIsVisible;
|
||||||
},
|
},
|
||||||
@@ -368,12 +372,15 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
return VisibilityDetector(
|
return VisibilityDetector(
|
||||||
key: ValueKey<String>('BOTTOM-MESSAGE'),
|
key: ValueKey<String>('BOTTOM-MESSAGE'),
|
||||||
onVisibilityChanged: (visibility) {
|
onVisibilityChanged: (visibility) {
|
||||||
_isBottom = visibility.visibleBounds != Rect.zero;
|
final isVisible = visibility.visibleBounds != Rect.zero;
|
||||||
if (_isBottom && streamChannel.channel.config?.readEvents == true) {
|
if (isVisible &&
|
||||||
|
!_bottomWasVisible &&
|
||||||
|
streamChannel.channel.config?.readEvents == true) {
|
||||||
if (streamChannel.channel.state.unreadCount > 0) {
|
if (streamChannel.channel.state.unreadCount > 0) {
|
||||||
streamChannel.channel.markRead();
|
streamChannel.channel.markRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_bottomWasVisible = isVisible;
|
||||||
},
|
},
|
||||||
child: messageWidget,
|
child: messageWidget,
|
||||||
);
|
);
|
||||||
@@ -437,7 +444,8 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
?.read
|
?.read
|
||||||
?.where((element) => element.user.id != userId)
|
?.where((element) => element.user.id != userId)
|
||||||
?.where((read) =>
|
?.where((read) =>
|
||||||
read.lastRead.isAfter(message.createdAt) &&
|
(read.lastRead.isAfter(message.createdAt) ||
|
||||||
|
read.lastRead.isAtSameMomentAs(message.createdAt)) &&
|
||||||
(index == 0 ||
|
(index == 0 ||
|
||||||
read.lastRead.isBefore(messages[index - 1].createdAt)))
|
read.lastRead.isBefore(messages[index - 1].createdAt)))
|
||||||
?.toList();
|
?.toList();
|
||||||
@@ -483,9 +491,6 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
final streamChannel = StreamChannel.of(context);
|
final streamChannel = StreamChannel.of(context);
|
||||||
if (streamChannel.channel.state.unreadCount > 0) {
|
|
||||||
streamChannel.channel.markRead();
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream<List<Message>> stream;
|
Stream<List<Message>> stream;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
|
|
||||||
/// Calls [channel.query] updating [queryMessage] stream
|
/// Calls [channel.query] updating [queryMessage] stream
|
||||||
void queryMessages() {
|
void queryMessages() {
|
||||||
if (_paginationEnded) {
|
if (_queryMessageController.value == true || _paginationEnded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,15 +65,18 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
firstId = channel.state.messages.first.id;
|
firstId = channel.state.messages.first.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final messageLimit = 50;
|
||||||
|
|
||||||
widget.channel
|
widget.channel
|
||||||
.query(
|
.query(
|
||||||
messagesPagination: PaginationParams(
|
messagesPagination: PaginationParams(
|
||||||
lessThan: firstId,
|
lessThan: firstId,
|
||||||
limit: 100,
|
limit: messageLimit,
|
||||||
),
|
),
|
||||||
|
preferOffline: true,
|
||||||
)
|
)
|
||||||
.then((res) {
|
.then((res) {
|
||||||
if (res.messages.isEmpty) {
|
if (res.messages.isEmpty || res.messages.length < messageLimit) {
|
||||||
_paginationEnded = true;
|
_paginationEnded = true;
|
||||||
}
|
}
|
||||||
_queryMessageController.add(false);
|
_queryMessageController.add(false);
|
||||||
@@ -84,7 +87,7 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
|
|
||||||
/// Calls [channel.getReplies] updating [queryMessage] stream
|
/// Calls [channel.getReplies] updating [queryMessage] stream
|
||||||
Future<void> getReplies(String parentId) async {
|
Future<void> getReplies(String parentId) async {
|
||||||
if (_paginationEnded) {
|
if (_queryMessageController.value == true || _paginationEnded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,16 +102,18 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final messageLimit = 50;
|
||||||
return widget.channel
|
return widget.channel
|
||||||
.getReplies(
|
.getReplies(
|
||||||
parentId,
|
parentId,
|
||||||
PaginationParams(
|
PaginationParams(
|
||||||
lessThan: firstId,
|
lessThan: firstId,
|
||||||
limit: 100,
|
limit: messageLimit,
|
||||||
),
|
),
|
||||||
|
preferOffline: true,
|
||||||
)
|
)
|
||||||
.then((res) {
|
.then((res) {
|
||||||
if (res.messages.isEmpty) {
|
if (res.messages.isEmpty || res.messages.length < messageLimit) {
|
||||||
_paginationEnded = true;
|
_paginationEnded = true;
|
||||||
}
|
}
|
||||||
_queryMessageController.add(false);
|
_queryMessageController.add(false);
|
||||||
|
|||||||
@@ -82,9 +82,12 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
child: showBackButton
|
child: showBackButton
|
||||||
? StreamBackButton(
|
? AspectRatio(
|
||||||
onPressed: onBackPressed,
|
aspectRatio: 1,
|
||||||
icon: Icons.close,
|
child: StreamBackButton(
|
||||||
|
onPressed: onBackPressed,
|
||||||
|
icon: Icons.close,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: SizedBox(),
|
: SizedBox(),
|
||||||
),
|
),
|
||||||
|
|||||||
+2
-2
@@ -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: 0.2.9
|
version: 0.2.9+1
|
||||||
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
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ dependencies:
|
|||||||
file_picker: ^2.0.0
|
file_picker: ^2.0.0
|
||||||
image_picker: ^0.6.7+2
|
image_picker: ^0.6.7+2
|
||||||
flutter_keyboard_visibility: ^3.2.1
|
flutter_keyboard_visibility: ^3.2.1
|
||||||
stream_chat: ^0.2.6
|
stream_chat: ^0.2.7+1
|
||||||
mime: ^0.9.6+3
|
mime: ^0.9.6+3
|
||||||
visibility_detector: ^0.1.5
|
visibility_detector: ^0.1.5
|
||||||
http_parser: ^3.1.4
|
http_parser: ^3.1.4
|
||||||
|
|||||||
Reference in New Issue
Block a user