From adb907bbc443f8180e491003ffc99bb78fcab5b3 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 21 Sep 2020 17:37:03 +0200 Subject: [PATCH] fix: Clear on logout --- lib/src/client.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/client.dart b/lib/src/client.dart index 58f3492..5d8cb94 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -758,6 +758,11 @@ class Client extends MatrixApi { Logs.error('Error during processing events: ' + e.toString(), s); onSyncError.add(SdkError( exception: e is Exception ? e : Exception(e), stackTrace: s)); + if (e is MatrixException && + e.errcode == MatrixError.M_UNKNOWN_TOKEN.toString().split('.').last) { + Logs.warning('The user has been logged out!'); + clear(); + } } }