Skip to content

Commit

Permalink
TW-1356: fix multiple accout with same homeserver can login
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockvn authored and hoangdat committed May 31, 2024
1 parent f1e032a commit e1bdf11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/pages/homeserver_picker/homeserver_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart';
import 'package:fluffychat/presentation/mixins/connect_page_mixin.dart';
import 'package:fluffychat/pages/homeserver_picker/homeserver_state.dart';
import 'package:fluffychat/utils/client_manager.dart';
import 'package:fluffychat/utils/dialog/twake_dialog.dart';
import 'package:fluffychat/utils/twake_snackbar.dart';
import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -145,9 +146,12 @@ class HomeserverPickerController extends State<HomeserverPicker>
homeserver = Uri.https(homeserverController.text, '');
}
final matrix = Matrix.of(context);

final allHomeserverLoggedIn = (await ClientManager.getClients())
.map((client) => client.homeserver.toString())
.toList();
Logs().i('All homeservers: $allHomeserverLoggedIn');
final homeserverExists =
homeserver == matrix.client.homeserver && matrix.client.isLogged();
allHomeserverLoggedIn.contains(homeserver.toString());

if (homeserverExists &&
!AppConfig.supportMultipleAccountsInTheSameHomeserver) {
Expand Down

0 comments on commit e1bdf11

Please sign in to comment.