diff --git a/lib/src/client.dart b/lib/src/client.dart index 74bae74a..4423444b 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -81,8 +81,6 @@ class Client extends MatrixApi { Set supportedLoginTypes; - int sendMessageTimeoutSeconds; - bool requestHistoryOnLimitedTimeline; final bool formatLocalpart; @@ -179,7 +177,6 @@ class Client extends MatrixApi { Set? roomPreviewLastEvents, this.pinUnreadRooms = false, this.pinInvitedRooms = true, - this.sendMessageTimeoutSeconds = 60, this.requestHistoryOnLimitedTimeline = false, Set? supportedLoginTypes, this.mxidLocalPartFallback = true, diff --git a/lib/src/event.dart b/lib/src/event.dart index 6ebaf00f..6cbd9b2f 100644 --- a/lib/src/event.dart +++ b/lib/src/event.dart @@ -123,7 +123,7 @@ class Event extends MatrixEvent { originServerTs.millisecondsSinceEpoch; final room = this.room; - if (age > room.client.sendMessageTimeoutSeconds * 1000) { + if (age > room.client.sendTimelineEventTimeout.inMilliseconds) { // Update this event in database and open timelines final json = toJson(); json['unsigned'] ??= {}; diff --git a/test/fake_client.dart b/test/fake_client.dart index cee178d0..822c2a68 100644 --- a/test/fake_client.dart +++ b/test/fake_client.dart @@ -26,12 +26,14 @@ const ssssKey = 'EsT9 RzbW VhPW yqNp cC7j ViiW 5TZB LuY4 ryyv 9guN Ysmr WDPH'; const pickledOlmAccount = 'N2v1MkIFGcl0mQpo2OCwSopxPQJ0wnl7oe7PKiT4141AijfdTIhRu+ceXzXKy3Kr00nLqXtRv7kid6hU4a+V0rfJWLL0Y51+3Rp/ORDVnQy+SSeo6Fn4FHcXrxifJEJ0djla5u98fBcJ8BSkhIDmtXRPi5/oJAvpiYn+8zMjFHobOeZUAxYR0VfQ9JzSYBsSovoQ7uFkNks1M4EDUvHtuyg3RxViwdNxs3718fyAqQ/VSwbXsY0Nl+qQbF+nlVGHenGqk5SuNl1P6e1PzZxcR0IfXA94Xij1Ob5gDv5YH4UCn9wRMG0abZsQP0YzpDM0FLaHSCyo9i5JD/vMlhH+nZWrgAzPPCTNGYewNV8/h3c+VyJh8ZTx/fVi6Yq46Fv+27Ga2ETRZ3Qn+Oyx6dLBjnBZ9iUvIhqpe2XqaGA1PopOz8iDnaZitw'; -Future getClient() async { +Future getClient( + {Duration sendTimelineEventTimeout = const Duration(minutes: 1)}) async { final client = Client( 'testclient', httpClient: FakeMatrixApi(), databaseBuilder: getDatabase, onSoftLogout: (client) => client.refreshAccessToken(), + sendTimelineEventTimeout: sendTimelineEventTimeout, ); FakeMatrixApi.client = client; await client.checkHomeserver(Uri.parse('https://fakeServer.notExisting'), diff --git a/test/room_archived_test.dart b/test/room_archived_test.dart index d5be2633..b21d9caf 100644 --- a/test/room_archived_test.dart +++ b/test/room_archived_test.dart @@ -32,8 +32,9 @@ void main() { late Client client; setUp(() async { - client = await getClient(); - client.sendMessageTimeoutSeconds = 5; + client = await getClient( + sendTimelineEventTimeout: const Duration(seconds: 5), + ); await client.abortSync(); insertList.clear(); diff --git a/test/timeline_context_test.dart b/test/timeline_context_test.dart index 1c2fbb2d..5b25fc6e 100644 --- a/test/timeline_context_test.dart +++ b/test/timeline_context_test.dart @@ -62,8 +62,9 @@ void main() { late Room room; late Timeline timeline; setUp(() async { - client = await getClient(); - client.sendMessageTimeoutSeconds = 5; + client = await getClient( + sendTimelineEventTimeout: const Duration(seconds: 5), + ); room = Room( id: roomID, client: client, prev_batch: 't123', roomAccountData: {}); diff --git a/test/timeline_test.dart b/test/timeline_test.dart index f82e511f..b4c14b85 100644 --- a/test/timeline_test.dart +++ b/test/timeline_test.dart @@ -64,8 +64,9 @@ void main() { late Room room; late Timeline timeline; setUp(() async { - client = await getClient(); - client.sendMessageTimeoutSeconds = 5; + client = await getClient( + sendTimelineEventTimeout: const Duration(seconds: 5), + ); final poison = Random().nextInt(2 ^ 32); currentPoison = poison;