Merge branch 'room-timeline-onupdate' into 'main'

feat: expose Timeline.onChange to Room.getTimeline

See merge request famedly/company/frontend/famedlysdk!943
This commit is contained in:
Krille Fear 2022-01-26 12:16:07 +00:00
commit f8a2a603ad
1 changed files with 9 additions and 4 deletions

View File

@ -1117,9 +1117,12 @@ class Room {
}
/// Creates a timeline from the store. Returns a [Timeline] object.
Future<Timeline> getTimeline(
{void Function()? onUpdate,
void Function(int insertID)? onInsert}) async {
Future<Timeline> getTimeline({
void Function(int index)? onChange,
void Function(int index)? onRemove,
void Function(int insertID)? onInsert,
void Function()? onUpdate,
}) async {
await postLoad();
var events;
events = await client.database?.getEventList(
@ -1144,8 +1147,10 @@ class Room {
final timeline = Timeline(
room: this,
events: events,
onUpdate: onUpdate,
onChange: onChange,
onRemove: onRemove,
onInsert: onInsert,
onUpdate: onUpdate,
);
if (client.database == null) {
await requestHistory(historyCount: 10);