chore: add some debugging statement for staging logout issue (#4234)
This commit is contained in:
parent
dc55796ea6
commit
6dddefcb6d
2 changed files with 27 additions and 6 deletions
|
|
@ -30,20 +30,27 @@ abstract class ClientManager {
|
|||
bool initialize = true,
|
||||
required SharedPreferences store,
|
||||
}) async {
|
||||
Logs().i('Getting clients from store');
|
||||
|
||||
if (PlatformInfos.isLinux) {
|
||||
Hive.init((await getApplicationSupportDirectory()).path);
|
||||
} else {
|
||||
await Hive.initFlutter();
|
||||
}
|
||||
|
||||
final clientNames = <String>{};
|
||||
try {
|
||||
final clientNamesList = store.getStringList(clientNamespace) ?? [];
|
||||
Logs().i('Found client names in store: $clientNamesList');
|
||||
clientNames.addAll(clientNamesList);
|
||||
} catch (e, s) {
|
||||
Logs().w('Client names in store are corrupted', e, s);
|
||||
await store.remove(clientNamespace);
|
||||
}
|
||||
if (clientNames.isEmpty) {
|
||||
Logs().i(
|
||||
'No client names found, adding default client name ${PlatformInfos.clientName}',
|
||||
);
|
||||
clientNames.add(PlatformInfos.clientName);
|
||||
await store.setStringList(clientNamespace, clientNames.toList());
|
||||
}
|
||||
|
|
@ -86,6 +93,7 @@ abstract class ClientManager {
|
|||
String clientName,
|
||||
SharedPreferences store,
|
||||
) async {
|
||||
Logs().i('Adding client name $clientName to store');
|
||||
final clientNamesList = store.getStringList(clientNamespace) ?? [];
|
||||
clientNamesList.add(clientName);
|
||||
await store.setStringList(clientNamespace, clientNamesList);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
|||
import 'package:fluffychat/pangea/common/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/any_state_holder.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/course_plans/course_plan_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/learning_settings/utils/locale_provider.dart';
|
||||
import 'package:fluffychat/utils/client_manager.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
||||
|
|
@ -195,9 +196,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
);
|
||||
_registerSubs(_loginClientCandidate!.clientName);
|
||||
_loginClientCandidate = null;
|
||||
// #Pangea
|
||||
// FluffyChatApp.router.go('/rooms');
|
||||
// Pangea#
|
||||
FluffyChatApp.router.go('/rooms');
|
||||
});
|
||||
// #Pangea
|
||||
candidate.homeserver = Uri.parse("https://${AppConfig.defaultHomeserver}");
|
||||
|
|
@ -381,9 +380,23 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
}
|
||||
} else {
|
||||
// #Pangea
|
||||
if (state != LoginState.loggedIn) {
|
||||
FluffyChatApp.router.go('/home');
|
||||
}
|
||||
final isL2Set = await pangeaController.userController.isUserL2Set;
|
||||
final inCourse = client.rooms.any(
|
||||
(r) =>
|
||||
r.isSpace &&
|
||||
r.membership == Membership.join &&
|
||||
r.coursePlan != null,
|
||||
);
|
||||
final langCode = FluffyChatApp.router.state.pathParameters['langcode'];
|
||||
final registrationRedirect =
|
||||
langCode != null ? '/registration/$langCode' : '/registration';
|
||||
FluffyChatApp.router.go(
|
||||
state == LoginState.loggedIn
|
||||
? isL2Set && inCourse
|
||||
? '/rooms'
|
||||
: registrationRedirect
|
||||
: '/home',
|
||||
);
|
||||
// FluffyChatApp.router
|
||||
// .go(state == LoginState.loggedIn ? '/rooms' : '/home');
|
||||
// Pangea#
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue