fix: dispose client subs on logout

This commit is contained in:
Sorunome 2021-09-18 13:20:51 +02:00
parent 74735bbd5d
commit c136c69ed4
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C

View File

@ -368,6 +368,13 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
});
onLoginStateChanged[name] ??= c.onLoginStateChanged.stream.listen((state) {
final loggedInWithMultipleClients = widget.clients.length > 1;
if (state != LoginState.loggedIn) {
_cancelSubs(c.clientName);
widget.router.currentState.to(
'/rooms',
queryParameters: widget.router.currentState.queryParameters,
);
}
if (loggedInWithMultipleClients) {
// TODO: display a nicer toast
showOkAlertDialog(