Commit 6b7b0796 authored by Wilko Manger's avatar Wilko Manger

Check if it was a timeline load with RequestType

parent a9d84e49
......@@ -114,7 +114,7 @@ class Matrix {
delta: Map.fromEntries(
update.delta.rooms.map((room) => MapEntry(room.id, room)),
),
timelineLoad: update is RequestUpdate<Timeline>,
type: update is RequestUpdate ? update.type : null,
),
);
}
......@@ -126,7 +126,7 @@ class Matrix {
(update) => ChatUpdate(
chat: update.chats[roomId],
delta: update.delta[roomId],
timelineLoad: update.timelineLoad,
type: update.type,
),
)
.where((update) => update.delta != null);
......@@ -142,12 +142,12 @@ class ChatsUpdate {
final Map<RoomId, Chat> chats;
final Map<RoomId, Room> delta;
final bool timelineLoad;
final RequestType type;
ChatsUpdate({
@required this.chats,
@required this.delta,
@required this.timelineLoad,
@required this.type,
});
}
......@@ -155,11 +155,11 @@ class ChatUpdate {
final Chat chat;
final Room delta;
final bool timelineLoad;
final RequestType type;
ChatUpdate({
@required this.chat,
@required this.delta,
@required this.timelineLoad,
@required this.type,
});
}
......@@ -54,11 +54,12 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
) : _chat = _matrix.chats[roomId] {
_syncSub = _matrix.updatesFor(roomId).listen((update) {
_chat = update.chat;
print('${update.type}');
add(
RefreshChat(
chat: _chat,
delta: update.delta,
isBecauseOfTimelineRequest: update.timelineLoad,
isBecauseOfTimelineRequest: update.type == RequestType.loadRoomEvents,
),
);
});
......
......@@ -309,8 +309,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: b83a9df02dfa1e2933710eb71da530704096dd49
resolved-ref: b83a9df02dfa1e2933710eb71da530704096dd49
ref: "9231c27590eb2efbebb5f2b9cb792c1380d75622"
resolved-ref: "9231c27590eb2efbebb5f2b9cb792c1380d75622"
url: "https://git.pattle.im/pattle/library/matrix-dart-sdk.git"
source: git
version: "0.0.0"
......
......@@ -13,7 +13,7 @@ dependencies:
matrix_sdk:
git:
url: https://git.pattle.im/pattle/library/matrix-dart-sdk.git
ref: b83a9df02dfa1e2933710eb71da530704096dd49
ref: 9231c27590eb2efbebb5f2b9cb792c1380d75622
async: ^2.3.0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment