Merge branch 'room-fix-storeless-timeline' into 'master'

[Room] Fix storeless timeline

See merge request famedly/famedlysdk!167
This commit is contained in:
Christian Pauly 2020-01-23 10:52:22 +00:00
commit bc2ca9749c
1 changed files with 8 additions and 8 deletions

View File

@ -729,19 +729,19 @@ class Room {
Future<Timeline> getTimeline( Future<Timeline> getTimeline(
{onTimelineUpdateCallback onUpdate, {onTimelineUpdateCallback onUpdate,
onTimelineInsertCallback onInsert}) async { onTimelineInsertCallback onInsert}) async {
List<Event> events = []; List<Event> events =
if (client.store != null) { client.store != null ? await client.store.getEventList(this) : [];
events = await client.store.getEventList(this); Timeline timeline = Timeline(
} else {
prev_batch = "";
await requestHistory();
}
return Timeline(
room: this, room: this,
events: events, events: events,
onUpdate: onUpdate, onUpdate: onUpdate,
onInsert: onInsert, onInsert: onInsert,
); );
if (client.store == null) {
prev_batch = "";
await requestHistory();
}
return timeline;
} }
/// Load all participants for a given room from the store. /// Load all participants for a given room from the store.