Skip to content

Commit

Permalink
TW-1791: Fix missing setUpToMServices when switch account
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev committed Jun 17, 2024
1 parent 52c6b0c commit 81e8897
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/domain/contact_manager/contacts_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class ContactsManager {

Future<void> reSyncContacts() async {
_contactsNotifier.value = const Right(ContactsInitial());
_phonebookContactsNotifier.value =
const Right(GetPhonebookContactsInitial());
}

void initialSynchronizeContacts({
Expand Down
14 changes: 10 additions & 4 deletions lib/widgets/matrix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,9 @@ class MatrixState extends State<Matrix>
ToMServerInformation tomServer,
IdentityServerInformation? identityServer,
) {
Logs().d('MatrixState::setUpToMServices: $tomServer, $identityServer');
Logs().d(
'MatrixState::setUpToMServices: $tomServer, ${identityServer?.baseUrl}',
);
_setUpToMServer(tomServer);
if (identityServer != null) {
_setUpIdentityServer(identityServer);
Expand Down Expand Up @@ -711,22 +713,26 @@ class MatrixState extends State<Matrix>
'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(
Expand Down

0 comments on commit 81e8897

Please sign in to comment.