From 91617c18925b629168ccb444e16cf2ede9bf4153 Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 28 Apr 2023 09:15:12 +0200 Subject: [PATCH] refactor: Make optional eventId a named parameter This should not break the API of consuming apps and is more intuitive as the parameter is nullable. --- lib/src/timeline.dart | 2 +- test/timeline_context_test.dart | 2 +- test/timeline_test.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/timeline.dart b/lib/src/timeline.dart index f465e718..c592620f 100644 --- a/lib/src/timeline.dart +++ b/lib/src/timeline.dart @@ -363,7 +363,7 @@ class Timeline { } /// Set the read marker to the last synced event in this timeline. - Future setReadMarker(String? eventId, {bool? public}) async { + Future setReadMarker({String? eventId, bool? public}) async { eventId ??= events.firstWhereOrNull((event) => event.status.isSynced)?.eventId; if (eventId == null) return; diff --git a/test/timeline_context_test.dart b/test/timeline_context_test.dart index cb4d574b..f62b45c8 100644 --- a/test/timeline_context_test.dart +++ b/test/timeline_context_test.dart @@ -480,7 +480,7 @@ void main() { await waitForCount(7); room.notificationCount = 1; - await timeline.setReadMarker(null); + await timeline.setReadMarker(); //expect(room.notificationCount, 0); }); test('sending an event and the http request finishes first, 0 -> 1 -> 2', diff --git a/test/timeline_test.dart b/test/timeline_test.dart index 543d77e6..97f73897 100644 --- a/test/timeline_test.dart +++ b/test/timeline_test.dart @@ -706,7 +706,7 @@ void main() { )); await Future.delayed(Duration(milliseconds: 50)); room.notificationCount = 1; - await timeline.setReadMarker(null); + await timeline.setReadMarker(); //expect(room.notificationCount, 0); }); test('sending an event and the http request finishes first, 0 -> 1 -> 2',