From 56af96c7ea818c9bf6421891a7b565305ba2f4e5 Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Mon, 13 Sep 2021 13:25:16 +0200 Subject: [PATCH] fix: Get direct chat from user ID method The method was not type safe and therefore there was no warning that with the sortOrder changes now DateTimes are compared which leads to an exception in the app if not using converting to milliseconds first. --- lib/src/client.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 327ead6d..58adf8e8 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -306,8 +306,8 @@ class Client extends MatrixApi { null, (prev, r) => prev == null ? r - : (prev.lastEvent.originServerTs < - r.lastEvent.originServerTs + : (prev.lastEvent.originServerTs.millisecondsSinceEpoch < + r.lastEvent.originServerTs.millisecondsSinceEpoch ? r : prev)) .id;