Merge branch 'krille/implement-canrequesthistory' into 'main'
feat: Implement can request history calculation See merge request famedly/famedlysdk!659
This commit is contained in:
commit
5431056c1c
|
|
@ -68,6 +68,11 @@ class Timeline {
|
|||
bool _collectHistoryUpdates = false;
|
||||
final Set<EventUpdate> _historyUpdates = <EventUpdate>{};
|
||||
|
||||
bool get canRequestHistory {
|
||||
if (events.isEmpty) return true;
|
||||
return events.last.type != EventTypes.RoomCreate;
|
||||
}
|
||||
|
||||
Future<void> requestHistory(
|
||||
{int historyCount = Room.DefaultHistoryCount}) async {
|
||||
if (!isRequestingHistory) {
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ void main() {
|
|||
|
||||
test('Request history', () async {
|
||||
timeline.events.clear();
|
||||
expect(timeline.canRequestHistory, true);
|
||||
await room.requestHistory();
|
||||
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
|
|
|
|||
Loading…
Reference in New Issue