From 81e8897dc8ce368cf69054a58e63463277d7cb88 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Tue, 11 Jun 2024 14:40:57 +0700 Subject: [PATCH] TW-1791: Fix missing `setUpToMServices` when switch account --- lib/domain/contact_manager/contacts_manager.dart | 2 ++ lib/widgets/matrix.dart | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/domain/contact_manager/contacts_manager.dart b/lib/domain/contact_manager/contacts_manager.dart index afeb26b603..81a86b2fdd 100644 --- a/lib/domain/contact_manager/contacts_manager.dart +++ b/lib/domain/contact_manager/contacts_manager.dart @@ -47,6 +47,8 @@ class ContactsManager { Future reSyncContacts() async { _contactsNotifier.value = const Right(ContactsInitial()); + _phonebookContactsNotifier.value = + const Right(GetPhonebookContactsInitial()); } void initialSynchronizeContacts({ diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index 9ef31a851b..1386b849df 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -599,7 +599,9 @@ class MatrixState extends State ToMServerInformation tomServer, IdentityServerInformation? identityServer, ) { - Logs().d('MatrixState::setUpToMServices: $tomServer, $identityServer'); + Logs().d( + 'MatrixState::setUpToMServices: $tomServer, ${identityServer?.baseUrl}', + ); _setUpToMServer(tomServer); if (identityServer != null) { _setUpIdentityServer(identityServer); @@ -711,22 +713,26 @@ class MatrixState extends State 'Matrix::_checkHomeserverExists: Old twakeSupported - $twakeSupported', ); if (client == null && client?.userID == null) return; - setUpAuthorization(client!); try { - final toMConfigurations = await getTomConfigurations(client.userID!); + final toMConfigurations = await getTomConfigurations(client!.userID!); Logs().d( 'Matrix::_checkHomeserverExists: toMConfigurations - $toMConfigurations', ); if (toMConfigurations == null) { _setUpToMServer(null); _setupAuthUrl(); + setUpAuthorization(client); } else { - _setUpToMServer(toMConfigurations.tomServerInformation); _setupAuthUrl(url: toMConfigurations.authUrl); + setUpToMServices( + toMConfigurations.tomServerInformation, + toMConfigurations.identityServerInformation, + ); } } catch (e) { _setUpToMServer(null); _setupAuthUrl(); + setUpAuthorization(client!); Logs().e('Matrix::_checkHomeserverExists: error - $e'); } Logs().d(