fix: Clear on logout

This commit is contained in:
Christian Pauly 2020-09-21 17:37:03 +02:00
parent 86a4f90a5a
commit adb907bbc4
1 changed files with 5 additions and 0 deletions

View File

@ -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();
}
}
}